OperatorMopa
Member
- Joined
- Feb 10, 2014
- Messages
- 127
- Reaction score
- 6
I have this code
What i wanna do is to send msg to all spectators of this position. How should i do it ?
Code:
local pos = Position(354, 123, 7)
local function showMsg(playerId, position)
local player = Player(playerId)
if player == nil then
print("player logged out")
return true
end
player:say('hello', TALKTYPE_MONSTER_SAY) -- it works
local spectators = Game.getSpectators(position, false, true, 3, 3) -- it doesn't work
for i = 1, #spectators do
player:say('hello', TALKTYPE_MONSTER_SAY, isInGhostMode, spectators[i], position)
end
end
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
addEvent(showMsg, 2000, player:getId(), pos)
end
What i wanna do is to send msg to all spectators of this position. How should i do it ?