Postado Agosto 14, 2022 2 anos Olá a todos! Seguinte... No meu servidor toda vez que alguém abre uma box o autoloot para de funcionar (para o servidor todo, não só para o player que abriu). Tanto a box quanto o autoloot funciona perfeitamente, porém, quando alguém usa a box e recebe o pokemon, o autoloot para de funcionar. Depois de vários testes aqui eu descobri que o problema está na função "doTransformItem(item, id)" que está dentro da função "addPokeToPlayer". Dito isso, não estou conseguindo identificar por que isso acontece. Alguém consegue me ajudar? Vou deixar aqui embaixo o script da função, da box e do autoloot. Obs: Estou usando o Pokemon HuatsonOT V2.0 (DXP) como base. função addPokeToPlayer: function addPokeToPlayer(cid, pokemon, boost, gender, ball, unique, mega) --alterado v1.9 \/ peguem ele todo... local genders = { ["male"] = 4, ["female"] = 3, [1] = 4, [0] = 3, [4] = 4, [3] = 3, } if not isCreature(cid) then return false end local pokemon = doCorrectString(pokemon) if not pokes[pokemon] then return false end local GENDER = (gender and genders[gender]) and genders[gender] or getRandomGenderByName(pokemon) local btype = (ball and pokeballs[ball]) and ball or isShinyName(pokemon) and "shinypoke" or "poke" local happy = 250 id = 11829 if pokemon == "Shiny Ditto" then id = 11743 end local cap = getPlayerFreeCap(cid) if (getPlayerFreeCap(cid) <= 1 and not isInArray({ 5, 6 }, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then item = doCreateItemEx(id) else item = addItemInFreeBag(getPlayerSlotItem(cid, 3).uid, id, 1) end if not item then return false end doItemSetAttribute(item, "poke", pokemon) doItemSetAttribute(item, "hpToDraw", 0) doSetItemAttribute(item, "hands", 0) doItemSetAttribute(item, "ball", btype) doItemSetAttribute(item, "reverseIcon", btype) doSetAttributesBallsByPokeName(cid, item, pokemon) if boost and tonumber(boost) and tonumber(boost) > 0 and tonumber(boost) <= 50 then doItemSetAttribute(item, "boost", boost) end if unique then doItemSetAttribute(item, "unique", getCreatureName(cid)) end if (cap <= 1 and not isInArray({ 5, 6 }, getPlayerGroupId(cid))) or not hasSpaceInContainer(getPlayerSlotItem(cid, 3).uid) then if mega then doItemSetAttribute(item, "yHeldItem", mega .. "|MEGA") end doPlayerSendMailByName(getCreatureName(cid), item, 1) sendMsgToPlayer(cid, 27, "You are already holding six digimons, so your new digimon was sent to your data center.") end doTransformItem(item, id) if mega then doItemSetAttribute(item, "yHeldItem", mega .. "|MEGA") end sendAllPokemonsBarPoke(cid) return true end autoloot: function onUse(cid, item, frompos, item2, topos) if isWatchingTv(cid) then return true end if quemMatou then local player = getCreatureByName(quemMatou) if isPlayer(player) then local isInParyWithPlayer = false if isInParty(cid) and isInParty(player) then isInParyWithPlayer = isPartyEquals(player, cid) end if getCreatureName(cid) ~= getCreatureName(player) and not isInParyWithPlayer then doPlayerSendCancel(cid, "Voce nao pode abrir um loot que nao eh seu.") return true end end end local autoLootList = getAllItensInMyList(cid) local bag = getPlayerSlotItem(cid, 3).uid local itemsToRemove = {} if isCollectAll(cid) then for a = 0, getContainerSize(item.uid) do local it = getContainerItem(item.uid, a) if it.uid > 0 then if addItemInFreeBag(bag, it.itemid, it.type) ~= false then table.insert(itemsToRemove, it.uid) end end end end if #autoLootList > 0 and not isCollectAll(cid) then for a = 0, getContainerSize(item.uid) do local it = getContainerItem(item.uid, a) if it.uid > 0 then for i = 1, #autoLootList do if getItemInfo(it.itemid).name == autoLootList[i] then if addItemInFreeBag(bag, it.itemid, it.type) ~= false then table.insert(itemsToRemove, it.uid) end end end end end end if #itemsToRemove > 0 then for i = 1, #itemsToRemove do doChangeTypeItem(itemsToRemove[i], 0) end end end box: local a = { [11638] = {pokemons = {"Caterpie", "Weedle"}}, [11639] = {pokemons = {"Bulbasaur", "Charmander", "Squirtle"}}, --[11640] = {pokemons = {"Politoed", "Hitmontop"}}, --[11641] = {pokemons = {"Dragonite", "Shiny Horsea"}}, --[12581] = {pokemons = {"Aerodactyl"}}, --[12227] = {pokemons = {"Shiny Milotic", "Shiny Mr. Mime"}} } local happy = 1000 function onUse(cid, item, frompos, item2, topos) local b = a[item.itemid] if not b then return true end local pokemon = b.pokemons[math.random(#b.pokemons)] if not pokes[pokemon] then return true end doPlayerSendTextMessage(cid, 27, "You opened a Gift!") doPlayerSendTextMessage(cid, 27, "The prize Pokemon was a "..pokemon..", congratulations!") doSendMagicEffect(getThingPos(cid), 29) addPokeToPlayer(cid, pokemon, 0, nil, "poke") --alterado v1.9 doRemoveItem(item.uid, 1) return true end
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.