• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

/premium "Player, days

bomba

Member
Joined
Feb 26, 2008
Messages
635
Reaction score
7
Location
Brazil
I want one script that send premium account to determined player.
I try this but I know: will don't work:
Code:
function onSay(cid, words, param)
	if(param == "") then
		return FALSE
	end
	   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The player "..param.." received "..param.." days of premium account.")
	   doPlayerAddPremiumDays(cid, param)
	return TRUE
end
 
Try this one:
Code:
function onSay(cid, words, param)
	if(param == "") then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return TRUE
	end

	local t = string.explode(param, ",")
	if(not t[2]) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough params.")
		return TRUE
	end
	
	local target = getPlayerGUIDByName(t[1])
	if target ~= 0 then
		doPlayerAddPremiumDays(target, t[2])
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, target.." has received "..t[2].." days of premium account.")
		doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, "You have received "..t[2].." days of premium account.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player is offline or does not exist.")
	end
	return FALSE
end
 
Using TFS 0.3?

Add this to functions.lua/global.lua:
Code:
string.explode = function (str, sep)
	local pos, t = 1, {}
	if #sep == 0 or #str == 0 then
		return
	end

	for s, e in function() return str:find(sep, pos) end do
		table.insert(t, str:sub(pos, s - 1):trim())
		pos = e + 1
	end

	table.insert(t, str:sub(pos):trim())
	return t
end
 
TFS-Alpha4 8.31
\o
PS: I have the function:
Code:
string.explode = function (str, sep)
	local pos, t = 1, {}
	if #sep == 0 or #str == 0 then
		return
	end

	for s, e in function() return string.find(str, sep, pos) end do
		table.insert(t, string.trim(string.sub(str, pos, s - 1)))
		pos = e + 1
	end

	table.insert(t, string.trim(string.sub(str, pos)))
	return t
end
 
Back
Top