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

Only one player in room

Serp

/* No comment */
Joined
Mar 23, 2008
Messages
249
Reaction score
1
Request:
If a player is in a room, no other player can enter until they leave. like only 1 person can be in that room

Can anyone write me an example script for something like that?

Ty for any help in advance.
 
functions.lua (or global.lua if NOT TFS)
Code:
function getNextPosFromDir(fromPos, dir, size)
	local nPos =
	{
		[0]={x=fromPos.x,	y=fromPos.y-size,	z=fromPos.z, stackpos = STACKPOS_TOP_CREATURE}, 
		[1]={x=fromPos.x+size,	y=fromPos.y,		z=fromPos.z, stackpos = STACKPOS_TOP_CREATURE}, 
		[2]={x=fromPos.x,	y=fromPos.y+size,	z=fromPos.z, stackpos = STACKPOS_TOP_CREATURE}, 
		[3]={x=fromPos.x-size,	y=fromPos.y,		z=fromPos.z, stackpos = STACKPOS_TOP_CREATURE}
	}
	return nPos[dir]
end

script:
Code:
-- Ex. If you will set it to 4000. then doors actionIds: NORTH = 4000, SOUTH = 4002, EAST = 4001, WEST = 4003
fromActionId = 4000

function onUse(cid, item, fromPosition, itemEx, toPosition)
	dir = item.actionid - fromActionId
	arenaPos = getNextPosFromDir(fromPosition, dir, 1)
	if getThingfromPos(arenaPos).uid ~= 0 then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Room is full.')
		doSendMagicEffect(getCreaturePosition(cid), 2)
	else
		--Something
	end
end
 

Similar threads

Back
Top