Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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!
Is it possible to make a teleport to check if there is only one player left in a area?
I mean like a arena, that you cant walk in the teleport until the other player is defeated..
i think maybe if u make a portal with no coordinates and then have a stepin script that checks for players in side an area and if the amount of players is less then 1 then you tp the player otherwise you get message you are still in a duel
-- Area iterator by Colandus @ ******.net
function mapArea(fromPos, toPos, stack)
local pos = {x=fromPos.x, y=fromPos.y-1, z=fromPos.z}
return function()
if (pos.y < toPos.y) then
pos.y = pos.y+1
elseif (pos.x <= toPos.x) then
pos.y = fromPos.y
pos.x = pos.x+1
else
pos.x = fromPos.x
pos.y = fromPos.y
pos.z = pos.z+1
end
if (pos.x <= toPos.x and pos.y <= toPos.y or pos.z < toPos.z) then
if (stack == nil) then
return pos
else
pos.stackpos = stack
return pos, getThingfromPos(pos).uid
end
end
end
end
PHP:
local fromPos = {x=x, y=y, z=z}
local toPos = {x=x, y=y, z=z}
for _, thing in mapArea(fromPos, toPos, 253) do
if isPlayer(thing.uid) == TRUE then
-- player found, now what?
return TRUE
end
end
-- no player was found, continue?
return TRUE
@Colandus:
Do that really check if there is only one? I mean it shall not possible to walk inside the teleport if there is two persons in the area, but it shall be possible if there is only one.