RoksasNunes

Eaee

Apr 20th, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local config = {
  2.     vip_coin = 3723, -- Vip coin ID
  3. }
  4.  
  5. function onSay(cid, words, param)
  6.  
  7.     if(words == "/buypremium") then  
  8.     local t = string.explode(param, ",")  
  9.  
  10.     if(param == '') then
  11.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") return true
  12.     end
  13.  
  14.     if not tonumber(t[1]) then  
  15.         doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") return true
  16.     end  
  17.                                
  18.     if doPlayerRemoveItem(cid, vip_coin, tonumber(t[2])) then
  19.         doPlayerAddPremiumDays(cid, tonumber(t[2]))
  20.             addEvent(doRemoveCreature, 5*1000, cid, true)
  21.                 db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
  22.                     doPlayerSendTextMessage(cid, 22, ""..getCreatureName(cid).." added "..t[2].." days of Premium Account, removed "..tonumber(t[2]).."vip coins.")
  23.                 else
  24.                     doPlayerSendTextMessage(cid, 22, "You need "..tonumber(t[2]).."vip coins to buy "..t[2].." days of Premium Account!")
  25.                 end
  26.                     return true
  27.                 end
  28.             end
Add Comment
Please, Sign In to add comment