• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Temporary Access Doors

Warfrag

New Member
Joined
Jun 9, 2011
Messages
14
Reaction score
2
I made a script that takes an item from a player, and lets him access that door for an hour. I've decided to share it with you.

All you need to do is set action id of door to 1780, and set the unique id to anything you want, it doesn't matter. Very simple.

After the player has passed the door, he will not be kicked out after time is up, however, should he leave and try to come back he won't be able to get in if his time expired.

Code:
local aid_of_door = 1780 -- ActionID of all VIP Doors
local ITEMID_OF_VIPTOKEN = 2195
local tdoor = 3600 -- time in seconds

-- DO NOT EDIT BELOW THIS LINE
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.actionid == aid_of_door) then
		local stor = getPlayerStorageValue(cid, item.uid)
		if(stor < 1 or (stor+tdoor) <= os.time()) then
			local ret = doPlayerRemoveItem(cid, ITEMID_OF_VIPTOKEN, 1)
			if(ret) then
				setPlayerStorageValue(cid, item.uid, os.time())
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You now have one hour access to this spawn.")
				if(not doorEnter(cid, item, toPosition)) then return false end
			else
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need atleast one VIP TOKEN to enter this spawn.")
			end
		else
			if(not doorEnter(cid, item, toPosition)) then return false end
		end
	end
	return true
end

function doorEnter(cid, item, toPosition)
	local mob = getTopCreature(toPosition); if(mob.uid > 0) then return false end
	doTransformItem(item.uid, item.itemid + 1)
	doTeleportThing(cid, toPosition)
	return true
end

Enjoy.
 
And even when you can go back?

Don't really understand what you mean by that. But I'll try to rephrase.

If player uses door and gets 1 hour access, he will be able to leave(or die) and go back in freely during that 1 hour. However, after that hour has expired, if he leaves, he will not be allowed back in, unless he pays for another hour of access.
 
Back
Top Bottom