Advertisement
Kevick

Goback.lua

Apr 27th, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.65 KB | None | 0 0
  1. function onLogout(cid)
  2.  
  3. local thisitem = getPlayerSlotItem(cid, 8)
  4.  
  5. if thisitem.uid <= 0 then return true end
  6.  
  7. local ballName = getItemAttribute(thisitem.uid, "poke")
  8.  
  9. --------------------------------------------------------
  10. btype = getPokeballType(thisitem.itemid)
  11. ---------------------------------------------------------------
  12. if #getCreatureSummons(cid) > 1 and getPlayerStorageValue(cid, 212124) <= 0 then --alterado v2.6
  13. if getPlayerStorageValue(cid, 637501) == -2 or getPlayerStorageValue(cid, 637501) >= 1 then
  14. BackTeam(cid)
  15. end
  16. end
  17. --////////////////////////////////////////////////////////////////////////////////////////--
  18. if not isCreature(cid) then return true end
  19. if getPlayerStorageValue(cid, 52480) >= 1 or getPlayerStorageValue(cid, 52481) >= 0 then
  20. local sid = getPlayerByName(getPlayerStorageValue(cid, 52482))
  21. local sendLose = true
  22. if isCreature(sid) then
  23. if getPlayerStorageValue(sid, 52482) == getCreatureName(cid) then
  24. addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(sid), "WIN", COLOR_ELECTRIC)
  25. setPlayerStorageValue(sid, 52480, -1)
  26. setPlayerStorageValue(sid, 52481, -1)
  27. setPlayerStorageValue(sid, 52482, -1)
  28. setPlayerStorageValue(sid, 52483, -1) --alterado v2.6.1
  29. setPlayerStorageValue(sid, 6598754, -1)
  30. doCreatureSetSkullType(sid, 0)
  31. else
  32. sendLose = false
  33. end
  34. end
  35. if sendLose then
  36. addEvent(doSendAnimatedText, 1000, getThingPosWithDebug(cid), "LOSE", COLOR_BURN)
  37. end
  38. setPlayerStorageValue(cid, 52480, -1)
  39. setPlayerStorageValue(cid, 52481, -1)
  40. setPlayerStorageValue(cid, 52482, -1)
  41. setPlayerStorageValue(cid, 52483, -1)
  42. setPlayerStorageValue(cid, 6598754, -1)
  43. doCreatureSetSkullType(cid, 0)
  44. end
  45. --////////////////////////////////////////////////////////////////////////////////////////--
  46. if #getCreatureSummons(cid) == 2 and getPlayerStorageValue(cid, 212124) >= 1 then
  47. local cmed2 = getCreatureSummons(cid)[1]
  48. local poscmed = getThingPos(cmed2)
  49. local cmeddir = getCreatureLookDir(cmed2)
  50. local namecmed = getCreatureName(cmed2)
  51. local hp, maxHp = getCreatureHealth(getCreatureSummons(cid)[1]), getCreatureMaxHealth(getCreatureSummons(cid)[1])
  52. local gender = getPokemonGender(cmed2)
  53. local level = getWildPokemonLevel(cmed2)
  54. doRemoveCreature(getCreatureSummons(cid)[1])
  55. local back = doCreateMonster(namecmed, poscmed)
  56. addEvent(doCreatureSetSkullType, 150, back, gender)
  57. addEvent(setWildPokemonLevel, 150, back, level)
  58. doCreatureSetLookDir(back, cmeddir)
  59. addEvent(doCreatureAddHealth, 100, back, hp-maxHp)
  60. --alterado v2.5 control mind
  61. -- pokemon controlador
  62. local ball2 = getPlayerSlotItem(cid, 8)
  63. local mynewpos = getThingPos(getCreatureSummons(cid)[1])
  64. doRemoveCreature(getCreatureSummons(cid)[1])
  65. local pk2 = doSummonCreature(getItemAttribute(ball2.uid, "poke"), mynewpos)
  66. doConvinceCreature(cid, pk2)
  67. addEvent(doAdjustWithDelay, 100, cid, pk2, true, true, false)
  68. setPlayerStorageValue(cid, 888, -1) --alterado v2.7
  69. cleanCMcds(ball2.uid)
  70. doCreatureSetLookDir(getCreatureSummons(cid)[1], 2)
  71. registerCreatureEvent(pk2, "SummonDeath") --alterado v2.6
  72. end
  73.  
  74. -------------------------------------------------------------------------------------
  75. local summon = getCreatureSummons(cid)[1]
  76.  
  77. if #getCreatureSummons(cid) >= 1 and thisitem.uid > 1 then
  78. if getPlayerStorageValue(cid, 212124) <= 0 then
  79. doItemSetAttribute(thisitem.uid, "hp", (getCreatureHealth(summon) / getCreatureMaxHealth(summon)))
  80. end --alterado v2.5
  81. setPlayerStorageValue(cid, 212124, 0)
  82. doTransformItem(thisitem.uid, pokeballs[btype].on)
  83. doSendMagicEffect(getThingPos(summon), pokeballs[btype].effect)
  84. doRemoveCreature(summon)
  85. end
  86.  
  87. if getCreatureOutfit(cid).lookType == 814 then
  88. doPlayerStopWatching(cid)
  89. end
  90.  
  91. if tonumber(getPlayerStorageValue(cid, 17000)) and getPlayerStorageValue(cid, 17000) >= 1 then --alterado v2.6
  92. markFlyingPos(cid, getThingPos(cid))
  93. end
  94.  
  95. if getPlayerStorageValue(cid, 22545) == 1 then --alterado v2.4
  96. setGlobalStorageValue(22550, getGlobalStorageValue(22550)-1)
  97. if getGlobalStorageValue(22550) <= 0 then
  98. endGoldenArena() --alterado v2.7
  99. end
  100. end
  101.  
  102. return TRUE
  103. end
  104.  
  105. local deathtexts = {"Oh no! POKENAME, come back!", "Come back, POKENAME!", "That's enough, POKENAME!", "You did well, POKENAME!",
  106. "You need to rest, POKENAME!", "Nice job, POKENAME!", "POKENAME, you are too hurt!"}
  107.  
  108. function onDeath(cid, deathList)
  109.  
  110. local owner = getCreatureMaster(cid)
  111.  
  112. if getPlayerStorageValue(cid, 637500) >= 1 then
  113. doSendMagicEffect(getThingPos(cid), 211)
  114. doRemoveCreature(cid)
  115. return true
  116. end
  117.  
  118. if getPlayerStorageValue(cid, 212123) >= 1 then --alterado v2.5
  119. return true
  120. end
  121.  
  122. --////////////////////////////////////////////////////////////////////////////////////////--
  123. checkDuel(owner) --alterado v2.6 duel system
  124. --////////////////////////////////////////////////////////////////////////////////////////--
  125.  
  126. local thisball = getPlayerSlotItem(owner, 8)
  127. local ballName = getItemAttribute(thisball.uid, "poke")
  128.  
  129. btype = getPokeballType(thisball.itemid)
  130.  
  131. if #getCreatureSummons(owner) > 1 then
  132. BackTeam(owner, getCreatureSummons(owner))
  133. end
  134.  
  135. doSendMagicEffect(getThingPos(cid), pokeballs[btype].effect)
  136. doTransformItem(thisball.uid, pokeballs[btype].off)
  137.  
  138. doPlayerSendTextMessage(owner, 22, "Your pokemon fainted.")
  139.  
  140. local say = deathtexts[math.random(#deathtexts)]
  141. say = string.gsub(say, "POKENAME", getCreatureName(cid))
  142.  
  143. if getPlayerStorageValue(cid, 33) <= 0 then
  144. doCreatureSay(owner, say, TALKTYPE_SAY)
  145. end
  146.  
  147. doItemSetAttribute(thisball.uid, "hp", 0)
  148. doItemSetAttribute(thisball.uid, "happy", getPlayerStorageValue(cid, 1008) - happyLostOnDeath)
  149. doItemSetAttribute(thisball.uid, "hunger", getPlayerStorageValue(cid, 1009))
  150.  
  151. if useOTClient then
  152. doPlayerSendCancel(owner, '12//,hide') --alterado v2.7
  153. end
  154.  
  155. doRemoveCreature(cid)
  156.  
  157. return false
  158. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement