Postado Abril 11, 2023 2 anos salve salve galera do TK, gostaria de pedir uma ajuda sobre meu goback.lua queria um jeito de poder usar o pokemon mesmo fora do slot da pokebola , tipo na bag porem eu fiz uma gambiarra mas nao ficou legal pq o player podia usar o poke mesmo no chao , ai eu desfiz ,gostaria de saber se apenas com alteração na função do goback seria possivel fazer isso , desde ja obrigado pela atenção . Citar local EFFECTS = { --[OutfitID] = {Effect} ["Magmar"] = 35, ["Lava Magmar"] = 35, ["Shiny Magmar"] = 35, ["Jynx"] = 17, --alterado v1.5 ["Psy Jynx"] = 17, ["Shiny Jynx"] = 17, ["Elder Jynx"] = 17, ["Piloswine"] = 205, --alterado v1.8 ["Swinub"] = 205, } function onUse(cid, item, frompos, item2, topos) sendAllPokemonsBarPoke(cid) if exhaustion.get(cid, 6666) and exhaustion.get(cid, 6666) > 0 then return true end if getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 5700) >= 1 then --alterado v1.9 << return true end local ballName = getItemAttribute(item.uid, "poke") local btype = getPokeballType(item.itemid) local usando = pokeballs[btype].use local effect = pokeballs[btype].effect if not effect then effect = 0 end local towermew1 = {x = 277, y = 2133, z = 3} local towermew2 = {x = 297, y = 2146, z = 3} if isInRange(getCreaturePosition(cid), towermew1, towermew2) then doPlayerSendTextMessage(cid, 27, "Nao pode usar pokemon aqui!") return doSendMagicEffect(getCreaturePosition(cid), 2) end local trapdown = {x = 279, y = 2136, z = 1} local trapdown1 = {x = 294, y = 2144, z = 1} if isInRange(getCreaturePosition(cid), trapdown, trapdown1) then doPlayerSendTextMessage(cid, 27, "Nao pode usar pokemon aqui!") return doSendMagicEffect(getCreaturePosition(cid), 2) end if getPlayerStorageValue(cid, 3423) >= 1 then -- GYM doPlayerSendCancel(cid, "Voce nao pode usar pokemon enquanto pilota.") return true end unLock(item.uid) --alterado v1.8 if item.itemid == usando then if getPlayerStorageValue(cid, 990) == 2 then -- GYM doPlayerSendCancel(cid, "You can't return your pokemon during gym battles.") return true end if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v1.6 if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then BackTeam(cid) end end if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then doPlayerSendCancel(cid, "You can't do that while is controling a mind") return true --alterado v1.5 end if #getCreatureSummons(cid) <= 0 then if isInArray(pokeballs[btype].all, item.itemid) then doTransformItem(item.uid, pokeballs[btype].off) doItemSetAttribute(item.uid, "hp", 0) doPlayerSendCancel(cid, "Esse pokemon esta derrotado.") return true end end local cd = getCD(item.uid, "blink", 30) if cd > 0 then setCD(item.uid, "blink", 0) end local z = getCreatureSummons(cid)[1] if getCreatureCondition(z, CONDITION_INVISIBLE) and not isGhostPokemon(z) then return true end doReturnPokemon(cid, z, item, effect) elseif item.itemid == pokeballs[btype].on then if #getCreatureSummons(cid) >= 1 then doPlayerSendTextMessage(cid, 27, "Voce ja esta usando um pokemon chame-o de volta primeiro!") return true end if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then doPlayerSendCancel(cid, "Voce precisa colocar a sua pokebola no lugar correto!") return TRUE end local thishp = getItemAttribute(item.uid, "hp") if thishp <= 0 then if isInArray(pokeballs[btype].all, item.itemid) then doTransformItem(item.uid, pokeballs[btype].off) doItemSetAttribute(item.uid, "hp", 0) doPlayerSendCancel(cid, "Este pokemon esta derrotado.") return true end end local pokemon = getItemAttribute(item.uid, "poke") if not pokes[pokemon] then return true end if pokemon:find("Mega ") then local normalPoke = megaEvolutions[getItemAttribute(item.uid, "megaStone")][1] if normalPoke then doItemSetAttribute(item.uid, "poke", normalPoke) pokemon = normalPoke end end ----------------------- Sistema de nao poder carregar mais que 3 pokes lvl baixo e + q 1 poke de lvl medio/alto --------------------------------- if not isInArray({5, 6}, getPlayerGroupId(cid)) then local balls = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid) local low = {} local lowPokes = {"Rattata", "Caterpie", "Weedle", "Oddish", "Pidgey", "Paras", "Poliwag", "Bellsprout", "Magikarp", "Hoppip", "Sunkern"} if #balls >= 1 then for _, uid in ipairs(balls) do local nome = getItemAttribute(uid, "poke") if not isInArray(lowPokes, pokemon) and nome == pokemon then return doPlayerSendTextMessage(cid, 27, "Desculpa, voce nao pode carregar um pokemon igual!") else if nome == pokemon then table.insert(low, nome) end end end end if #low >= 3 then return doPlayerSendTextMessage(cid, 27, "Sorry, but you can't carry more than three pokemons equals of low level!") end end --------------------------------------------------------------------------------------------------------------------------------------------------- local x = pokes[pokemon] local boost = getItemAttribute(item.uid, "boost") or 0 if getPlayerLevel(cid) < (x.level+boost) then doPlayerSendCancel(cid, "Voce Precisa de level "..(x.level+boost).." para usar esse pokemon.") return true end ---------------------------- Sistema pokes de clan -------------------------------------- local shinysClan = { ["Shiny Fearow"] = {4, "Wingeon"}, ["Shiny Flygon"] = {4, "Wingeon"}, ["Shiny Flareon"] = {1, "Volcanic"}, ["Shiny Infernape"] = {1, "Volcanic"}, ["Shiny Vaporeon"] = {2, "Seavel"}, ["Shiny Piloswine"] = {2, "Seavel"}, ["Shiny Jolteon"] = {9, "Raibolt"}, ["Shiny Luxray"] = {9, "Raibolt"}, ["Shiny Hypno"] = {7, "Psycraft"}, ["Shiny Girafarig"] = {7, "Psycraft"}, ["Shiny Golem"] = {3, "Orebound"}, ["Shiny Gliscor"] = {3, "Orebound"}, ["Shiny Vileplume"] = {8, "Naturia"}, ["Shiny Scizor"] = {8, "Naturia"}, ["Shiny Nidoking"] = {5, "Malefic"}, ["Shiny Houndoom"] = {5, "Malefic"}, ["Shiny Hitmontop"] = {6, "Gardestrike"}, --alterado v1.4 ["Shiny Gallade"] = {6, "Gardestrike"}, --alterado v1.4 } if shinysClan[pokemon] and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then --alterado v1.9 \/ if getPlayerClanNum(cid) ~= shinysClan[pokemon][1] then doPlayerSendCancel(cid, "Voce precisa ser membro do clan "..shinysClan[pokemon][2].." para usar esse pokemon!") return true elseif getPlayerClanRank(cid) ~= 5 then doPlayerSendCancel(cid, "Voce precisa ser rank5 para usar esse pokemon!") return true end end --- box 5 --- local exclusive = { ["Rotom"] = {9, "Raibolt"}, ["Aloha Raichu"] = {9, "Raibolt"}, ["Alohaf Raichu"] = {9, "Raibolt"}, ["Air Rotom"] = {9, "Raibolt"}, ["Nature Rotom"] = {9, "Raibolt"}, ["Heat Rotom"] = {9, "Raibolt"}, ["Fresh Rotom"] = {9, "Raibolt"}, ["Snow Rotom"] = {9, "Raibolt"}, ["Castform"] = {1, "Volcanic"}, ["Heat Castform"] = {1, "Volcanic"}, ["Fresh Castform"] = {1, "Volcanic"}, ["Snow Castform"] = {1, "Volcanic"}, } if exclusive[pokemon] and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then --alterado v1.9 \/ if getPlayerClanNum(cid) ~= exclusive[pokemon][1] then doPlayerSendCancel(cid, "Voce precisa ser membro do clan "..exclusive[pokemon][2].." para usar esse pokemon!") return true end end local bosses = { ["Darkrei"] = {5, "Malefic"}, ["Wailord"] = {2, "Seavel"}, ["Conkeldur"] = {6, "Gardestrike"}, ["Heatran"] = {1, "Volcanic"}, ["Mamoswine"] = {3, "Orebound"}, ["Yanmega"] = {8, "Naturia"}, ["Thundurus"] = {9, "Raibolt"}, ["Druddigon"] = {4, "Wingeon"}, ["Cresselia"] = {7, "Psycraft"}, } if bosses[pokemon] and (getPlayerGroupId(cid) < 4 or getPlayerGroupId(cid) > 6) then --alterado v1.9 \/ if getPlayerClanNum(cid) ~= bosses[pokemon][1] then doPlayerSendCancel(cid, "Voce precisa ser membro do clan "..bosses[pokemon][2].." para usar esse pokemon!") return true end end -------------------------------------------------------------------------------------- doSummonMonster(cid, pokemon) local pk = getCreatureSummons(cid)[1] if not isCreature(pk) then return true end local pk = getCreatureSummons(cid)[1] if not isCreature(pk) then return true end local slot = getPlayerSlotItem(cid, CONST_SLOT_FEET) local addon = getItemAttribute(slot.uid, "pokeaddon") addonTransformOutfit(cid, addon, pokemon) ------------------------passiva hitmonchan------------------------------ if isSummon(pk) then --alterado v1.8 \/ if pokemon == "Shiny Hitmonchan" or pokemon == "Hitmonchan" or pokemon == "Gardestrike Shiny Hitmonchan" then if not getItemAttribute(item.uid, "hands") then doSetItemAttribute(item.uid, "hands", 0) end local hands = getItemAttribute(item.uid, "hands") doSetCreatureOutfit(pk, {lookType = hitmonchans[pokemon][hands].out}, -1) end end ------------------------------------------------------------------------- ---------movement magmar, jynx------------- if EFFECTS[getCreatureName(pk)] then markPosEff(pk, getThingPos(pk)) sendMovementEffect(pk, EFFECTS[getCreatureName(pk)], getThingPos(pk)) end -------------------------------------------------------------------------- if isGhostPokemon(pk) then doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false) end doCreatureSetLookDir(pk, 2) adjustStatus(pk, item.uid, true, true, true) if getItemAttribute(item.uid, "ehditto") then doCreatureSetNick(pk, "Ditto") end if getItemAttribute(item.uid, "ehshinyditto") then doCreatureSetNick(pk, "Ditto") end doRegenerateWithY(getCreatureMaster(pk), pk) doCureWithY(getCreatureMaster(pk), pk) doAddPokemonInOwnList(cid, pokemon) doTransformItem(item.uid, item.itemid+1) local pokename = getPokeName(pk) --alterado v1.7 local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename) doCreatureSay(cid, mgo, TALKTYPE_ORANGE_1) doSendMagicEffect(getCreaturePosition(pk), effect) if useOTClient then doPlayerSendCancel(cid, '12//,show') --alterado v1.7 end else doPlayerSendCancel(cid, "Esse pokemon esta derrotado.") end if useKpdoDlls then doUpdateMoves(cid) end if useOTClient then onPokeHealthChange(cid) end return true end
Postado Abril 12, 2023 2 anos Para fazer com que o item possa ser usado somente se estiver no inventário do player, você deve adicionar a condição isInArray(item2, getPlayerAllItems(cid)) logo abaixo da condição if item.itemid == usando then e acima do primeiro if getPlayerStorageValue(cid, 990) == 2 then
Postado Abril 24, 2023 2 anos Autor deu erro mano , deve ser pq nao tenho essa função ai nao né ? [Error - Action Interface] data/actions/scripts/goback.lua:onUse Description: data/actions/scripts/goback.lua:106: attempt to call global 'getPlayerAllItems' (a nil value) stack traceback: data/actions/scripts/goback.lua:106: in function <data/actions/scripts/goback.lua:1
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.