Advertisement
Guest User

CatchWindow_lib.lua

a guest
Dec 15th, 2014
1,172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. -- V1.3 ->Developed by: Tony Araújo (OrochiElf) ~~ www.OTCodes.com ~~
  2.  
  3. CW_Pokes = {
  4. ["bulbasaur"] = {DB_Balls = 500001, DB_PK = 900001, ID_Portrait = 11989, P_Experience = 5000},
  5. ["ivysaur"] = {DB_Balls = 500002, DB_PK = 900002, ID_Portrait = 11990, P_Experience = 10000},
  6. ["venusaur"] = {DB_Balls = 500003, DB_PK = 900003, ID_Portrait = 11991, P_Experience = 15000},
  7. }
  8.  
  9. CW_Balls = {
  10. ["normal"] = "pb", -- PokeBall
  11. ["great"] = "gb", -- GreatBall
  12. ["super"] = "sb", -- SuperBall
  13. ["ultra"] = "ub", -- UltraBall
  14. }
  15.  
  16. -------- Functions ----------
  17. function CW_Count(cid, pokeName, ball)
  18. local name = nil
  19. if tostring(pokeName) then
  20.  
  21. name = pokeName:lower()
  22. else
  23.  
  24. name = getCreatureName(pokeName):lower()
  25. end
  26.  
  27. local pk = CW_Pokes[name]
  28.  
  29. if pk then
  30. if tonumber(getPlayerStorageValue(cid, pk.DB_Balls)) then
  31.  
  32. setPlayerStorageValue(cid, pk.DB_Balls, "pb=0,gb=0,sb=0,ub=0,")
  33. end
  34.  
  35. local txt = getPlayerStorageValue(cid, pk.DB_Balls)
  36. local change = txt:match(CW_Balls[ball].."=(.-),")
  37. local num = tonumber(change)
  38.  
  39. local ret = string.gsub(txt, CW_Balls[ball].."="..num, CW_Balls[ball].."="..(num+1))
  40. return setPlayerStorageValue(cid, pk.DB_Balls, ret) and true
  41. end
  42. end
  43.  
  44. function CW_Caught(cid, pokeName)
  45. local name = nil
  46. if tostring(pokeName) then
  47.  
  48. name = pokeName:lower()
  49. else
  50.  
  51. name = getCreatureName(pokeName):lower()
  52. end
  53.  
  54. local pk = CW_Pokes[name]
  55.  
  56. if pk then
  57. if getPlayerStorageValue(cid, pk.DB_PK) <= 0 then
  58.  
  59. doPlayerSendCancel(cid, "%#CatcherWindow@"..getItemInfo(pk.ID_Portrait).clientId.."@"..pokeName.."@"..pk.P_Experience.."@"..getPlayerStorageValue(cid, pk.DB_Balls))
  60. setPlayerStorageValue(cid, pk.DB_Balls, "pb=0,gb=0,sb=0,ub=0,")
  61. doPlayerAddExp(cid, pk.P_Experience)
  62. setPlayerStorageValue(cid, pk.DB_PK, 1)
  63. end
  64. end
  65. return true
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement