Advertisement
Guest User

Untitled

a guest
Apr 21st, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1.  
  2. function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
  3. local orig = player:getPosition()
  4. local nameplayer = player:getName()
  5. local x = 1
  6. local pokes = {
  7. ["Rat"] = {hp = 3000, maxhp = 3000, corpse = 5964, chance = 20, storage = 1031},
  8. ["Dragon"] = {hp = 10000, maxhp = 10000, corpse = 5973, chance = 20, storage = 1030},
  9. }
  10. for pokename, v in pairs(pokes) do
  11. local catchtry = player:getStorageValue(v.storage)
  12. if itemEx:getId() == v.corpse then
  13. if math.random(1, 100) <= v.chance then
  14. local catch = true
  15. itemEx:remove(1)
  16. item:remove(1)
  17. orig:sendMagicEffect(22)
  18. local pokeball = player:addItem(2650, 1)
  19. pokeball:setAttribute("text", ""..pokename.."")
  20. pokeball:setAttribute("defense", ""..v.hp.."")
  21. pokeball:setAttribute("attack", ""..v.maxhp.."")
  22. --pokeball:setAttribute("description", ""..pokename.."/"..v.hp.."/"..v.maxhp.."/Live")
  23. player:say("Parabens, voce capturou um "..pokename..".", TALKTYPE_MONSTER_SAY)
  24. player:say("Você gastou "..catchtry.." pokeballs para capturar um "..pokename..".", TALKTYPE_MONSTER_SAY)
  25. if catch == true then
  26. player:setStorageValue(v.storage, 1)
  27. return true
  28. end
  29. else
  30. player:say("Que pena, eu nao capturei o Pokemon ;/", TALKTYPE_MONSTER_SAY)
  31. itemEx:remove(1)
  32. local catchtimes = catchtry + x
  33. player:setStorageValue(v.storage, 1)
  34. player:setStorageValue(v.storage, catchtimes)
  35. item:remove(1)
  36. orig:sendMagicEffect(22)
  37. end
  38. end
  39.  
  40.  
  41. end
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement