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

[Request] Door script which allows 1 player only in room

YugiNao

Banned User
Joined
Nov 22, 2008
Messages
211
Reaction score
3
Need a door script when a player is already in the room another player cant in max is 1 when second player try to enter Door pop-up's a message and say in a Orange text You cant enter here, There is already another player in the room!. :thumbup:
 
this script doesn't work.

LUA:
local posit= {{x=3,y=4},{x=65,y=54},7}; -- {{Topx, Topy},{Bottomx,Bottomy},zFloor};
local isPla = false;
function onUse(cid, item, fromPosition, itemEx, toPosition)
        for areax = posit[1].x, posit[2].y do --Don't remember if in Lua Table starts at 1;
                for areay = posit[1].y,  posit[2].y do
					local areaCreature = getThingFromPos({x=areax,y=areay,z=posit[3]});
					if(isPlayer(areaCreature.uid)) then
						isPla=true;
						[B][COLOR="Red"]break[/COLOR][/B];
					end
                end
		end 
		if(not isPla)
			doTeleportThing(cid, toPosition);
		else
			doCreatureSay(cid, "You cant enter here, There is already another player in the room!", TALKTYPE_ORANGE_1);
		end
	return true;
end
ugh
 
@up? What's a point continuing loop when a player found in room?

@wesoly.

IT check only 1st sqm, and if somebody it there u get message and loop continues. If nobody is on 1st time, but somewhere else in room it allows player enter.
 
Back
Top