Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Criado por GabrielTxu
- -- Go/Back
- function onUse(cid, item, frompos, item2, topos)
- if #getCreatureSummons(cid) >= 1 and getPlayerStorageValue(getCreatureSummons(cid)[1], 33) >= 1 then
- 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 = 21
- end
- if item.itemid == usando then
- if getPlayerStorageValue(cid, 990) == 1 then
- doPlayerSendTextMessage(cid, 27, "You can't return your pokemon during gym battles.")
- return true
- end
- 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)
- doPlayerSendTextMessage(cid, 27, "This pokemon is fainted.")
- 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) then
- return true
- end
- doReturnPokemon(cid, z, item, effect)
- elseif item.itemid == pokeballs[btype].on then
- if item.uid ~= getPlayerSlotItem(cid, CONST_SLOT_FEET).uid then
- doPlayerSendTextMessage(cid, 27, "You must put your pokeball in the correct place!")
- 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)
- doPlayerSendTextMessage(cid, 27, "This pokemon is fainted.")
- return true
- end
- end
- local pokemon = getItemAttribute(item.uid, "poke")
- if not pokes[pokemon] then
- return true
- end
- doSummonMonster(cid, pokemon)
- local pk = getCreatureSummons(cid)[1]
- if not isCreature(pk) then return true end
- doTeleportThing(pk, getPosByDir(getThingPos(cid), math.random(0, 7)), false)
- doCreatureSetLookDir(pk, 2)
- adjustStatus(pk, item.uid, true, true, true)
- doAddPokemonInOwnList(cid, pokemon)
- doTransformItem(item.uid, item.itemid+1)
- local pokename = getPokeName(pk)
- -------------------------------------------------
- local mgo = gobackmsgs[math.random(1, #gobackmsgs)].go:gsub("doka", pokename)
- doCreatureSay(cid, mgo, TALKTYPE_SAY)
- doSendMagicEffect(getCreaturePosition(pk), effect)
- --------------------------------------------------
- if useOTClient then
- doPlayerSendCancel(cid, '12//,show') --alterado v1.7
- end
- --------------------------------------------------
- if useKpdoDlls then
- doUpdateMoves(cid)
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement