Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 3.54 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function onSay(cid, words, param)
  2. if(words == "!buyvip") then
  3. local items = ID_ITEM_VIP
  4. if doPlayerRemoveItem(cid, items, 1) == TRUE then
  5. local days = 30
  6. local daysvalue = days * 24 * 60 * 60
  7. local storageplayer = getPlayerStorageValue(cid, 13540)
  8. local timenow = os.time()
  9.  
  10. if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
  11. time = timenow + daysvalue
  12. else
  13. time = storageplayer + daysvalue
  14. end
  15.  
  16. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
  17. setPlayerStorageValue(cid, 13540, time)
  18.  
  19. local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
  20. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
  21. else
  22. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa de um item para colocar vip.")
  23. end
  24.  
  25. elseif(words == "!vipdays") then
  26. local timenow = os.time()
  27. local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
  28. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no seu character.")
  29.  
  30. elseif(words == "/checkvip") then
  31. if getPlayerAccess(cid) == 5 then
  32. if not param then
  33. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
  34. end
  35.  
  36. local player = getPlayerByName(param)
  37. if not isPlayer(player) then
  38. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..player.." not found.")
  39. end
  40.  
  41. local timenow = os.time()
  42.  
  43. local quantity = math.floor((getPlayerStorageValue(player, 13540) - timenow)/(24 * 60 * 60))
  44. doPlayerPopupFYI(cid, "O jogador tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no character.")
  45. return TRUE
  46. end
  47.  
  48. elseif(words == "/addvip") then
  49. if getPlayerAccess(cid) == 5 then
  50. local t = string.explode(param, ",")
  51. if not t[2] then
  52. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
  53. end
  54.  
  55. local player = getPlayerByName(t[1])
  56. local days = t[2]
  57. if not isPlayer(player) then
  58. doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..player.." not found.")
  59. end
  60.  
  61. local daysvalue = days*3600*24
  62. local storageplayer = getPlayerStorageValue(player, 13540)
  63. local timenow = os.time()
  64.  
  65. local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)
  66.  
  67. doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..days.." dias de VIP no seu character.")
  68. setPlayerStorageValue(player, 13540, time)
  69. local quantity = math.floor((getPlayerStorageValue(player,13540) - timenow)/(3600*24))
  70. doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem "..quantity.." dias de VIP restantes.")
  71. end
  72.  
  73. elseif(words == "/delvip") then
  74. if getPlayerAccess(cid) == 5 then
  75. local dec = MESSAGE_INFO_DESCR
  76. if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
  77. local C,t = {},string.explode(param, ",")
  78. C.pos = getPlayerPosition(cid)
  79. C.uid = getCreatureByName(t[1])
  80. C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2]))*3600*24 --Tempo da vip por dia.
  81. C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) --Dias de vip.
  82.  
  83. if(getPlayerStorageValue(C.uid,13540) < C.time)then
  84. doPlayerSendTextMessage(cid,dec,'O jogador '..t[1]..' não possui '..C.days..' dias de vip.')
  85. else
  86. doPlayerSendTextMessage(cid,dec,'Você removeu '..C.days..' dias de vip do player '..t[1]..'.')
  87. setPlayerStorageValue(C.uid,13540,getPlayerStorageValue(C.uid,13540)-C.time)
  88. end
  89. doSendMagicEffect(C.pos, math.random(28,30))
  90. end
  91. end
  92.  
  93. return TRUE
  94. end