RoksasNunes

eaez

Apr 20th, 2013
65
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.         doPlayerSetVocation(cid, getPlayerVocation(cid) + 4)
  20.             doPlayerAddPremiumDays(cid, tonumber(t[2]))
  21.                 addEvent(doRemoveCreature, 5*1000, cid, true)
  22.                     db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..getCreatureName(cid).."' WHERE `id` = "..getPlayerGUID(cid)..";")
  23.                         doPlayerSendTextMessage(cid, 22, ""..getCreatureName(cid).." added "..t[2].." days of Premium Account, removed "..tonumber(t[2]).."vip coins.")
  24.                     else
  25.                         doPlayerSendTextMessage(cid, 22, "You need "..tonumber(t[2]).."vip coins to buy "..t[2].." days of Premium Account!")
  26.                     end
  27.                         return true
  28.                     end
  29.                 end
Add Comment
Please, Sign In to add comment