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

Full working VIP System by Shawak

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
Hello,
Here a full working and tested VIP System, i hope you like it :thumbup:.
And please don't forget to rep++ me if you like it ^_^.

Credits:
- Idea:
http://otland.net/f82/vip-system-19426/
http://otland.net/f81/updated-vip-system-44805/
- Script:
100% by Shawak (me :))

Version:
- Tested on TFS 0.3.5 (If you have TFS 0.3.5pl1 you should use: Vip System v2.0)
- Should work with other TFSs.

New lua functions:
Code:
setPlayerVipDays(cid, days)    -- set player XXX Vip days // return days
getPlayerVipDays(cid)          -- get player current Vip days left // return days
isPlayerVip(cid)               -- check if player is vip // return TRUE (if player is Vip) or FALSE (if player isn't Vip)
doPlayerAddVipDays(cid, days)  -- add player vip days // return days
doPlayerRemoveVip(cid)         -- remove player Vip and set Vip days to 0 // return TRUE

Script:
- data/lib/function.lua add at the end of the script:
Lua:
--[[ 
	VIP System by Shawak
	Tested on TFS 0.3.5
	For more informations visit:
	[url]http://otland.net/f163/full-working-vip-system-shawak-44840/#post452638[/url]
	
]]--

vip_storage = 95883

function setPlayerVipDays(cid, days)
	return setPlayerStorageValue(cid, vip_storage, (os.time() + 86400 * days)) and days
end

function getPlayerVipDays(cid)
	local left, d = (getPlayerStorageValue(cid, vip_storage) - os.time()), 0
	while left >= 86400 do
		left = left - 86400
		d = d+1
	end
	return d
end

function isPlayerVip(cid)
	return getPlayerStorageValue(cid, vip_storage) >= os.time() and TRUE or FALSE
end

function doPlayerAddVipDays(cid, days)
	return setPlayerStorageValue(cid, vip_storage, (os.time() + (86400 * getPlayerVipDays(cid)) + (86400 * days))) and days
end

function doPlayerRemoveVip(cid)
	return setPlayerStorageValue(cid, vip_storage, 0) and TRUE
end

And finished.

Other:
I also maked talkaction scripts for a GOD / CM / GM:
- data/talkactions/talkactions.xml
Lua:
	<!-- VIP -->
	<talkaction log="yes" words="!set" access="5" event="script" value="vip/set.lua"/>
	<talkaction log="yes" words="!get" access="5" event="script" value="vip/get.lua"/>
	<talkaction log="yes" words="!is" access="5" event="script" value="vip/is.lua"/>
	<talkaction log="yes" words="!add" access="5" event="script" value="vip/add.lua"/>
	<talkaction log="yes" words="!remove" access="5" event="script" value="vip/remove.lua"/>

Lua files for the talkaction scripts, download here:
Here/or attachments (Not needed for the mainly functions)

Have fun with it!!! :)

Regards,
Shawak
 

Attachments

  • vip talkactions.rar
    882 bytes · Views: 425 · VirusTotal
Last edited:
Why dont you release the lua scripts on here so we dont have to download? besides that very nice ^^
 
@not working here...

Code:
[11/08/2009 02:54:51] Lua Script Error: [TalkAction Interface] 
[11/08/2009 02:54:51] data/talkactions/scripts/vip/add.lua:onSay

[11/08/2009 02:54:51] data/lib/function.lua:493: attempt to perform arithmetic on local 'days' (a string value)
[11/08/2009 02:54:51] stack traceback:
[11/08/2009 02:54:51] 	data/lib/function.lua:493: in function <data/lib/function.lua:492>
[11/08/2009 02:54:51] 	(tail call): ?

[11/08/2009 02:55:12] Lua Script Error: [TalkAction Interface] 
[11/08/2009 02:55:12] data/talkactions/scripts/vip/set.lua:onSay

[11/08/2009 02:55:12] data/lib/function.lua:476: attempt to perform arithmetic on local 'days' (a string value)
[11/08/2009 02:55:12] stack traceback:
[11/08/2009 02:55:12] 	data/lib/function.lua:476: in function <data/lib/function.lua:475>
[11/08/2009 02:55:12] 	(tail call): ?

[11/08/2009 02:55:17] Lua Script Error: [TalkAction Interface] 
[11/08/2009 02:55:17] data/talkactions/scripts/vip/set.lua:onSay

[11/08/2009 02:55:17] data/lib/function.lua:476: attempt to perform arithmetic on local 'days' (a string value)
[11/08/2009 02:55:17] stack traceback:
[11/08/2009 02:55:17] 	data/lib/function.lua:476: in function <data/lib/function.lua:475>
[11/08/2009 02:55:17] 	(tail call): ?

[11/08/2009 02:55:20] Lua Script Error: [TalkAction Interface] 
[11/08/2009 02:55:20] data/talkactions/scripts/vip/set.lua:onSay

[11/08/2009 02:55:20] data/lib/function.lua:476: attempt to perform arithmetic on local 'days' (a string value)
[11/08/2009 02:55:20] stack traceback:
[11/08/2009 02:55:20] 	data/lib/function.lua:476: in function <data/lib/function.lua:475>
[11/08/2009 02:55:20] 	(tail call): ?

[11/08/2009 02:55:27] Lua Script Error: [TalkAction Interface] 
[11/08/2009 02:55:27] data/talkactions/scripts/vip/set.lua:onSay

[11/08/2009 02:55:27] data/lib/function.lua:476: attempt to perform arithmetic on local 'days' (a string value)
[11/08/2009 02:55:27] stack traceback:
[11/08/2009 02:55:27] 	data/lib/function.lua:476: in function <data/lib/function.lua:475>
[11/08/2009 02:55:27] 	(tail call): ?

What happening? :blink:
 
I want to use JBD's script because It got the 3 items for certin days and i use donations system
 
Try "!add 7" and then use "!get" ^_^.
And never rep++ my if script doesn't work! ^_^

Rep was for the functions. ;)

and !add 7 did work. but it said 6 days left hihi.

and !remove dosnt remove vip


Wait. I get it now, Those scripts are only for testing the function not adding more days right? haha
 
Rep was for the functions. ;)

and !add 7 did work. but it said 6 days left hihi.

and !remove dosnt remove vip


Wait. I get it now, Those scripts are only for testing the function not adding more days right? haha

It says 6 days cause you have 6 days 23h 59min and some seconds :thumbup:.
If you use !is you will see that you have premium :).
 
Back
Top