• 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!

[TFS 1.0] Vip system based on Mock's

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,323
Solutions
26
Reaction score
2,694
Location
Poland
Took me three days and a lot of work.
Not sure, but should run on 0.2.15 also

Tested on TFS 1.0 (compiled 3 weeks ago)

What this system does? It's a vip system based on this one: http://otland.net/f163/mock-vip-system-vip-account-51512/
IF YOU WANT TO APPRECIATE THIS WORK REP HIM, NOT ME.
Entirely rewritten almost from scratch to be compatible with newest TFS - it only uses vip_time table, returnVipString and queries from Mock's code

Feathures:
vip_time stores expiration date, time is based on your OS clock so it runs regardless of OT engine failures.
every command not executed by player is recorded to logfile(feathure can be disabled in config)
you can comment why you added or removed player vip time
players can use same command, but params are available only for access equeal to 1 or higher

Available functions:
-- doPlayerAddVip(cid,secs) - adds +secs seconds of viptime
-- addVipByAccount(acc,secs) - same as above, uses account id instead

-- setVipTable() - sends installation query to database
-- setPlayerVip(cid,secs) - sets viptime for certain time
-- setVipByAccount(acc,secs) - same as above, uses accont id instead

-- getPlayerVip(cid) - returns expiration date of viptime in seconds since January 1st, 1970
-- getVipByAcc(acc) - same as above, uses account id instead
-- getPlayerVipTime(cid) - returns player viptime in seconds left, if vip expired returns 0
-- getAccountVipTime(acc) - same as above, uses account id instead

-- hasVip(cid) - checks if player has vip, returns true or false
-- accountHasVip(acc) - same as above, uses account id instead

-- returnVipString(cid) - returns vip time expiration date in string
-- returnVipCountdown(number) - example: returnVipCountdown(getPlayerVipTime(cid)) returns vip time left as "x days, x hours, x minutes and x seconds left", values equeal to 0 are skipped

add this to global.lua:
Lua:
-- Vip system lib
function getPlayerAccount(cid)
	return getAccountNumberByPlayerName(getPlayerName(cid))
end

function setVipTable()
	db.query("ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL;")
end

function getPlayerVip(cid)
local resultId = db.storeQuery("SELECT `id`, `vip_time` FROM `accounts` WHERE `id` = '".. getPlayerAccount(cid) .."';")
	if resultId ~= false then
		return result.getDataInt(resultId, "vip_time")
	else
		error('Account not found.')
	end
end	
 
function getVipByAcc(acc)
	local a = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '"..acc.."';")
	if a ~= false then
		return result.getDataInt(a, "vip_time")
	else
		error('Account not found.')
	end
end
 
function setPlayerVip(cid,secs) -- seconds
	if isPlayer(cid) then
		db.query("UPDATE `accounts` SET `vip_time` = '"..(os.time()+secs).."' WHERE `id` ='".. getPlayerAccount(cid) .."' LIMIT 1 ;")
	else
		error('Player not found.')
	end
end
 
getVipByAccount = getVipByAcc
 
function hasVip(cid)
	if isPlayer(cid) then
		if os.time(day) < getPlayerVip(cid) then
			return true
		else
			return false
		end
	else
		error('Player not found.')
	end
end
 
function accountHasVip(acc)
	if os.time() < getVipByAccount(acc) then
		return true
	else
		return false
	end
end

function setVipByAccount(acc,secs) -- seconds
local a = getVipByAcc(acc)
	if a ~= false then
		if tonumber(secs) ~= nil then
			db.query("UPDATE `accounts` SET `vip_time` = '"..(os.time()+secs).."' WHERE `id` ='"..acc.."' LIMIT 1 ;")
		return true
		else
			error('Time must be defined as number.')
		end
	else
		error('Account not found.')
	end
	return false
end

function getPlayerVipTime(cid)
	if getPlayerVip(cid)-os.time() > 0 then
		return getPlayerVip(cid)-os.time()
	else
		return 0
	end
end

function getAccountVipTime(acc)
	if getVipByAcc(acc)-os.time() > 0 then
		return getVipByAcc(acc)-os.time()
	else
		return 0
	end
end

function addVipByAccount(acc,secs) -- seconds
local a = getVipByAcc(acc)
	if a ~= false then
		if tonumber(secs) ~= nil then
			db.query("UPDATE `accounts` SET `vip_time` = '"..os.time()+(getAccountVipTime(acc)+secs).."' WHERE `id` ='"..acc.."' LIMIT 1 ;")
		return true
		else
			error('Time must be defined as number.')
		end
	else
		error('Account not found.')
	end
	return false
end

function doPlayerAddVip(cid,secs) -- seconds
local a = getPlayerVip(cid)
	if a ~= false then
		if tonumber(secs) ~= nil then
			return setPlayerVip(cid,(getPlayerVipTime(cid) + secs))
		else
			error('Time must be defined as number.')
		end
	else
		error('Player not found.')
	end
end

function returnVipString(cid)
	if isPlayer(cid) == true then
		return os.date("%d %B %Y %X", getPlayerVip(cid))
	else
		error('Player not found.')
	end
end

function returnVipCountdown(num)
	local d = (tonumber(string.format("%.0f", os.date("%j",num))) - 1)
	local h = (tonumber(string.format("%.0f", os.date("%H",num))) - 1)
	local m = (tonumber(string.format("%.0f", os.date("%M",num))))
	local s = (tonumber(string.format("%.0f", os.date("%S",num))))
	local tvar, tnames, text = {d, h, m, s}, {"day", "hour", "minute", "second"}, ""
	local nvar, nnames = {}, {}
	
	for i = 1, #tvar do

		local s = ""
		table.insert(nvar, tvar[i])
		if tvar[i] > 1 then s = "s" end
			table.insert(nnames, tnames[i]..s)
		if i == 1 then
		if tvar[i] > 0 then text = text..nvar[i].." "..nnames[i] else text = text end
		else
			if tvar[i] > 0 then
				if text == "" then
					text = nvar[i].." "..nnames[i]
				else
					if tvar[i+1] ~= nil and tvar[i+1] > 0 then
						text = text..", "..nvar[i].." "..nnames[i]
					else
						text = text.." and "..nvar[i].." "..nnames[i]
					end
				end
			else
				text = text
			end
		end
	end
	if text == "" then
		return "no more vip time"
	else
		return text.." of vip time"
	end
end
-- end of vip system lib

talkactions.xml:
XML:
<talkaction words="/vip" script="vip.lua"/>
<talkaction words="!vip" script="vip.lua"/>

vip.lua:
Lua:
function onSay(cid, words, param)
vipsystem_info = {
   name = "Vipsystem for TFS 1.0 by Zbizu(inspired by Mock's creation)",
   author = "Zbizu",
   version = "1.0",
}

vip_config = {
log_opearations = true, -- logs date, IP integer and player name to make sure explainations of its user are truth if something go wrong, ignores players commands
log_file = "vip_log.txt"
}
	
local daycounter = (math.floor((getVipByAccount(getPlayerAccount(cid))-os.time())/86400, 0) + 1)
	if getPlayerAccess(cid) > 0 then
		adm_info = "\nYou have special access which allows you to manage players viptime.\n\nAvailable params: see, add, reset\nsee - views player's viptime\nadd - adds player's viptime\nreset - makes player's viptime expired immediately\n\nUsage: "..words.." \"param, playername, time, reason"
	else
		adm_info = ""
	end

	if param == "" or getPlayerAccess(cid) == 0 then
		if (daycounter)*(-1) == 1 then s = "" else s = "s" end
		local ret_ = getPlayerVip(cid)
		if ret_ == 0 then
			doPlayerPopupFYI(cid,"You don't have any vip time."..adm_info)
			return false
		else
			if getPlayerVipTime(cid) == 0 then
				if (daycounter)*(-1) == 0 then
					doPlayerPopupFYI(cid, "You don't have any vip time.\nYour vip expired in " .. os.date("%d %B %Y %X ",ret_) .. "(today)."..adm_info)
					return false
				else
					doPlayerPopupFYI(cid, "You don't have any vip time.\nYour vip expired in " .. os.date("%d %B %Y %X ",ret_) .. "(" .. (daycounter)*(-1) .. " day".. s .." ago)."..adm_info)
					return false
				end
			else
				doPlayerPopupFYI(cid, "Your vip status ends in " .. os.date("%d %B %Y %X",ret_) .. ".\nYou have:  " .. returnVipCountdown(getPlayerVipTime(cid)) .. " left."..adm_info)
				return false
			end
		end
	else
	if vip_config.log_opearations then
		file = io.open(vip_config.log_file, "a+")
		file:write(os.date("[%x %X]", os.time()).."[IP: "..getPlayerIp(cid).."]["..getPlayerName(cid).."]: ".. words .." \"".. param .."\n")
		file:close()
	end
	local t = string.explode(param, ", ", 4)
	local actions = {["see"] = 1, ["add"] = 2, ["reset"] = 3}
	local gen = {[0] = "She", [1] = "He", [2] = "This user"}
		if actions[t[1]] == nil then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect action specified.")
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see usage manual type "..words.." without params.")
			return false
		else
			local pid = getPlayerByName(t[2])
			reason_text = t[4]
			if reason_text ~= nil then
				if(t[5] ~= nil) then
					for j = 5, #t do
						reason_text = reason_text .. ", " .. t[j]
					end
				end
			else
				reason_text = ""
			end
			if reason_text == "" then vip_comment = "" else vip_comment = "Reason: "..reason_text end
							
			if pid then
				if actions[t[1]] == 1 then
					if getPlayerVip(pid) == 0 then
						doPlayerPopupFYI(cid, getPlayerName(pid).."'s account never had any vip time.")
					else
						doPlayerPopupFYI(cid, getPlayerName(pid).."'s vip time expiration date:\n" .. os.date("%d %B %Y %X",getPlayerVip(pid)) .. "\n".. gen[getPlayerSex(pid)] .. " has ".. returnVipCountdown(getPlayerVipTime(pid)) .. " left.")
					end
				return false
				elseif actions[t[1]] == 2 then
					if tonumber(t[3]) ~= nil then
						if tonumber(t[3]) == 0 then
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(pid).."'s vip time wasn't changed.")
						return false
						else
						if tonumber(t[3]) > 0 then
						vip_action = "added to"
						vip_formula = tonumber(t[3])
						else
						vip_action = "removed from"
						vip_formula = tonumber(t[3]*(-1))
						end
							if vip_config.log_opearations then
								file = io.open(vip_config.log_file, "a+")
								file:write(os.date("Player had "..returnVipCountdown(getPlayerVipTime(pid)).." left\n"))
								file:close()
							end
							doPlayerAddVip(pid,tonumber(t[3]))
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, returnVipCountdown(vip_formula).." "..vip_action.." "..getPlayerName(pid).."'s account.")
							doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, gen[getPlayerSex(pid)] .. " has ".. returnVipCountdown(getPlayerVipTime(pid)) .. " now.")							
							if vip_comment ~= "" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
							doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, returnVipCountdown(vip_formula).." "..vip_action.." your account.")
							doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. returnVipCountdown(getPlayerVipTime(pid)) .. " now.")
							if vip_comment ~= "" then doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
						return false
						end
					else
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Time must be a number.")
						doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see usage manual type "..words.." without params.")
					end
				return false
				elseif actions[t[1]] == 3 then
					if vip_config.log_opearations then
						file = io.open(vip_config.log_file, "a+")
						file:write(os.date("Player had "..returnVipCountdown(getPlayerVipTime(pid)).." left\n"))
						file:close()
					end
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(pid).."'s vip status removed. ".. gen[getPlayerSex(pid)] .. " had "..returnVipCountdown(getPlayerVipTime(pid)).." left.")
				if vip_comment ~= "" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
				doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vip status has been removed.")
				if vip_comment ~= "" then doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
				setPlayerVip(pid,0)
				return false
				end
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.")
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see usage manual type "..words.." without params.")
				return false
			end
		end
	end
	return true
end

Enjoy.
I'll post also vip scroll script later.
 
I know i'm a few month's late but..... Trying it out now ;D !!!
 
I had somewhere between infinity to infinity^2 bugs on the startup. :(
 
Nevermind it was my own fault, nice script!!!
 
when i use the command !vip "add I get this error:
5djksl.png


wheni use the command !vip "see i get this error:
263irdx.png


when i use the command !vip "reset i get this error:
2co35t1.png



I tried messing around but i caused more damage. Any ideas how to fix it?
 
I just deleted all instances of "returnVIPcountdown" and it seems to be working fine now!!! :D

Sorry for wasting your time OTland community! :S
 
Nothing was wasted at all. I don't recommend using this system due to amount of changes in tfs 1.0 and poor scripting(it's my old system).

This code is outdated so please close or delete this thread.
I'll post better vipsystem later if I find some time to make it.
 
Mr Zbizu it's working perfectly for me so far! Really thanks i don't think you need to delete it!

Put this into global.lua at the very end:

Code:
-- Vip system lib
function getPlayerAccount(cid)
return getAccountNumberByPlayerName(getPlayerName(cid))
end

function setVipTable()
db.query("ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL;")
end

function getPlayerVip(cid)
local resultId = db.storeQuery("SELECT `id`, `vip_time` FROM `accounts` WHERE `id` = '".. getPlayerAccount(cid) .."';")
if resultId ~= false then
return result.getDataInt(resultId, "vip_time")
else
error('Account not found.')
end
end

function getVipByAcc(acc)
local a = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '"..acc.."';")
if a ~= false then
return result.getDataInt(a, "vip_time")
else
error('Account not found.')
end
end

function setPlayerVip(cid,secs) -- seconds
if isPlayer(cid) then
db.query("UPDATE `accounts` SET `vip_time` = '"..(os.time()+secs).."' WHERE `id` ='".. getPlayerAccount(cid) .."' LIMIT 1 ;")
else
error('Player not found.')
end
end

getVipByAccount = getVipByAcc

function hasVip(cid)
if isPlayer(cid) then
if os.time(day) < getPlayerVip(cid) then
return true
else
return false
end
else
error('Player not found.')
end
end

function accountHasVip(acc)
if os.time() < getVipByAccount(acc) then
return true
else
return false
end
end

function setVipByAccount(acc,secs) -- seconds
local a = getVipByAcc(acc)
if a ~= false then
if tonumber(secs) ~= nil then
db.query("UPDATE `accounts` SET `vip_time` = '"..(os.time()+secs).."' WHERE `id` ='"..acc.."' LIMIT 1 ;")
return true
else
error('Time must be defined as number.')
end
else
error('Account not found.')
end
return false
end

function getPlayerVipTime(cid)
if getPlayerVip(cid)-os.time() > 0 then
return getPlayerVip(cid)-os.time()
else
return 0
end
end

function getAccountVipTime(acc)
if getVipByAcc(acc)-os.time() > 0 then
return getVipByAcc(acc)-os.time()
else
return 0
end
end

function addVipByAccount(acc,secs) -- seconds
local a = getVipByAcc(acc)
if a ~= false then
if tonumber(secs) ~= nil then
db.query("UPDATE `accounts` SET `vip_time` = '"..os.time()+(getAccountVipTime(acc)+secs).."' WHERE `id` ='"..acc.."' LIMIT 1 ;")
return true
else
error('Time must be defined as number.')
end
else
error('Account not found.')
end
return false
end

function doPlayerAddVip(cid,secs) -- seconds
local a = getPlayerVip(cid)
if a ~= false then
if tonumber(secs) ~= nil then
return setPlayerVip(cid,(getPlayerVipTime(cid) + secs))
else
error('Time must be defined as number.')
end
else
error('Player not found.')
end
end

function returnVipString(cid)
if isPlayer(cid) == true then
return os.date("%d %B %Y %X", getPlayerVip(cid))
else
error('Player not found.')
end
end

function returnVipCountdown(num)
local d = (tonumber(string.format("%.0f", os.date("%j",num))) - 1)
local h = (tonumber(string.format("%.0f", os.date("%H",num))) - 1)
local m = (tonumber(string.format("%.0f", os.date("%M",num))))
local s = (tonumber(string.format("%.0f", os.date("%S",num))))
local tvar, tnames, text = {d, h, m, s}, {"day", "hour", "minute", "second"}, ""
local nvar, nnames = {}, {}

for i = 1, #tvar do

local s = ""
table.insert(nvar, tvar)
if tvar > 1 then s = "s" end
table.insert(nnames, tnames..s)
if i == 1 then
if tvar > 0 then text = text..nvar.." "..nnames else text = text end
else
if tvar > 0 then
if text == "" then
text = nvar.." "..nnames
else
if tvar[i+1] ~= nil and tvar[i+1] > 0 then
text = text..", "..nvar.." "..nnames
else
text = text.." and "..nvar.." "..nnames
end
end
else
text = text
end
end
end
if text == "" then
return "no more vip time"
else
return text.." of vip time"
end
end
-- end of vip system lib

Put this into talkactions:

Code:
function onSay(cid, words, param)
vipsystem_info = {
name = "Vipsystem for TFS 1.0 by Zbizu(inspired by Mock's creation)",
author = "Zbizu",
version = "1.0",
}

vip_config = {
log_opearations = true, -- logs date, IP integer and player name to make sure explainations of its user are truth if something go wrong, ignores players commands
log_file = "vip_log.txt"
}

local daycounter = (math.floor((getVipByAccount(getPlayerAccount(cid))-os.time())/86400, 0) + 1)
if getPlayerAccess(cid) > 0 then
adm_info = "\nYou have special access which allows you to manage players viptime.\n\nAvailable params: see, add, reset\nsee - views player's viptime\nadd - adds player's viptime\nreset - makes player's viptime expired immediately\n\nUsage: "..words.." \"param, playername, time, reason"
else
adm_info = ""
adm_info = ""
end

if param == "" or getPlayerAccess(cid) == 0 then
if (daycounter)*(-1) == 1 then s = "" else s = "s" end
local ret_ = getPlayerVip(cid)
if ret_ == 0 then
doPlayerPopupFYI(cid,"You don't have any vip time."..adm_info)
return false
else
if getPlayerVipTime(cid) == 0 then
if (daycounter)*(-1) == 0 then
doPlayerPopupFYI(cid, "You don't have any vip time.\nYour vip expired in " .. os.date("%d %B %Y %X ",ret_) .. "(today)."..adm_info)
return false
else
doPlayerPopupFYI(cid, "You don't have any vip time.\nYour vip expired in " .. os.date("%d %B %Y %X ",ret_) .. "(" .. (daycounter)*(-1) .. " day".. s .." ago)."..adm_info)
return false
end
else
doPlayerPopupFYI(cid, "Your vip status ends in " .. os.date("%d %B %Y %X",ret_) .. ".\nYou have: " .. (getPlayerVipTime(cid)) .. " left."..adm_info)
return false
end
end
else
if vip_config.log_opearations then
file = io.open(vip_config.log_file, "a+")
file:write(os.date("[%x %X]", os.time()).."[IP: "..getPlayerIp(cid).."]["..getPlayerName(cid).."]: ".. words .." \"".. param .."\n")
file:close()
end
local t = string.split(param, ", ", 4)
local actions = {["see"] = 1, ["add"] = 2, ["reset"] = 3}
local gen = {[0] = "She", [1] = "He", [2] = "This user"}
if actions[t[1]] == nil then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect action specified.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see usage manual type "..words.." without params.")
return false
else
local pid = getPlayerByName(t[2])
reason_text = t[4]
if reason_text ~= nil then
if(t[5] ~= nil) then
for j = 5, #t do
reason_text = reason_text .. ", " .. t[j]
end
end
else
reason_text = ""
end
if reason_text == "" then vip_comment = "" else vip_comment = "Reason: "..reason_text end

if pid then
if actions[t[1]] == 1 then
if getPlayerVip(pid) == 0 then
doPlayerPopupFYI(cid, getPlayerName(pid).."'s account never had any vip time.")
else
doPlayerPopupFYI(cid, getPlayerName(pid).."'s vip time expiration date:\n" .. os.date("%d %B %Y %X",getPlayerVip(pid)) .. "\n".. gen[getPlayerSex(pid)] .. " has ".. (getPlayerVipTime(pid)) .. " left.")
end
return false
elseif actions[t[1]] == 2 then
if tonumber(t[3]) ~= nil then
if tonumber(t[3]) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(pid).."'s vip time wasn't changed.")
return false
else
if tonumber(t[3]) > 0 then
vip_action = "added to"
vip_formula = tonumber(t[3])
else
vip_action = "removed from"
vip_formula = tonumber(t[3]*(-1))
end
if vip_config.log_opearations then
file = io.open(vip_config.log_file, "a+")
file:write(os.date("Player had "..(getPlayerVipTime(pid)).." left\n"))
file:close()
end
doPlayerAddVip(pid,tonumber(t[3]))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (vip_formula).." "..vip_action.." "..getPlayerName(pid).."'s account.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, gen[getPlayerSex(pid)] .. " has ".. (getPlayerVipTime(pid)) .. " now.")
if vip_comment ~= "" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, (vip_formula).." "..vip_action.." your account.")
doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "You have ".. (getPlayerVipTime(pid)) .. " now.")
if vip_comment ~= "" then doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
return false
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Time must be a number.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see usage manual type "..words.." without params.")
end
return false
elseif actions[t[1]] == 3 then
if vip_config.log_opearations then
file = io.open(vip_config.log_file, "a+")
file:write(os.date("Player had "..(getPlayerVipTime(pid)).." left\n"))
file:close()
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerName(pid).."'s vip status removed. ".. gen[getPlayerSex(pid)] .. " had "..(getPlayerVipTime(pid)).." left.")
if vip_comment ~= "" then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Your vip status has been removed.")
if vip_comment ~= "" then doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, vip_comment) end
setPlayerVip(pid,0)
return false
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "To see usage manual type "..words.." without params.")
return false
end
end
end
return true
end

then go talkactions.xml and add these 2 lines:

<talkaction words="/vip" script="vip.lua"/>
<talkaction words="!vip" script="vip.lua"/>

VIP Medal:

Add this to actions.xml:
<action itemid="5785" script="other/vipmedal.lua"/>

Now add this to actions/others/vipmedal.lua

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
doSendMagicEffect(getCreaturePosition(cid),29)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have just added 7 days of VIP!!!")
doPlayerAddVip(cid, 604800)
doRemoveItem(item.uid)
return true
end


p.s. These directions aren't for you obviously, they are your directions xD! Just incase someone else wanted to try it i put it like this!
 
Please, what ActionID so that only vip players, pass it?

You can make the Action ID whatever you want, just make sure the ID you set in Map Editor is the same one you put it movements.xml

movements.xml
Code:
<movevent event="StepIn" actionid="11223" script="viptile.lua"/>

data/movements/viptile.lua
Code:
function onStepIn(cid, item, position, fromPosition)
if getPlayerVipTime(cid) == 0 then
doTeleportThing(cid, fromPosition, FALSE)
doSendMagicEffect(getCreaturePosition(cid),66)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are not VIP!!!")
end
return true
end
 
Nice...
Thanks

I'm not able to add players in the vip
/ vip "add, nick name, 1;

'player not found'
help me

Sorry my english,google tradutor!
 
Nice...
Thanks

I'm not able to add players in the vip
/ vip "add, nick name, 1;

'player not found'
help me

Sorry my english,google tradutor!


no space after /

/vip "add, player, 86400

86400 = 1 day

In this system you must add with seconds.
 
Yes,
/vip "add,montaria char,86400

"Player not found
To see usage manul type /vip without parms"
 
after char login, the following message in the distro

[Error - mysql_real_query] Query: INSERT INTO 'Players_online' VALUES <7>

Message: Duplicate entry '7 'for key' PRIMARY '
 
Did you already add this table?

Code:
ALTER TABLE `accounts` ADD `vip_time` INT( 15 ) NOT NULL;
 
This is 2 words name of character, I have same problem. For one-word names all work! need help.
Please help me how to fix that.. :/
 
Last edited:
Back
Top