Fala galera linda do meu coração tudo certo?
Então estou com um seguinte problema é um modulo de inventario voltado a poketibia, consegui adaptar parte dele ao meu servidor porem a barra de life do pokémon estou tendo alguns problemas e não consigo fazer ela funcionar:
function onUse(cid, item, frompos, item2, topos)if#getPlayerPokeballs(cid) > 6 then
doPlayerSendCancel(cid,"You are carrying more than 6 pokémons in your team.")returntrueendif getPlayerSlotItem(cid, CONST_SLOT_FEET).uid ~= item.uid then
doSendMagicEffect(getCreaturePosition(cid),2)
doPlayerSendCancel(cid,"Place this pokéball in the right slot.")returntrueendlocal pokeballInfo = getPokeballInfo(item.uid)local backmessages ={"Good job, ","Well done, ","Back, ","Enough, ","Great, "}local gomessages ={"Time to battle, ","Go, ","Do your job, ","Prepare, ","It's your time, "}local backmsg = backmessages[math.random(#backmessages)]local gomsg = gomessages[math.random(#gomessages)]if isPokeballOut(item.itemid)thenlocal pokemon = getPlayerPokemon(cid)if pokemon ~=falsethenif pokeballInfo.name == getCreatureName(pokemon)thenif getCreatureCondition(pokemon, CONDITION_PACIFIED)or getCreatureCondition(pokemon, CONDITION_DRUNK)then
doPlayerSendCancel(cid,"Your pokémon doesn't want to return to its pokeball!")returntrueendlocal controled = getPokemonControled(cid)if controled ~=falsethen
doUnconvinceCreature(controled)
doSetMonsterControled(controled,false)end
doTransformItem(item.uid, getPokeballIn(item.itemid))
doCreatureSay(cid, backmsg..""..(pokeballInfo.nick ~=niland pokeballInfo.nick or pokeballInfo.name).."!", TALKTYPE_ORANGE_1)
setPokeballDescription(item.uid, pokeballInfo.name, pokeballInfo.nick, getCreatureHealth(pokemon), getCreatureMaxHealth(pokemon))
setPokeballConditions(item.uid, pokemon)
setPlayerStorageValue(cid, STORAGE_POKEMON_GOBACK,0)
setPlayerStorageValue(cid, STORAGE_POKEMON_OUTLIVE,0)
showPokeballEffect(getCreaturePosition(pokemon), item.itemid)
doRemoveCreature(pokemon)returntrueend
elseif not isSurfing(cid)andnot isRiding(cid)andnot isFlying(cid)thenif pokeballInfo.name thenlocal monster = getMonsterInfo(pokeballInfo.name)if monster then
doTransformItem(item.uid, getPokeballIn(item.itemid))
setPokeballDescription(item.uid, pokeballInfo.name, pokeballInfo.nick,0, monster.healthMax)endendend
elseif isPokeballIn(item.itemid)thenif isSurfing(cid)then
doPlayerSendCancel(cid,"You can't use pokeball while surfing.")returntrueendif isFlying(cid)then
doPlayerSendCancel(cid,"You can't use pokeball while flying.")returntrueendif isRiding(cid)then
doPlayerSendCancel(cid,"You can't use pokeball while riding.")returntrueendif pokeballInfo.health <=0thenreturn doPlayerSendTextMessage(cid,27,"This pokémon is defeated.")endif getPlayerPokemon(cid)~=falsethen
doPlayerSendCancel(cid,"You already called a pokemon.")returntrueendif getPlayerLevel(cid)< getMonsterMinimumLevel(pokeballInfo.name)then
doPlayerSendCancel(cid,"You must be level "..getMonsterMinimumLevel(pokeballInfo.name).." or higher for this pokemon obbey you.")returntrueendlocal pk = doCreateMonster(pokeballInfo.name, getThingPosition(cid),false)ifnot isCreature(pk)then
pk = doCreateMonster(pokeballInfo.name, getThingPosition(cid),false,true)ifnot isCreature(pk)then
doSendMagicEffect(getCreaturePosition(cid),2)
doPlayerSendCancel(cid,"You can't call your pokemon here.")returntrueendendif pokeballInfo.nick ~=nilthen
doCreatureSetNick(pk, pokeballInfo.nick)
doCreatureUpdate(pk)endif pokeballInfo.sex ~=nilthen
doSetMonsterSex(pk, pokeballInfo.sex)elselocal newSex = getMonsterSex(pk)
doItemSetAttribute(item.uid,"pokemon_sex", newSex)end
doConvinceCreature(cid, pk)
setCreatureMaxHealth(pk, pokeballInfo.healthmax)
doCreatureAddHealth(pk, pokeballInfo.healthmax)
doCreatureAddHealth(pk, pokeballInfo.health-pokeballInfo.healthmax)
doTransformItem(item.uid, getPokeballOut(item.itemid))
doCreatureSay(cid, gomsg..""..(pokeballInfo.nick ~=niland pokeballInfo.nick or pokeballInfo.name).."!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getCreaturePosition(cid),177)
setPokeballDescription(item.uid, pokeballInfo.name, pokeballInfo.nick)
showPokeballEffect(getCreaturePosition(pk), item.itemid)
setPlayerStorageValue(cid, STORAGE_POKEMON_GOBACK,1)
setPlayerStorageValue(cid, STORAGE_POKEMON_OUTLIVE,1)
doPlayerStoreSummonHealth(cid, pokeballInfo.health, pokeballInfo.healthmax)
registerCreatureEvent(pk,"DiePoke")local conditions = getPokeballConditions(item.uid)
doAddPokemonConditions(pk, conditions)endreturntrueend
Eu sei que preciso utilizar o doPlayerSendCancel porem não consigo pegar o hp do pokémon para isso, se alguma alma bondosa conseguir me ajudar, ficarei muito agradecido.
Fala galera linda do meu coração tudo certo?
Então estou com um seguinte problema é um modulo de inventario voltado a poketibia, consegui adaptar parte dele ao meu servidor porem a barra de life do pokémon estou tendo alguns problemas e não consigo fazer ela funcionar:
O código do inventario:
O código do goback caso precise, não sei:
Eu sei que preciso utilizar o doPlayerSendCancel porem não consigo pegar o hp do pokémon para isso, se alguma alma bondosa conseguir me ajudar, ficarei muito agradecido.
Share this post
Link to post