• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[REQUEST - TFS 1.2] Game.getSpectators

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hello, I was thinking in a script but I don't know how to it using Game.getSpectators.. It must to be something like, if you use the item and you're into position (Top left: 1, 2, 7 - Botton right: 3, 4, 7) or (Top left: 5, 6, 7 - Botton right: 7, 8, 7) then will happens an action. How to do it?

Thanks
 
Last edited:
I have some function here:
Code:
local spectators = Game.getSpectators(Position(xxx, 31883, 8), false, false, 4, 4, 4, 4)  -- the position is the center this, 4, 4, 4, 4 is the amout of sqm's i'm not sure about it, 
    for i = 1, #spectators do
        local spectator = spectators[i]
        if spectator:isPlayer() then
            spectator:SOMEFUNCTION
        end
    end
 
I have some function here:
Code:
local spectators = Game.getSpectators(Position(xxx, 31883, 8), false, false, 4, 4, 4, 4)  -- the position is the center this, 4, 4, 4, 4 is the amout of sqm's i'm not sure about it,
    for i = 1, #spectators do
        local spectator = spectators[i]
        if spectator:isPlayer() then
            spectator:SOMEFUNCTION
        end
    end

instead of using
Code:
spectator:isPlayer()
Look at this :
Code:
getSpectators(position[, multifloor = false[, onlyPlayer = false[, minRangeX = 0[, maxRangeX = 0[, minRangeY = 0[, maxRangeY = 0]]]]]])

onlyPlayer = true, may do so.
 
Back
Top