• 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 TFS Teleport players from area script problem

clouf

Member
Joined
Jul 5, 2012
Messages
157
Reaction score
23
Hello everyone, I using TFS 0.4 and my problem is when i using this script everyone online player get teleport to position c instead of only players who are in indicated area.

Code:
-- Talkaction: Teleport all player's from Area to Position --
local t = {
    a = {x=874, y=769, z=6}, -- top left corner
    b = {x=884, y=775, z=7}, -- bottom right corner
    c = {x=879, y=773, z=7} -- where to teleport
    }


function onSay(cid, words, param, channel)
    for _, pid in ipairs(getPlayersOnline()) do
        if isInRange(getCreaturePosition(pid), t.a, t.b) then
            doTeleportThing(pid, t.c)
        end
    end
end

And there's my function
Code:
function isInRange(position, fromPosition, toPosition)
    return (position.x >= fromPosition.x and position.y >= fromPosition.y and position.z >= fromPosition.z and position.x <= toPosition.x and position.y <= toPosition.y and position.z <= toPosition.z)
end
 
Back
Top