• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    ctf errores

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1Resuelto ctf errores el Miér Jun 29, 2016 9:42 pm

    God Aries

    avatar
    Miembro
    Miembro
    Descripcion de mi problema:
    hola amigos de tf , meti a mi ot el evento de capturar la bandera y hasta el momento solo e tenido 2 bueno 3 problemas espero y puedan ayudarme


    el primer problema es que cuando creo el portal del evento no me deja entrar y me manda este error:

    [Tienes que estar registrado y conectado para ver este vínculo]



    y el segundo error cuando desaparece el portal que se crea cuando inicial el evento:

    [Tienes que estar registrado y conectado para ver este vínculo]



    Y este error tercer error tambien lo da junto con el segundo error:

    [Tienes que estar registrado y conectado para ver este vínculo]



    Script del primer error:

    Código:
    function onStepIn(cid, item, position, fromPosition)
     if getPlayerLevel(cid) >= 8 then
     doPlayerSetStorageValue(cid, 822066, 1)
     setGlobalStorageValue(822066, getStorageZero(822066) + 1)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "{Capture The Flag} Você entrou na sala de espera do evento Capture a Bandeira. Aguarde aqui até o evento iniciar.")
     doTeleportThing(cid, CTF.waitingRoom)
     else
     doPlayerSendCancel(cid, "Você deve ser level 8 ou mais para entrar no CTF.")
     return false
     end
     return true
    end



    Script del segundo error:

    Código:
    local function removeTp()
     local pos = CTF.tp_pos
     for i = 1, 255 do
     pos.stackpos = i
     if getThingFromPos(pos) and getThingFromPos(pos).uid > 0 and getThingFromPos(pos).itemid == 1387 then
     doRemoveItem(getThingFromPos(pos).uid, 1)
     break
     end
     end
    end

    function onSay(cid, words, param)

     setGlobalStorageValue(822066, 0)
     doBroadcastMessage("{Capture The Flag} A entrada para o evento foi liberada! Precisamos de pelo menos 10 jogadores para iniciar o evento. O evento começa daqui 5 minutos!")
     
     local tp = doCreateItem(1387, 1, CTF.tp_pos)
     doItemSetAttribute(tp, 'aid', 9789)
     addEvent(removeTp, 60 * 5 * 1000)
     addEvent(CTF.start, 60 * 5 * 1000)
     addEvent(CTF.stop, 60 * 60 * 1000)
     
     return true
    end



    Script del tercer error que me lo da casi al mismo tiempo que el segundo error:

    Código:
    local conditionGreen = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(conditionGreen, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(conditionGreen, {lookType = 129, lookHead = 82, lookBody = 82, lookLegs = 82, lookFeet = 82})
    local conditionRed = createConditionObject(CONDITION_OUTFIT)
    setConditionParam(conditionRed, CONDITION_PARAM_TICKS, -1)
    addOutfitCondition(conditionRed, {lookType = 129, lookHead = 94, lookBody = 94, lookLegs = 94, lookFeet = 94})
     

    CTF = {

     tp_pos = {x = 2498, y = 2498, z = 7},
     exit_ = {x = 2503, y = 2496, z = 7},
     
     storages = {greenFlag = 822067, redFlag = 822068, greenTeam = 822069, redTeam = 822070},
     
     greenFlag = 1437,
     redFlag = 1435,
     
     greenFlagPos = {x = 2530, y = 2376, z = 7},
     redFlagPos = {x = 2462, y = 2356, z = 7},

     waitingRoom = {x = 2492, y = 2279, z = 7},
     fromposWait = {x = 2486, y = 2272, z = 7},
     toposWait = {x = 2501, y = 2287, z = 7},
     
     base_A = {x = 2530, y = 2382, z = 7},
     base_B = {x = 2464, y = 2362, z = 7},
     
     getFirstPlayer = function()
     for x = CTF.fromposWait.x, CTF.toposWait.x do
     for y = CTF.fromposWait.y, CTF.toposWait.y do
     local area = {x = x, y = y, z = CTF.fromposWait.z}
     if getTopCreature(area) and getTopCreature(area).uid > 0 and isPlayer(getTopCreature(area).uid) then
     return getTopCreature(area).uid
     end
     end
     end
     end,

     start = function()
     local function removeFlag(pos, id)
     local pp = pos
     for i = 1, 255 do
     pp.stackpos = i
     local flag = getThingFromPos(pos)
     if flag and flag.uid > 0 and flag.itemid == id then
     doRemoveItem(flag.uid, 1)
     end
     end
     end
     
     if getGlobalStorageValue(822066) >= 2 then
     if getGlobalStorageValue(822066) % 2 ~= 0 then
     local player = CTF.getFirstPlayer()
     doTeleportThing(player, getTownTemplePosition(getPlayerTown(player)))
     doPlayerSetStorageValue(player, 822066, -1)
     setGlobalStorageValue(822066, getGlobalStorageValue(822066) - 1)
     doPlayerSendTextMessage(player, MESSAGE_STATUS_WARNING, "{Capture The Flag} Que azar! Você foi retirado do evento por excesso de participantes :(")
     end
     removeFlag(CTF.redFlagPos, CTF.redFlag)
     removeFlag(CTF.greenFlagPos, CTF.greenFlag)
     setGlobalStorageValue(CTF.storages.greenTeam, 0)
     setGlobalStorageValue(CTF.storages.redTeam, 0)
     warnPlayersWithStorage(822066, 1, MESSAGE_STATUS_WARNING, "{Capture The Flag} O evento começou, boa sorte a todos. O time que chegar a 10 pontos primeiro ganha!")
     local a = getGlobalStorageValue(822066) / 2
     for i = 1, a do
     local player = CTF.getFirstPlayer()
     doAddCondition(player, conditionGreen)
     doPlayerSetStorageValue(player, CTF.storages.greenTeam, 1)
     doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, "{Capture The Flag} Você entrou no time verde, boa sorte!")
         doTeleportThing(player, CTF.base_A)
     end
     for j = 1, a do
     local player = CTF.getFirstPlayer()
     doAddCondition(player, conditionRed)
     doPlayerSetStorageValue(player, CTF.storages.redTeam, 1)
     doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_BLUE, "{Capture The Flag} Você entrou no time vermelho, boa sorte!")
       doTeleportThing(player, CTF.base_B)
     end
     local green = doCreateItem(CTF.greenFlag, 1, CTF.greenFlagPos)
     doItemSetAttribute(green, 'aid', 5434)
     local red = doCreateItem(CTF.redFlag, 1, CTF.redFlagPos)
     doItemSetAttribute(red, 'aid', 5435)
     else
     for _, pid in pairs(getPlayersInArea(CTF.fromposWait, CTF.toposWait)) do
     doPlayerSendTextMessage(pid, MESSAGE_STATUS_WARNING, "{Capture The Flag} O evento não teve pelo menos 10 participantes e foi cancelado.")
     doPlayerSetStorageValue(pid, 822066, -1)
     doTeleportThing(pid, CTF.exit_)
     end
     end
     end,

     removeFlags = function()
     local posGreen = CTF.greenFlagPos
     local posRed = CTF.redFlagPos
     for i = 1, 255 do
     posGreen.stackpos = i
     posRed.stackpos = i
     local green = getThingFromPos(posGreen)
     local red = getThingFromPos(posRed)
     if green and green.uid > 0 and green.itemid == CTF.greenFlag then
     doRemoveItem(green.uid, 1)
     end
     if red and red.uid > 0 and red.itemid == CTF.redFlag then
         doRemoveItem(red.uid, 1)
     end
     end
     end,
     
     
     doPlayerAddFlag = function(cid, flag)
     local function removeFlag(pos, id)
     local pp = pos
     for i = 1, 255 do
     pp.stackpos = i
     local flag = getThingFromPos(pos)
     if flag and flag.uid > 0 and flag.itemid == id then
     doRemoveItem(flag.uid, 1)
     end
     end
     end
     
     if isPlayer(cid) then
     removeFlag(getThingPos(cid), getPlayerStorageValue(cid, CTF.storages.greenFlag) == 1 and "green" or "red")
     
     local pos = getThingPos(cid)
     
     if flag == "green" then
     if getPlayerStorageValue(cid, CTF.storages.greenFlag) == 1 then
     doCreateItem(CTF.greenFlag, 1, pos)
     addEvent(removeFlag, 400, pos, CTF.greenFlag)
     addEvent(CTF.doPlayerAddFlag, 550, cid, flag)
     doSendAnimatedText(pos, "FLAG", 18)
     end
     elseif flag == "red" then
     if getPlayerStorageValue(cid, CTF.storages.redFlag) == 1 then
     doCreateItem(CTF.redFlag, 1, pos)
     addEvent(removeFlag, 400, pos, CTF.redFlag)
     addEvent(CTF.doPlayerAddFlag, 550, cid, flag)
     doSendAnimatedText(pos, "FLAG", 18)
     end
     end
     end
     end,
     
     stop = function()
     local players = {}
     local str = ""
     for _, pid in pairs(getPlayersOnline()) do
     if getPlayerStorageValue(pid, 822066) == 1 then
     table.insert(players, pid)
     end
     end
     if #players >= 1 then
     if getStorageZero(CTF.storages.redTeam) > getStorageZero(CTF.storages.greenTeam) then
     for _, pid in pairs(players) do
     if getPlayerStorageValue(pid, CTF.storages.redTeam) == 1 then
     local am = {8302, 8306, 8300, 5957}
     doPlayerAddItem(pid, 2157, 30)
     doPlayerAddItem(pid, am[math.random(1, 4)], 1)
     end
     end
     str = "{Capture The Flag} O time Vermelho venceu o evento! Placar: Time Vermelho ["..getStorageZero(CTF.storages.redTeam).."] VS ["..getStorageZero(CTF.storages.greenTeam).."] Time Verde. Os jogadores do time Vermelho receberam prêmios!"
     elseif getStorageZero(CTF.storages.greenTeam) > getStorageZero(CTF.storages.redTeam) then
     for _, pid in pairs(players) do
     if getPlayerStorageValue(pid, CTF.storages.greenTeam) == 1 then
     local am = {8302, 8306, 8300, 5957}
     doPlayerAddItem(pid, 2157, 100)
     doPlayerAddItem(pid, am[math.random(1, 4)], 1)
     end
     end
     str = "{Capture The Flag} O time Verde venceu o evento! Placar: Time Verde ["..getStorageZero(CTF.storages.greenTeam).."] VS ["..getStorageZero(CTF.storages.redTeam).."] Time Vermelho. Os jogadores do time Verde receberam prêmios!"
     elseif getStorageZero(CTF.storages.greenTeam) == getStorageZero(CTF.storages.redTeam) then
     for _, pid in pairs(players) do
     doPlayerAddItem(pid, 2157, 50)
     end
     str = "{Capture The Flag} Houve um empate! Os dois times fizeram "..getStorageZero(CTF.storages.greenTeam).." pontos!"
     end
     warnPlayersWithStorage(822066, 1, 25, "{Capture The Flag} O evento acabou pois excedeu o limite 1 hora de duração! "..str)
     CTF.removeFlags()
     for _, pid in pairs(players) do
     if getPlayerStorageValue(pid, CTF.storages.greenFlag) == 1 or getPlayerStorageValue(pid, CTF.storages.redFlag) == 1 then
     doPlayerSetStorageValue(pid, CTF.storages.greenFlag, -1)
     doPlayerSetStorageValue(pid, CTF.storages.redFlag, -1)
     end
     doTeleportThing(pid, CTF.exit_)
     doPlayerSetStorageValue(pid, 822066, -1)
     doPlayerSetStorageValue(pid, CTF.storages.greenTeam, -1)
     doPlayerSetStorageValue(pid, CTF.storages.redTeam, -1)
     doPlayerSetStorageValue(pid, CTF.storages.greenFlag, -1)
     doPlayerSetStorageValue(pid, CTF.storages.redFlag, -1)
     doRemoveCondition(pid, CONDITION_OUTFIT)
     end
     else
     return false
     end
     end
     }


    Imagen de mi Error:


    Mi problema esta en:
    Consola

    Ver perfil de usuario

    2Resuelto Re: ctf errores el Miér Jun 29, 2016 11:48 pm

    [Admin] God Maya

    avatar
    Administrador
    Administrador
    por el momento tengo dos soluciones esto coloca en tu 050-funtions en las lib


    Código:
    function getPlayersInArea(fromPos, toPos) -- function by amoeba13
    playersInArea = {}
    for x = fromPos.x, toPos.x do
    for y = fromPos.y, toPos.y do
    for z = fromPos.z, toPos.z do
    totalArea = {x=x, y=y, z=z}
    playerz = getTopCreature(totalArea)
    ifisPlayer(playerz.uid) then
    table.insert(playersInArea, playerz.uid)
    end
    end
    end
    end
    return playersInArea
    end


    function getPlayerStorageZero(cid, storage) -- By Killua
        local sto = getPlayerStorageValue(cid, storage)
        return sto > 0 and sto or 0
    end

    function getStorageZero(storage) -- By Killua
        local sto = getGlobalStorageValue(storage)
        return sto > 0 and sto or 0
    end




    Ver perfil de usuario http://www.tibiaface.com

    3Resuelto Re: ctf errores el Jue Jun 30, 2016 1:58 am

    God Aries

    avatar
    Miembro
    Miembro
    tengo errores, te colocare mi 050 functions

    Código:
    function isInArray(array, value, caseSensitive)
     if(caseSensitive == nil or caseSensitive == false) and type(value) == "string" then
     local lowerValue = value:lower()
     for _, _value in ipairs(array) do
     if type(_value) == "string" and lowerValue == _value:lower() then
     return true
     end
     end
     else
     for _, _value in ipairs(array) do
     if (value == _value) then return true end
     end
     end

     return false
    end

    function doPlayerGiveItem(cid, itemid, amount, subType)
     local item = 0
     if(isItemStackable(itemid)) then
     item = doCreateItemEx(itemid, amount)
     if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
     return false
     end
     else
     for i = 1, amount do
     item = doCreateItemEx(itemid, subType)
     if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
     return false
     end
     end
     end

     return true
    end

    function doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType)
     for i = 1, amount do
     local container = doCreateItemEx(containerid, 1)
     for x = 1, getContainerCapById(containerid) do
     doAddContainerItem(container, itemid, subType)
     end

     if(doPlayerAddItemEx(cid, container, true) ~= RETURNVALUE_NOERROR) then
     return false
     end
     end

     return true
    end

    function doPlayerTakeItem(cid, itemid, amount)
     return getPlayerItemCount(cid, itemid) >= amount and doPlayerRemoveItem(cid, itemid, amount)
    end

    function doPlayerSellItem(cid, itemid, count, cost)
     if(not doPlayerTakeItem(cid, itemid, count)) then
     return false
     end

     if(not doPlayerAddMoney(cid, cost)) then
     error('[doPlayerSellItem] Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).')
     end

     return true
    end

    function doPlayerWithdrawMoney(cid, amount)
     if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
     return false
     end

     local balance = getPlayerBalance(cid)
     if(amount > balance or not doPlayerAddMoney(cid, amount)) then
     return false
     end

     doPlayerSetBalance(cid, balance - amount)
     return true
    end

    function doPlayerDepositMoney(cid, amount)
     if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
     return false
     end

     if(not doPlayerRemoveMoney(cid, amount)) then
     return false
     end

     doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)
     return true
    end

    function doPlayerAddStamina(cid, minutes)
     return doPlayerSetStamina(cid, getPlayerStamina(cid) + minutes)
    end

    function isPremium(cid)
     return (isPlayer(cid) and (getPlayerPremiumDays(cid) > 0 or getBooleanFromString(getConfigValue('freePremium'))))
    end

    function getMonthDayEnding(day)
     if(day == "01" or day == "21" or day == "31") then
     return "st"
     elseif(day == "02" or day == "22") then
     return "nd"
     elseif(day == "03" or day == "23") then
     return "rd"
     end

     return "th"
    end

    function getMonthString(m)
     return os.date("%B", os.time{year = 1970, month = m, day = 1})
    end

    function getArticle(str)
     return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
    end

    function doNumberFormat(i)
     local str, found = string.gsub(i, "(%d)(%d%d%d)$", "%1,%2", 1), 0
     repeat
     str, found = string.gsub(str, "(%d)(%d%d%d),", "%1,%2,", 1)
     until found == 0
     return str
    end

    function doPlayerAddAddons(cid, addon)
     for i = 0, table.maxn(maleOutfits) do
     doPlayerAddOutfit(cid, maleOutfits[i], addon)
     end

     for i = 0, table.maxn(femaleOutfits) do
     doPlayerAddOutfit(cid, femaleOutfits[i], addon)
     end
    end

    function getTibiaTime(num)
     local minutes, hours = getWorldTime(), 0
     while (minutes > 60) do
     hours = hours + 1
     minutes = minutes - 60
     end

     if(num) then
     return {hours = hours, minutes = minutes}
     end

     return {hours =  hours < 10 and '0' .. hours or '' .. hours, minutes = minutes < 10 and '0' .. minutes or '' .. minutes}
    end

    function doWriteLogFile(file, text)
     local f = io.open(file, "a+")
     if(not f) then
     return false
     end

     f:write("[" .. os.date("%d/%m/%Y %H:%M:%S") .. "] " .. text .. "\n")
     f:close()
     return true
    end

    function getExperienceForLevel(lv)
     lv = lv - 1
     return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
    end

    function doMutePlayer(cid, time)
     local condition = createConditionObject(CONDITION_MUTED, (time == -1 and time or time * 1000))
     return doAddCondition(cid, condition, false)

    end

    function doSummonCreature(name, pos)
     local cid = doCreateMonster(name, pos, false, false)
     if(not cid) then
     cid = doCreateNpc(name, pos)
     end

     return cid
    end

    function getPlayersOnlineEx()
     local players = {}
     for i, cid in ipairs(getPlayersOnline()) do
     table.insert(players, getCreatureName(cid))
     end

     return players
    end

    function getPlayerByName(name)
     local cid = getCreatureByName(name)
     return isPlayer(cid) and cid or nil
    end

    function isPlayer(cid)
     return isCreature(cid) and cid >= AUTOID_PLAYERS and cid < AUTOID_MONSTERS
    end

    function isPlayerGhost(cid)
     return isPlayer(cid) and (getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE, CONDITIONID_DEFAULT) or getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBESEEN))
    end

    function isMonster(cid)
     return isCreature(cid) and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS
    end

    function isNpc(cid)
     -- Npc IDs are over int32_t range (which is default for lua_pushnumber),
     -- therefore number is always a negative value.
     return isCreature(cid) and (cid < 0 or cid >= AUTOID_NPCS)
    end

    function isUnderWater(cid)
     return isInArray(underWater, getTileInfo(getCreaturePosition(cid)).itemid)
    end

    function doPlayerAddLevel(cid, amount, round)
     local experience, level, amount = 0, getPlayerLevel(cid), amount or 1
     if(amount > 0) then
     experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level))
     else
     experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount))
     end

     return doPlayerAddExperience(cid, experience)
    end

    function doPlayerAddMagLevel(cid, amount)
     local amount = amount or 1
     for i = 1, amount do
     doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false)
     end

     return true
    end

    function doPlayerAddSkill(cid, skill, amount, round)
     local amount = amount or 1
     if(skill == SKILL__LEVEL) then
     return doPlayerAddLevel(cid, amount, round)
     elseif(skill == SKILL__MAGLEVEL) then
     return doPlayerAddMagLevel(cid, amount)
     end

     for i = 1, amount do
     doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
     end

     return true
    end

    function isPrivateChannel(channelId)
     return channelId >= CHANNEL_PRIVATE
    end

    function doBroadcastMessage(text, class)
     local class = class or MESSAGE_STATUS_WARNING
     if(type(class) == 'string') then
     local className = MESSAGE_TYPES[class]
     if(className == nil) then
     return false
     end

     class = className
     elseif(class < MESSAGE_FIRST or class > MESSAGE_LAST) then
     return false
     end

     for _, pid in ipairs(getPlayersOnline()) do
     doPlayerSendTextMessage(pid, class, text)
     end

     print("> Broadcasted message: \"" .. text .. "\".")
     return true
    end

    function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)
     local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST
     if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then
     return false
     end

     if(type(class) == 'string') then
     local className = TALKTYPE_TYPES[class]
     if(className == nil) then
     return false
     end

     class = className
     elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then
     return false
     end

     for _, pid in ipairs(getPlayersOnline()) do
     doCreatureSay(cid, text, class, ghost, pid)
     end

     print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".")
     return true
    end

    function doCopyItem(item, attributes)
     local attributes = ((type(attributes) == 'table') and attributes or { "aid" })

     local ret = doCreateItemEx(item.itemid, item.type)
     for _, key in ipairs(attributes) do
     local value = getItemAttribute(item.uid, key)
     if(value ~= nil) then
     doItemSetAttribute(ret, key, value)
     end
     end

     if(isContainer(item.uid)) then
     for i = (getContainerSize(item.uid) - 1), 0, -1 do
     local tmp = getContainerItem(item.uid, i)
     if(tmp.itemid > 0) then
     doAddContainerItemEx(ret, doCopyItem(tmp, true).uid)
     end
     end
     end

     return getThing(ret)
    end

    function doSetItemText(uid, text, writer, date)
     local thing = getThing(uid)
     if(thing.itemid < 100) then
     return false
     end

     doItemSetAttribute(uid, "text", text)
     if(writer ~= nil) then
     doItemSetAttribute(uid, "writer", tostring(writer))
     if(date ~= nil) then
     doItemSetAttribute(uid, "date", tonumber(date))
     end
     end

     return true
    end

    function getItemWeightById(itemid, count, precision)
     local item, count, precision = getItemInfo(itemid), count or 1, precision or false
     if(not item) then
     return false
     end

     if(count > 100) then
     -- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count
     print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')
     end

     local weight = item.weight * count
     return precission and weight or math.round(weight, 2)
    end

    function choose(...)
     local arg, ret = {...}

     if type(arg[1]) == 'table' then
     ret = arg[1][math.random(#arg[1])]
     else
     ret = arg[math.random(#arg)]
     end

     return ret
    end

    function doPlayerAddExpEx(cid, amount)
     if(not doPlayerAddExp(cid, amount)) then
     return false
     end

     local position = getThingPosition(cid)
     doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "You gained " .. amount .. " experience.", amount, COLOR_WHITE, position)

     local spectators, name = getSpectators(position, 7, 7), getCreatureName(cid)
     for _, pid in ipairs(spectators) do
     if(isPlayer(pid) and cid ~= pid) then
     doPlayerSendTextMessage(pid, MESSAGE_EXPERIENCE_OTHERS, name .. " gained " .. amount .. " experience.", amount, COLOR_WHITE, position)
     end
     end

     return true
    end

    function getItemTopParent(uid)
     local parent = getItemParent(uid)
     if(not parent or parent.uid == 0) then
     return nil
     end

     while(true) do
     local tmp = getItemParent(parent.uid)
     if(tmp and tmp.uid ~= 0) then
     parent = tmp
     else
     break
     end
     end

     return parent
    end

    function getItemHolder(uid)
     local parent = getItemParent(uid)
     if(not parent or parent.uid == 0) then
     return nil
     end

     local holder = nil
     while(true) do
     local tmp = getItemParent(parent.uid)
     if(tmp and tmp.uid ~= 0) then
     if(tmp.itemid == 1) then -- a creature
     holder = tmp
     break
     end

     parent = tmp
     else
     break
     end
     end

     return holder
    end

    function valid(f)
     return function(p, ...)
     if(isCreature(p)) then
     return f(p, ...)
     end
     end
    end

    Ver perfil de usuario

    4Resuelto Re: ctf errores el Jue Jun 30, 2016 1:07 pm

    [Admin] God Maya

    avatar
    Administrador
    Administrador
    aqui lo tines

    Código:

        function isInArray(array, value, caseSensitive)
        if(caseSensitive == nil or caseSensitive == false) and type(value) == "string" then
        local lowerValue = value:lower()
        for _, _value in ipairs(array) do
        if type(_value) == "string" and lowerValue == _value:lower() then
        return true
        end
        end
        else
        for _, _value in ipairs(array) do
        if (value == _value) then return true end
        end
        end

        return false
        end

        function doPlayerGiveItem(cid, itemid, amount, subType)
        local item = 0
        if(isItemStackable(itemid)) then
        item = doCreateItemEx(itemid, amount)
        if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
        return false
        end
        else
        for i = 1, amount do
        item = doCreateItemEx(itemid, subType)
        if(doPlayerAddItemEx(cid, item, true) ~= RETURNVALUE_NOERROR) then
        return false
        end
        end
        end

        return true
        end

        function doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType)
        for i = 1, amount do
        local container = doCreateItemEx(containerid, 1)
        for x = 1, getContainerCapById(containerid) do
        doAddContainerItem(container, itemid, subType)
        end

        if(doPlayerAddItemEx(cid, container, true) ~= RETURNVALUE_NOERROR) then
        return false
        end
        end

        return true
        end

        function doPlayerTakeItem(cid, itemid, amount)
        return getPlayerItemCount(cid, itemid) >= amount and doPlayerRemoveItem(cid, itemid, amount)
        end

        function doPlayerSellItem(cid, itemid, count, cost)
        if(not doPlayerTakeItem(cid, itemid, count)) then
        return false
        end

        if(not doPlayerAddMoney(cid, cost)) then
        error('[doPlayerSellItem] Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).')
        end

        return true
        end

        function doPlayerWithdrawMoney(cid, amount)
        if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
        end

        local balance = getPlayerBalance(cid)
        if(amount > balance or not doPlayerAddMoney(cid, amount)) then
        return false
        end

        doPlayerSetBalance(cid, balance - amount)
        return true
        end

        function doPlayerDepositMoney(cid, amount)
        if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
        end

        if(not doPlayerRemoveMoney(cid, amount)) then
        return false
        end

        doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)
        return true
        end

        function doPlayerAddStamina(cid, minutes)
        return doPlayerSetStamina(cid, getPlayerStamina(cid) + minutes)
        end

        function isPremium(cid)
        return (isPlayer(cid) and (getPlayerPremiumDays(cid) > 0 or getBooleanFromString(getConfigValue('freePremium'))))
        end

        function getMonthDayEnding(day)
        if(day == "01" or day == "21" or day == "31") then
        return "st"
        elseif(day == "02" or day == "22") then
        return "nd"
        elseif(day == "03" or day == "23") then
        return "rd"
        end

        return "th"
        end

        function getMonthString(m)
        return os.date("%B", os.time{year = 1970, month = m, day = 1})
        end

        function getArticle(str)
        return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
        end

        function doNumberFormat(i)
        local str, found = string.gsub(i, "(%d)(%d%d%d)$", "%1,%2", 1), 0
        repeat
        str, found = string.gsub(str, "(%d)(%d%d%d),", "%1,%2,", 1)
        until found == 0
        return str
        end

        function doPlayerAddAddons(cid, addon)
        for i = 0, table.maxn(maleOutfits) do
        doPlayerAddOutfit(cid, maleOutfits[i], addon)
        end

        for i = 0, table.maxn(femaleOutfits) do
        doPlayerAddOutfit(cid, femaleOutfits[i], addon)
        end
        end

        function getTibiaTime(num)
        local minutes, hours = getWorldTime(), 0
        while (minutes > 60) do
        hours = hours + 1
        minutes = minutes - 60
        end

        if(num) then
        return {hours = hours, minutes = minutes}
        end

        return {hours =  hours < 10 and '0' .. hours or '' .. hours, minutes = minutes < 10 and '0' .. minutes or '' .. minutes}
        end

        function doWriteLogFile(file, text)
        local f = io.open(file, "a+")
        if(not f) then
        return false
        end

        f:write("[" .. os.date("%d/%m/%Y %H:%M:%S") .. "] " .. text .. "\n")
        f:close()
        return true
        end

        function getExperienceForLevel(lv)
        lv = lv - 1
        return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
        end

        function doMutePlayer(cid, time)
        local condition = createConditionObject(CONDITION_MUTED, (time == -1 and time or time * 1000))
        return doAddCondition(cid, condition, false)

        end

        function doSummonCreature(name, pos)
        local cid = doCreateMonster(name, pos, false, false)
        if(not cid) then
        cid = doCreateNpc(name, pos)
        end

        return cid
        end

        function getPlayersOnlineEx()
        local players = {}
        for i, cid in ipairs(getPlayersOnline()) do
        table.insert(players, getCreatureName(cid))
        end

        return players
        end

        function getPlayerByName(name)
        local cid = getCreatureByName(name)
        return isPlayer(cid) and cid or nil
        end

        function isPlayer(cid)
        return isCreature(cid) and cid >= AUTOID_PLAYERS and cid < AUTOID_MONSTERS
        end

        function isPlayerGhost(cid)
        return isPlayer(cid) and (getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE, CONDITIONID_DEFAULT) or getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBESEEN))
        end

        function isMonster(cid)
        return isCreature(cid) and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS
        end

        function isNpc(cid)
        -- Npc IDs are over int32_t range (which is default for lua_pushnumber),
        -- therefore number is always a negative value.
        return isCreature(cid) and (cid < 0 or cid >= AUTOID_NPCS)
        end

        function isUnderWater(cid)
        return isInArray(underWater, getTileInfo(getCreaturePosition(cid)).itemid)
        end

        function doPlayerAddLevel(cid, amount, round)
        local experience, level, amount = 0, getPlayerLevel(cid), amount or 1
        if(amount > 0) then
        experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level))
        else
        experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount))
        end

        return doPlayerAddExperience(cid, experience)
        end

        function doPlayerAddMagLevel(cid, amount)
        local amount = amount or 1
        for i = 1, amount do
        doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false)
        end

        return true
        end

        function doPlayerAddSkill(cid, skill, amount, round)
        local amount = amount or 1
        if(skill == SKILL__LEVEL) then
        return doPlayerAddLevel(cid, amount, round)
        elseif(skill == SKILL__MAGLEVEL) then
        return doPlayerAddMagLevel(cid, amount)
        end

        for i = 1, amount do
        doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
        end

        return true
        end

        function isPrivateChannel(channelId)
        return channelId >= CHANNEL_PRIVATE
        end

        function doBroadcastMessage(text, class)
        local class = class or MESSAGE_STATUS_WARNING
        if(type(class) == 'string') then
        local className = MESSAGE_TYPES[class]
        if(className == nil) then
        return false
        end

        class = className
        elseif(class < MESSAGE_FIRST or class > MESSAGE_LAST) then
        return false
        end

        for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendTextMessage(pid, class, text)
        end

        print("> Broadcasted message: \"" .. text .. "\".")
        return true
        end

        function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)
        local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST
        if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then
        return false
        end

        if(type(class) == 'string') then
        local className = TALKTYPE_TYPES[class]
        if(className == nil) then
        return false
        end

        class = className
        elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then
        return false
        end

        for _, pid in ipairs(getPlayersOnline()) do
        doCreatureSay(cid, text, class, ghost, pid)
        end

        print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".")
        return true
        end

        function doCopyItem(item, attributes)
        local attributes = ((type(attributes) == 'table') and attributes or { "aid" })

        local ret = doCreateItemEx(item.itemid, item.type)
        for _, key in ipairs(attributes) do
        local value = getItemAttribute(item.uid, key)
        if(value ~= nil) then
        doItemSetAttribute(ret, key, value)
        end
        end

        if(isContainer(item.uid)) then
        for i = (getContainerSize(item.uid) - 1), 0, -1 do
        local tmp = getContainerItem(item.uid, i)
        if(tmp.itemid > 0) then
        doAddContainerItemEx(ret, doCopyItem(tmp, true).uid)
        end
        end
        end

        return getThing(ret)
        end

        function doSetItemText(uid, text, writer, date)
        local thing = getThing(uid)
        if(thing.itemid < 100) then
        return false
        end

        doItemSetAttribute(uid, "text", text)
        if(writer ~= nil) then
        doItemSetAttribute(uid, "writer", tostring(writer))
        if(date ~= nil) then
        doItemSetAttribute(uid, "date", tonumber(date))
        end
        end

        return true
        end

        function getItemWeightById(itemid, count, precision)
        local item, count, precision = getItemInfo(itemid), count or 1, precision or false
        if(not item) then
        return false
        end

        if(count > 100) then
        -- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count
        print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')
        end

        local weight = item.weight * count
        return precission and weight or math.round(weight, 2)
        end

        function choose(...)
        local arg, ret = {...}

        if type(arg[1]) == 'table' then
        ret = arg[1][math.random(#arg[1])]
        else
        ret = arg[math.random(#arg)]
        end

        return ret
        end

        function doPlayerAddExpEx(cid, amount)
        if(not doPlayerAddExp(cid, amount)) then
        return false
        end

        local position = getThingPosition(cid)
        doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "You gained " .. amount .. " experience.", amount, COLOR_WHITE, position)

        local spectators, name = getSpectators(position, 7, 7), getCreatureName(cid)
        for _, pid in ipairs(spectators) do
        if(isPlayer(pid) and cid ~= pid) then
        doPlayerSendTextMessage(pid, MESSAGE_EXPERIENCE_OTHERS, name .. " gained " .. amount .. " experience.", amount, COLOR_WHITE, position)
        end
        end

        return true
        end

        function getItemTopParent(uid)
        local parent = getItemParent(uid)
        if(not parent or parent.uid == 0) then
        return nil
        end

        while(true) do
        local tmp = getItemParent(parent.uid)
        if(tmp and tmp.uid ~= 0) then
        parent = tmp
        else
        break
        end
        end

        return parent
        end

        function getItemHolder(uid)
        local parent = getItemParent(uid)
        if(not parent or parent.uid == 0) then
        return nil
        end

        local holder = nil
        while(true) do
        local tmp = getItemParent(parent.uid)
        if(tmp and tmp.uid ~= 0) then
        if(tmp.itemid == 1) then -- a creature
        holder = tmp
        break
        end

        parent = tmp
        else
        break
        end
        end

        return holder
        end

        function valid(f)
        return function(p, ...)
        if(isCreature(p)) then
        return f(p, ...)
        end
        end
        end
       
       
            function getPlayersInArea(fromPos, toPos) -- function by amoeba13
        playersInArea = {}
        for x = fromPos.x, toPos.x do
        for y = fromPos.y, toPos.y do
        for z = fromPos.z, toPos.z do
        totalArea = {x=x, y=y, z=z}
        playerz = getTopCreature(totalArea)
        ifisPlayer(playerz.uid) then
        table.insert(playersInArea, playerz.uid)
        end
        end
        end
        end
        return playersInArea
        end


        function getPlayerStorageZero(cid, storage)
            local sto = getPlayerStorageValue(cid, storage)
            return sto > 0 and sto or 0
        end

        function getStorageZero(storage)
            local sto = getGlobalStorageValue(storage)
            return sto > 0 and sto or 0
        end



    Ver perfil de usuario http://www.tibiaface.com

    5Resuelto Re: ctf errores el Jue Jun 30, 2016 1:29 pm

    God Aries

    avatar
    Miembro
    Miembro
    me bugeo todo mi server, mis scripts y monsters, este error me sale como 5mil vezes

    [Tienes que estar registrado y conectado para ver este vínculo]

    Ver perfil de usuario

    6Resuelto Re: ctf errores el Jue Jun 30, 2016 2:30 pm

    [Admin] God Maya

    avatar
    Administrador
    Administrador
    [Tienes que estar registrado y conectado para ver este vínculo] escribió:me bugeo todo mi server, mis scripts y monsters, este error me sale como 5mil vezes

    [Tienes que estar registrado y conectado para ver este vínculo]


    como te dije y me mostrates que el problema es que ese script esta realizado cpara tfs y otx 8.60 lo cual contiene el animtetext que tienes que modificar o quitarlo ya que esa funcion no existe en tfs y otx 10.31



    Ver perfil de usuario http://www.tibiaface.com

    7Resuelto Re: ctf errores el Sáb Jul 02, 2016 11:29 pm

    God Aries

    avatar
    Miembro
    Miembro
    cierren este tema, ya no uso este script

    Ver perfil de usuario

    Contenido patrocinado


    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).