local topLeft = {x = ??, y = ??, z = ??} --top-left-corner of the room that players are teleported to
local bottomRight = {x = ??, y = ??, z = ??} --bottom-right-corner of the room that players are teleported to JUST MAKE SURE THAT TOP LEFT AND BOT RIGHT HAVE LOWEST AND HIGHEST Z COORDINATE (if topleft have lowest then bottomright should be highest)
local destinationPos = {x = ??, y = ??, z = ??}
local count = 0 -- dont change
maxPlayers = 10 --how many players can enter
for z = topLeft.z, bottomRight.z do
for x = topLeft.x, bottomRight.x do
for y = topLeft.y, bottomRight.x do
for f = 1, maxPlayers do
local whatisit = getTopCreature({x=x,y=y,z=z, stackpos = f+1}).uid
if isPlayer(whatisit) == TRUE then
count=count+1
end
end
end
end
end
if count >= 10 then
doPlayerSendCancel(cid, "You shall not pass!")
return false
else
doTeleportThing(cid, destinationPos)
end