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

Lua [1.4.2] Rewrite Teleport on range.

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Hi!
I have problem with rewrite this script to TFS 1.4.2.
On 0.3.7 all working perfect.
This is globalevent.

Lua:
    local teleport = {x = 607, y = 873, z = 4}
    function onThink(interval, lastExecution)
        for _, cid in ipairs(getPlayersOnline()) do
            if isInRange(getPlayerPosition(cid), {x = 598, y = 872, z = 5}, {x = 615, y = 897, z = 10}) and getPlayerLevel(cid) > 200 then
                doTeleportThing(cid, teleport)
                doPlayerSendCancel(cid, "Teleported!")
            end
         end
     return true
end
 
Lua:
function onThink(interval, lastExecution)
    local teleport = Position(607, 873, 4)
    local players = getPlayersOnline()
    local cid = players[math.random(1,#players)]
    local player = Player(cid)
       
    for _, cid in ipairs(players) do
        if isInRange(getPlayerPosition(cid), {x = 598, y = 872, z = 5}, {x = 615, y = 897, z = 10}) and getPlayerLevel(cid) > 200 then
            player:teleportTo(teleport)
            doPlayerSendCancel(cid, "Teleported!")
        end
    end
    return true
end
 
Last edited:
Back
Top