View difference between Paste ID: gjrp3pNh and fEbeY92A
SHOW: | | - or go back to the newest paste.
1
local config = {
2-
	vip_coin = 1, -- Vip coin por dia que comprar
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