Guest User

Goback.lua

a guest
Apr 10th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. function onLogout(cid)
  2.  
  3.     if getPlayerStorageValue(cid, 888) >= 1 then
  4.         doPlayerSendCancel(cid, "You cant logout during control mind.")
  5.     return false
  6.     end
  7.  
  8.     local summon = getCreatureSummons(cid)[1]
  9.     local thisitem = getPlayerSlotItem(cid, 8)
  10.     local btype = getPokeballType(thisitem.itemid)
  11.  
  12.     if #getCreatureSummons(cid) == 1 and thisitem.uid > 1 then
  13.         doItemSetAttribute(thisitem.uid, "hp", getCreatureHealth(summon) / getCreatureMaxHealth(summon))
  14.         doTransformItem(thisitem.uid, pokeballs[btype].on)
  15.  
  16.         doSendMagicEffect(getThingPos(summon), pokeballs[btype].effect)
  17.         doRemoveCreature(summon)
  18.     end
  19.  
  20.     if getCreatureOutfit(cid).lookType == 814 then
  21.         doPlayerStopWatching(cid)
  22.     end
  23.  
  24.     if getPlayerStorageValue(cid, 17000) >= 1 then
  25.         markFlyingPos(cid, getThingPos(cid))
  26.     end
  27.  
  28. return TRUE
  29. end
  30.  
  31. local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!",
  32.             "You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"}
  33.  
  34. function onDeath(cid, deathList)
  35.  
  36.     local owner = getCreatureMaster(cid)
  37.  
  38.     local thisball = getPlayerSlotItem(owner, 8)
  39.     local btype = getPokeballType(thisball.itemid)
  40.  
  41.         doSendMagicEffect(getThingPos(cid), pokeballs[btype].effect)
  42.         doTransformItem(thisball.uid, pokeballs[btype].off)
  43.  
  44.         doPlayerSendTextMessage(owner, 22, "Your pokemon fainted.")
  45.  
  46.     local say = deathtexts[math.random(#deathtexts)]
  47.         say = string.gsub(say, "POKENAME", getCreatureName(cid))
  48.  
  49.     if getPlayerStorageValue(cid, 33) <= 0 then
  50.         doCreatureSay(owner, say, TALKTYPE_SAY)
  51.     end
  52.  
  53.     doItemSetAttribute(thisball.uid, "hp", 0)
  54.     doItemSetAttribute(thisball.uid, "happy", getPlayerStorageValue(cid, 1008) - happyLostOnDeath)
  55.     doItemSetAttribute(thisball.uid, "hunger", getPlayerStorageValue(cid, 1009))
  56.  
  57.     doRemoveCreature(cid)
  58.  
  59. return false
  60. end
Advertisement
Add Comment
Please, Sign In to add comment