Hello!
Im back!: D
It's my simple, and best vip system, Vip like premium on account, not on player ;d
simple functions add to our data/lib/functions.lua
how do use? easy!
GM COMMAND FOR ADD SOME VIP DAY'S and for lookup vip time (functions list and timeString need):
talkactions.xml
and to your config.lua
remember to add in our database:
: ))
Im back!: D
It's my simple, and best vip system, Vip like premium on account, not on player ;d
simple functions add to our data/lib/functions.lua
PHP:
function getAccountVipTime(accountName)
local result = db.getResult("SELECT `viptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
if(result:getID() ~= -1) then
if(result:getDataInt("viptime") > os.time())then
return result:getDataInt("viptime")-os.time()
else
return 0
end
else
return FALSE
end
result:free()
end
function isVip(accountName)
if(getAccountVipTime(accountName) > 0 or getConfigInfo("freeVip") == "yes")then
return TRUE
else
return FALSE
end
end
function doAccountAddVipTime(accountName, vipTime)
local result = db.getResult("SELECT `viptime` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
if(result:getID() ~= -1) then
if(result:getDataInt("viptime") > os.time())then
timeToAdd = result:getDataInt("viptime")+vipTime
else
timeToAdd = os.time()+vipTime
end
db.executeQuery("UPDATE `accounts` SET `viptime` = " .. timeToAdd .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
result:free()
return TRUE
end
end
how do use? easy!
GM COMMAND FOR ADD SOME VIP DAY'S and for lookup vip time (functions list and timeString need):
PHP:
function onSay(cid, words, param)
if(words == "/vip")then
accountName = getPlayerAccount(cid)
if(isVip(accountName))then
time = getAccountVipTime(accountName)
if(time > 0)then
doPlayerSendTextMessage(cid, 19, "Your account have "..timeString(time).." of vip time left.")
else
doPlayerSendTextMessage(cid, 19, "Your account gratis vip time.")
end
else
doPlayerSendTextMessage(cid, 19, "You haven't any vip time.")
end
elseif(words == "/addvip")then
if(param ~= "")then
local params = list({"name", "days"}, string.explode(param, ',', 2))
local player = getPlayerByName(params["name"])
if(isPlayer(player) == TRUE)then
if(isNumber(params["days"]))then
local days = (params["days"]*3600*24)
doAccountAddVipTime(getPlayerAccount(player), days)
else
doPlayerSendCancel(cid, "Days ammount must be in numeric format.")
end
else
doPlayerSendCancel(cid, "Player is not online.")
end
else
doPlayerSendCancel(cid, "Command requires param.")
end
end
return TRUE
end
PHP:
<talkaction log="yes" words="/addvip" access="5" event="script" value="vip.lua"/>
<talkaction log="yes" words="/vip" access="0" event="script" value="vip.lua"/>
and to your config.lua
PHP:
freeVip = "no" -- gratis vip for all? :D
remember to add in our database:
PHP:
ALTER TABLE `accounts` ADD `viptime` BIGINT( 20 ) NOT NULL ;
Last edited: