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

Action [Release] VIP System

Shawak

Intermediate OT User
Joined
Sep 11, 2008
Messages
1,984
Solutions
2
Reaction score
119
Location
Germany
GitHub
Shawak
First of all, i have to say that you need the http://otland.net/f163/full-working-vip-system-shawak-44840/ to use the scripts ^_^.

Version:
TFS 0.3.5, tested.

Credits:
- Idea:
http://otland.net/f82/vip-system-19426/
http://otland.net/f81/updated-vip-system-44805/
- First scripts:
Empty
- New Version:
By me :).

Items:

Here the VIP medal:
nv64v5.png


And the door:
14e8cvr.png



Script:
-> data/actions/actions.xml
Lua:
	<!-- VIP -->
	<action actionid="5786" script="vipdoor.lua"/>
	<action itemid="5785" script="vip.lua"/>
-> data/actions/scripts/vipdoor.lua
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayerVip(cid) == TRUE then
		if getCreaturePosition(cid).y < toPosition.y then
			doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
		else
			doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
		end
		doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getCreaturePosition(cid), 10)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but only VIP Players can pass here! Buy VIP on the WEB.")
	end
	return TRUE
end
-> data/actions/scripts/vip.lua
Lua:
local days = 30
local levelToBeVIP = 1

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLevel(cid) >= levelToBeVIP then
		if isPlayerVip(cid) == FALSE then
			doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for "..days.." days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
		end
		doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
		doPlayerAddVipDays(cid, days)
		doRemoveItem(item.uid, 1)
		doSendAnimatedText(getCreaturePosition(cid), "+"..days.." days", 30)
	else
		doPlayerSendCancel(cid, "You need level "..levelToBeVIP.." to be a VIP player.")
	end	
	return TRUE
end

Instruction:
(give the door the actionid 5786)
2uj61pw.png


If you find any bugs, report them here! ^_^
If you like it, please don't forget to rep++. ;)

@Good Scritpers: Stop rewriting my scripts! :D

Regards,
Shawak
 
Last edited:
[11/08/2009 15:39:20] Lua Script Error: [Action Interface]
[11/08/2009 15:39:20] data/actions/scripts/custom/vip.lua:eek:nUse

[11/08/2009 15:39:21] data/actions/scripts/custom/vip.lua:7: attempt to call global 'isPlayerVip' (a nil value)
[11/08/2009 15:39:21] stack traceback:
[11/08/2009 15:39:21] data/actions/scripts/custom/vip.lua:7: in function <data/actions/scripts/custom/vip.lua:5>

Edit: if u dont add
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.
- 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/functions.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]
	
]]--

local 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:


Have fun with it!!! :)

Regards,
Shawak

You will get the error on top

Works fine :) rep ++
 
Last edited:
I added everything that stands there, and when i click on the medal i get this error
Code:
[12/08/2009 14:06:49] Lua Script Error: [Action Interface] 
[12/08/2009 14:06:49] data/actions/scripts/vip.lua:onUse

[12/08/2009 14:06:49] data/actions/scripts/vip.lua:7: attempt to call global 'isPlayerVip' (a nil value)
[12/08/2009 14:06:49] stack traceback:
[12/08/2009 14:06:49] 	data/actions/scripts/vip.lua:7: in function <data/actions/scripts/vip.lua:5>
 
It works :D Repp++ for you!
exept 1 thing.. the door.
i've putted the action's on the door but when i click on the door (even when i'm vip) it says; "only the worthy may pass"

how does this come?:confused:
 
It works :D Repp++ for you!
exept 1 thing.. the door.
i've putted the action's on the door but when i click on the door (even when i'm vip) it says; "only the worthy may pass"

how does this come?:confused:

added the door part and the action part? :p
 
Back
Top