Postado Agosto 14, 2016 9 anos Olá TIBIAKING, estou com um grande problema ao chamar Duel no meu servidor. Quando chamo Duelo tendo 2 pokemons na bag, da pra chamar Duel para 4 pokemons.. ou seja, está contando 2 pokemons a mais na bag na hora de chamar o Duel. alguem poderia me ajudar? segue a função que está sendo usada para checar os pokemons na bag: creaturescripts/scripts/tvsys.lua ---------------- Proteçao para os 2 players terem a qntdade de pokes pro duel local pokes1 = getLivePokeballs(cid, getPlayerSlotItem(cid, 3).uid, true) local pokes2 = getLivePokeballs(sid, getPlayerSlotItem(sid, 3).uid, true) if #pokes1 < (channelId-12) or #pokes2 < (channelId-12) then local tpw = getPlayerStorageValue(cid, 52480) > 1 and "ally" or "opponent" doPlayerSendTextMessage(cid, 20, "You or your "..tpw.." doesn't have that amount of pokemons in their bags! Duel are canceled!") doPlayerSetVocation(cid, 1) for i = 1, #storagesDuel do setPlayerStorageValue(cid, storagesDuel[i], -1) end doCreatureSetSkullType(cid, 0) return false end ---------------- e sobre esta função "getLivePokeballs" está armazenada em some functions.lua em /lib. Segue a função "getLivePokeballs". function getLivePokeballs(cid, container, duel) --alterado v2.8 if not isCreature(cid) then return {} end if not isContainer(container) then return {} end local items = {} --- local ballSlot = getPlayerSlotItem(cid, 8) if ballSlot.uid ~= 0 then for a, b in pairs (pokeballs) do if ballSlot.itemid == b.on or ballSlot.itemid == b.use then if duel and getPlayerLevel(cid) >= (pokes[getItemAttribute(ballSlot.uid, "poke")].level + getPokeballBoost(ballSlot)) then table.insert(items, ballSlot.uid) --alterado v2.8 elseif not duel then table.insert(items, ballSlot.uid) end end end end --- if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getPokeballsInContainer(item.uid) for i=0, #itemsbag do if not isInArray(items, itemsbag[i]) then table.insert(items, itemsbag[i]) end end elseif isPokeball(item.itemid) then for a, b in pairs (pokeballs) do if item.itemid == b.on then if duel and getPlayerLevel(cid) >= (pokes[getItemAttribute(item.uid, "poke")].level + getPokeballBoost(item)) then table.insert(items, item.uid) --alterado v2.8 elseif not duel then table.insert(items, item.uid) end end end end end end return items end Grato desde já para quem me ajudar! Atenciosamente, Lucas.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.