TFS 1.2 Game.getSpectators

lazarus321

Member
Joined
May 8, 2017
Messages
114
Reaction score
11
Hi all,

I have a doubt, if I want to identify only 3 targets (can be player or show or both), within that table below how would I do?

local spectators = Game.getSpectators(Position(100, 100, 7), false, false, 5, 5, 5, 5)
for i = 1, #spectators do
local spectator = spectators
spectator:say(spectator:getName(), TALKTYPE_SAY)
end
 

StreamSide

Joseluis Gonzalez
Support Team
Joined
Aug 31, 2007
Messages
3,211
Reaction score
750
Location
Arica - Chile
you can break the loop or using another kind of loop

Lua:
local spectators = Game.getSpectators(Position(100, 100, 7), false, false, 5, 5, 5, 5)
for i = 1, #spectators do
    local spectator = spectators[i]
    spectator:say(spectator:getName(), TALKTYPE_SAY)
    if i == 3 then
        break
    end
end
 
Top