Sigoles
Discord: @sigoles
- Joined
- Nov 20, 2015
- Messages
- 1,209
- Solutions
- 2
- Reaction score
- 154
Is there any way to optimize this script? I'm thinking it can cause a lot of lag ... It's an immense area with multiple floors
tfs 1.3
tfs 1.3
LUA:
function onTime(interval)
-- remove all from multifloors
local spec = getSpectators({x = 30443, y = 32336, z = 4}, 7, 20)
if spec ~= nil then
for _, s in pairs(spec) do
if isPlayer(s) then
doTeleportThing(s, getTownTemplePosition(getPlayerTown(s)))
end
end
end
local spec2 = getSpectators({x = 30463, y = 32336, z = 5}, 25, 35)
if spec2 ~= nil then
for _, a in pairs(spec2) do
if isPlayer(a) then
doTeleportThing(a, getTownTemplePosition(getPlayerTown(a)))
end
end
end
local spec3 = getSpectators({x = 30222, y = 32326, z = 5}, 91, 76)
if spec3 ~= nil then
for _, b in pairs(spec3) do
if isPlayer(b) then
doTeleportThing(b, getTownTemplePosition(getPlayerTown(b)))
end
end
end
local spec4 = getSpectators({x = 30447, y = 32336, z = 6}, 50, 85)
if spec4 ~= nil then
for _, c in pairs(spec4) do
if isPlayer(c) then
doTeleportThing(c, getTownTemplePosition(getPlayerTown(c)))
end
end
end
local spec5 = getSpectators({x = 30202, y = 32329, z = 6}, 135, 110)
if spec5 ~= nil then
for _, d in pairs(spec5) do
if isPlayer(d) then
doTeleportThing(d, getTownTemplePosition(getPlayerTown(d)))
end
end
end
local spec6 = getSpectators({x = 30158, y = 32314, z = 7}, 70, 78)
if spec6 ~= nil then
for _, e in pairs(spec6) do
if isPlayer(e) then
doTeleportThing(e, getTownTemplePosition(getPlayerTown(e)))
end
end
end
local spec7 = getSpectators({x = 30323, y = 32328, z = 7}, 54, 78)
if spec7 ~= nil then
for _, f in pairs(spec7) do
if isPlayer(f) then
doTeleportThing(f, getTownTemplePosition(getPlayerTown(f)))
end
end
end
local spec8 = getSpectators({x = 30463, y = 32336, z = 7}, 65, 125)
if spec8 ~= nil then
for _, g in pairs(spec8) do
if isPlayer(g) then
doTeleportThing(g, getTownTemplePosition(getPlayerTown(g)))
end
end
end
local spec9 = getSpectators({x = 30235, y = 32346, z = 8}, 52, 105)
if spec9 ~= nil then
for _, h in pairs(spec9) do
if isPlayer(h) then
doTeleportThing(h, getTownTemplePosition(getPlayerTown(h)))
end
end
end
local spec10 = getSpectators({x = 30351, y = 32347, z = 8}, 70, 74)
if spec10 ~= nil then
for _, i in pairs(spec10) do
if isPlayer(i) then
doTeleportThing(i, getTownTemplePosition(getPlayerTown(i)))
end
end
end
local spec11 = getSpectators({x = 30458, y = 32343, z = 8}, 59, 129)
if spec11 ~= nil then
for _, j in pairs(spec11) do
if isPlayer(j) then
doTeleportThing(j, getTownTemplePosition(getPlayerTown(j)))
end
end
end
local spec12 = getSpectators({x = 30481, y = 32361, z = 9}, 44, 66)
if spec12 ~= nil then
for _, k in pairs(spec12) do
if isPlayer(k) then
doTeleportThing(k, getTownTemplePosition(getPlayerTown(k)))
end
end
end
return true
end