Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. local ballcatch = { --id normal, id da ball shiy
  2. [2394] = {cr = 10, on = 193, off = 192, ball = {11826, 11737}, send = 47, typeee = "normal", boost = "0"}, --alterado v1.9 \/
  3. [2391] = {cr = 11, on = 198, off = 197, ball = {11832, 11740}, send = 48, typeee = "great", boost = "0"},
  4. [2393] = {cr = 12, on = 202, off = 201, ball = {11835, 11743}, send = 46, typeee = "super", boost = "0"},
  5. [2392] = {cr = 18, on = 200, off = 199, ball = {11829, 11746}, send = 49, typeee = "ultra", boost = "0"},
  6. [12617] = {cr = 5, on = 204, off = 203, ball = {10975, 12621}, send = 35, typeee = "saffari", boost = "0"},
  7. [12832] = {cr = 100000, on = 23, off = 24, ball = {12826, 12829}, send = 181, typeee = "dark", boost = "50"},
  8. }
  9.  
  10. function onUse(cid, item, frompos, item3, topos)
  11.  
  12. local item2 = getTopCorpse(topos)
  13. if item2 == null then
  14. return true
  15. end
  16.  
  17. if getItemAttribute(item2.uid, "catching") == 1 then
  18. return true
  19. end
  20.  
  21. if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
  22. return doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")
  23. end
  24.  
  25. local name = string.lower(getItemNameById(item2.itemid))
  26. name = string.gsub(name, "fainted ", "")
  27. name = string.gsub(name, "defeated ", "")
  28. name = doCorrectPokemonName(name)
  29. local x = pokecatches[name]
  30.  
  31. if not x then return true end
  32.  
  33. local shinys = {"Shiny Salamence", "Shiny Electivire", "Shiny Blaziken", "Shiny Magmortar","Shiny Snorlax", "Shiny Ditto"}
  34. if item.itemid == 12832 and isInArray(shinys, name) then
  35. doPlayerSendCancel(cid, "Você não pode pegar esse pokemon com a master ball!")
  36. return true
  37. end
  38.  
  39. local storage = newpokedex[name].stoCatch
  40. if getPlayerStorageValue(cid, storage) == -1 or not string.find(getPlayerStorageValue(cid, storage), ";") then --alterado v1.9
  41. setPlayerStorageValue(cid, storage, "normal = 0, great = 0, super = 0, ultra = 0, saffari = 0, dark = 0;") --alterado v1.9
  42. end
  43.  
  44. local owner = getItemAttribute(item2.uid, "corpseowner")
  45.  
  46. if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner then
  47. doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
  48. return true
  49. end
  50.  
  51. local newidd = isShinyName(name) and ballcatch[item.itemid].ball[2] or ballcatch[item.itemid].ball[1] --alterado v1.9
  52. local typeee = ballcatch[item.itemid] and ballcatch[item.itemid].typeee or "normal"
  53. local boost = ballcatch[item.itemid].boost
  54.  
  55.  
  56. local catchinfo = {}
  57. catchinfo.rate = ballcatch[item.itemid].cr
  58. catchinfo.catch = ballcatch[item.itemid].on
  59. catchinfo.fail = ballcatch[item.itemid].off
  60. catchinfo.newid = newidd
  61. catchinfo.name = doCorrectPokemonName(name)
  62. catchinfo.topos = topos
  63. catchinfo.chance = x.chance
  64.  
  65. doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
  66. doRemoveItem(item.uid, 1)
  67.  
  68. local d = getDistanceBetween(getThingPos(cid), topos)
  69.  
  70. if getPlayerStorageValue(cid, 98796) >= 1 and getPlayerItemCount(cid, 12617) <= 0 then --alterado v1.9
  71. setPlayerStorageValue(cid, 98796, -1)
  72. setPlayerStorageValue(cid, 98797, -1)
  73. doTeleportThing(cid, SafariOut, false)
  74. doSendMagicEffect(getThingPos(cid), 21)
  75. doPlayerSendTextMessage(cid, 27, "You spend all your saffari balls, good luck in the next time...")
  76. end
  77.  
  78. addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false, typeee)
  79. addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
  80. return true
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement