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.
And there's my function
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