Ir para conteúdo

[Encerrado] [AJUDA] Arrumar script do Go/back pra desloga e Heal da nurce


AwakeGamer

Posts Recomendados

Tipo eu quero que so possa desloga com todos pode na ball tem como arruma pra mim a script abaixo .

 

 

function onLogout(cid)

if #getCreatureSummons(cid) >= 1 then

return doPlayerSendCancel(cid, "Voce precisa recolher seu pokemon") and false

end

 

if not isCreature(cid) then return true end

local thisitem = getPlayerSlotItem(cid, 8)

 

if thisitem.uid <= 0 then return true end

if getPlayerStorageValue(cid, 17000) >= 1 then

return doPlayerSendTextMessage(cid, 27, "Para deslogar saia do fly!") and false

end

 

local ballName = getItemAttribute(thisitem.uid, "poke")

 

--------------------------------------------------------

btype = getPokeballType(thisitem.itemid)

---------------------------------------------------------------

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 not isCreature(cid) then return true end

if getPlayerStorageValue(cid, 52480) >= 1 or getPlayerStorageValue(cid, 52481) >= 0 then

local sid = getPlayerByName(getPlayerStorageValue(cid, 52482))

local sendLose = true

if isCreature(sid) then

if getPlayerStorageValue(sid, 52482) == getCreatureName(cid) then

addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(sid), "WIN", COLOR_ELECTRIC)

setPlayerStorageValue(sid, 52480, -1)

setPlayerStorageValue(sid, 52481, -1)

setPlayerStorageValue(sid, 52482, -1)

setPlayerStorageValue(sid, 52483, -1) --alterado v1.6.1

setPlayerStorageValue(sid, 6598754, -1)

doCreatureSetSkullType(sid, 0)

else

sendLose = false

end

end

if sendLose then

addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)

end

setPlayerStorageValue(cid, 52480, -1)

setPlayerStorageValue(cid, 52481, -1)

setPlayerStorageValue(cid, 52482, -1)

setPlayerStorageValue(cid, 52483, -1)

setPlayerStorageValue(cid, 6598754, -1)

doCreatureSetSkullType(cid, 0)

end

--////////////////////////////////////////////////////////////////////////////////////////--

if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then

local cmed2 = getCreatureSummons(cid)[1]

local poscmed = getThingPos(cmed2)

local cmeddir = getCreatureLookDir(cmed2)

local namecmed = getCreatureName(cmed2)

local hp, maxHp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1])

local gender = getPokemonGender(cmed2)

doRemoveCreature(getCreatureSummons(cid)[1])

local back = doCreateMonster(namecmed, poscmed)

addEvent(doCreatureSetSkullType, 150, back, gender)

doCreatureSetLookDir(back, cmeddir)

addEvent(doCreatureAddHealth, 100, back, hp-maxHp)

--alterado v1.5

-- pokemon controlador

local ball2 = getPlayerSlotItem(cid, 8)

local mynewpos = getThingPos(getCreatureSummons(cid)[1])

doRemoveCreature(getCreatureSummons(cid)[1])

local pk2 = doSummonCreature(getItemAttribute(ball2.uid, "poke"), mynewpos)

doConvinceCreature(cid, pk2)

addEvent(doAdjustWithDelay, 100, cid, pk2, true, true, false)

setPlayerStorageValue(cid, 888, -1) --alterado v1.7

cleanCMcds(ball2.uid)

doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)

registerCreatureEvent(pk2, "SummonDeath") --alterado v1.6

end

 

----------------------------------------------------------------------

local summon = getCreatureSummons(cid)[1]

 

if #getCreatureSummons(cid) >= 1 and thisitem.uid > 1 then

if getPlayerStorageValue(cid, 212124) <= 0 then

doItemSetAttribute(thisitem.uid, "hp", (getCreatureHealth(summon) / getCreatureMaxHealth(summon)))

end --alterado v1.5

setPlayerStorageValue(cid, 212124, 0)

doTransformItem(thisitem.uid, pokeballs[btype].on)

doSendMagicEffect(getThingPos(summon), pokeballs[btype].effect)

doRemoveCreature(summon)

end

 

if getCreatureOutfit(cid).lookType == 814 then

doPlayerStopWatching(cid)

end

 

if tonumber(getPlayerStorageValue(cid, 17000)) and getPlayerStorageValue(cid, 17000) >= 1 then --alterado v1.6

markFlyingPos(cid, getThingPos(cid))

end

 

if getPlayerStorageValue(cid, 22545) == 1 then --alterado v1.4

setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)

if getGlobalStorageValue(22550) <= 0 then

endGoldenArena() --alterado v1.7

end

end

 

return TRUE

end

 

local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!",

"You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"}

 

function onDeath(cid, deathList)

 

local owner = getCreatureMaster(cid)

 

if getPlayerStorageValue(cid, 637500) >= 1 then

doSendMagicEffect(getThingPos(cid), 211)

doRemoveCreature(cid)

return true

end

 

if getPlayerStorageValue(cid, 212123) >= 1 then

return true

end

 

--////////////////////////////////////////////////////////////////////////////////////////--

checkDuel(owner) --alterado v1.6 duel system

--////////////////////////////////////////////////////////////////////////////////////////--

 

local thisball = getPlayerSlotItem(owner, 8)

local ballName = getItemAttribute(thisball.uid, "poke")

 

btype = getPokeballType(thisball.itemid)

 

if #getCreatureSummons(owner) > 1 then

BackTeam(owner, getCreatureSummons(owner))

end

 

doSendMagicEffect(getThingPos(cid), pokeballs[btype].effect)

doTransformItem(thisball.uid, pokeballs[btype].off)

 

doPlayerSendTextMessage(owner, 22, "Your pokemon fainted.")

 

local say = deathtexts[math.random(#deathtexts)]

say = string.gsub(say, "POKENAME", getCreatureName(cid))

 

if getPlayerStorageValue(cid, 33) <= 0 then

doCreatureSay(owner, say, TALKTYPE_SAY)

end

 

doItemSetAttribute(thisball.uid, "hp", 0)

if ehMonstro(deathList[1]) then

doItemSetAttribute(thisball.uid, "happy", getPlayerStorageValue(cid, 1008) - happyLostOnDeath)

end

doItemSetAttribute(thisball.uid, "hunger", getPlayerStorageValue(cid, 1009))

 

if useOTClient then

doPlayerSendCancel(owner, '12//,hide') --alterado v1.7

end

 

doRemoveCreature(cid)

 

return false

end

 

 

 

 

 

 

 

E tambem queria que a nurce so reala =se se todos pokemons stiver dentro da bal abaixo a minha script

 

 

local pokeballs = {

[1] = {effect = 188, on = 11826, use = 11827, off = 11828, all = {11826, 11827, 11828}},

[2] = {effect = 191, on = 11829, use = 11830, off = 11831, all = {11829, 11830, 11831}},

[3] = {effect = 190, on = 11835, use = 11836, off = 11837, all = {11835, 11836, 11837}},

[4] = {effect = 189, on = 11832, use = 11833, off = 11834, all = {11832, 11833, 11834}},

[5] = {effect = 188, on = 11737, use = 11738, off = 11739, all = {11737, 11738, 11739}},

[6] = {effect = 189, on = 11740, use = 11741, off = 11742, all = {11740, 11741, 11742}},

[7] = {effect = 190, on = 11743, use = 11744, off = 11745, all = {11743, 11744, 11745}},

[8] = {effect = 191, on = 11746, use = 11747, off = 11748, all = {11746, 11747, 11748}},

}

 

--alterado v1.7 \/\/

local posis = { --[storage da city] = {pos da nurse na city},

[897530] = {x = 1053, y = 1046, z = 7}, --saffron

[897531] = {x = 1060, y = 900, z = 7}, --cerulean

[897532] = {x = 1204, y = 1042, z = 7}, --lavender

[897533] = {x = 1213, y = 1321, z = 7}, --fuchsia

[897534] = {x = 862, y = 1094, z = 6}, --celadon

[897535] = {x = 705, y = 1086, z = 7}, --viridian

[897536] = {x = 1075, y = 1233, z = 7}, --vermilion

[897537] = {x = 723, y = 847, z = 7}, --pewter

[897538] = {x = 850, y = 1396, z = 7}, --cinnabar

[897539] = {x = 1429, y = 1597, z = 6}, --snow

[897540] = {x = 542, y = 675, z = 7}, --golden

}

 

function onThingMove(creature, thing, oldpos, oldstackpos)

end

 

function onCreatureAppear(creature)

end

 

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye sir!')

focus = 0

talk_start = 0

end

end

 

function onCreatureTurn(creature)

end

 

function msgcontains(txt, str)

return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))

end

 

function onCreatureSay(cid, type, msg)

local msg = string.lower(msg)

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

 

for a, b in pairs(gobackmsgs) do

local gm = string.gsub(b.go, "doka!", "")

local bm = string.gsub(b.back, "doka!", "")

if string.find(string.lower(msg), string.lower(gm)) or string.find(string.lower(msg), string.lower(bm)) then

return true

end

end

 

if((msgcontains(msg, 'hi') or msgcontains(msg, 'heal') or msgcontains(msg, 'help')) and (getDistanceToCreature(cid) <= 3)) then

 

if exhaustion.get(cid, 9211) then

selfSay('Please wait a few moment before asking me to heal your pokemons again!')

return true

end

 

if not getTileInfo(getThingPos(cid)).protection and nurseHealsOnlyInPZ then

selfSay("Please, get inside the pokémon center to heal your pokemons!")

return true

end

 

if getPlayerStorageValue(cid, 52480) >= 1 then

selfSay("You can't do that while in a Duel!") --alterado v1.6.1

return true

end

 

for e, f in pairs(posis) do

local pos = getThingPos(getNpcCid())

if pos.x == f.x and pos.y == f.y and pos.z == f.z then

if getPlayerStorageValue(cid, e) <= -1 then --alterado v1.7

setPlayerStorageValue(cid, e, 1)

end

end

end

 

exhaustion.set(cid, 9211, 5)

 

doCreatureAddHealth(cid, getCreatureMaxHealth(cid)-getCreatureHealth(cid))

doCureStatus(cid, "all", true)

doSendMagicEffect(getThingPos(cid), 132)

 

local mypb = getPlayerSlotItem(cid, 8)

 

if #getCreatureSummons(cid) >= 1 then

 

if not nurseHealsPokemonOut then

selfSay("Please, return your pokemon to his ball!")

return true

end

 

local s = getCreatureSummons(cid)[1]

doCreatureAddHealth(s, getCreatureMaxHealth(s))

doSendMagicEffect(getThingPos(s), 13)

doCureStatus(s, "all", false)

if getPlayerStorageValue(s, 1008) < baseNurseryHappiness then

setPlayerStorageValue(s, 1008, baseNurseryHappiness)

end

if getPlayerStorageValue(s, 1009) > baseNurseryHunger then

setPlayerStorageValue(s, 1009, baseNurseryHunger)

end

else

if mypb.itemid ~= 0 and isPokeball(mypb.itemid) then --alterado v1.3

doItemSetAttribute(mypb.uid, "hp", 1)

if getItemAttribute(mypb.uid, "hunger") and getItemAttribute(mypb.uid, "hunger") > baseNurseryHunger then

doItemSetAttribute(mypb.uid, "hunger", baseNurseryHunger)

end

for c = 1, 15 do

local str = "move"..c

setCD(mypb.uid, str, 0)

end

if getItemAttribute(mypb.uid, "happy") and getItemAttribute(mypb.uid, "happy") < baseNurseryHappiness then

doItemSetAttribute(mypb.uid, "happy", baseNurseryHappiness)

end

if getPlayerStorageValue(cid, 17000) <= 0 and getPlayerStorageValue(cid, 17001) <= 0 and getPlayerStorageValue(cid, 63215) <= 0 then

for a, b in pairs (pokeballs) do

if isInArray(b.all, mypb.itemid) then

doTransformItem(mypb.uid, b.on)

end

end

end

end

end

 

local bp = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK)

 

for balls = 1, 8 do --editar a qntdade de balls da tabela ali decima...

for times = 1, 3 do

local items = getItemsInContainerById(bp.uid, pokeballs[balls].all[times])

if #items >= 1 then

for _, uid in pairs(items) do

doItemSetAttribute(uid, "hp", 1)

doTransformItem(uid, pokeballs[balls].on)

for c = 1, 15 do

local str = "move"..c

setCD(uid, str, 0) --alterado v1.3

end

if getItemAttribute(uid, "hunger") and getItemAttribute(uid, "hunger") > baseNurseryHunger then

doItemSetAttribute(uid, "hunger", baseNurseryHunger)

end

if getItemAttribute(uid, "happy") and getItemAttribute(uid, "happy") < baseNurseryHappiness then

doItemSetAttribute(uid, "happy", baseNurseryHappiness)

end

end

end

end

end

 

doPlayerSendTextMessage(cid, 26, "sounds/chansey.wav")

selfSay('There you go! You and your pokemons are healthy again.')

 

 

if useKpdoDlls then --alterado v1.7

doUpdateMoves(cid)

end

 

end

end

 

 

 

PORFAVRO ARRUME E ME MANDA PRECISO MUITO

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...