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

How to check if player entered in teleport?

vexler222

Active Member
Joined
Apr 22, 2012
Messages
714
Solutions
15
Reaction score
46
Hi, i wanna create teleport for max 10 players but idk how to check if player entred in, and set limit to 9 if next player entered, set limit to 8 ...
Something like a zombie event teleport

Someone can help me? :) TFS 0.4
 
Instead of simply putting in a tp with coordinates, create moveevent with onstepin, which would increase some counter (global storage?) each time someone enters. And when enough players enter tp, you can block access to tp for all others.
 
You can also scan the whole area the players are supposed to be teleport to.
Code:
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
 
Back
Top