How to loop all players? - my code is not working
#1
Code:
function OnTick(TickTime)
    local ForEachPlayerTick = function(Player)
        Player:SendMessage("Player never recieves this message")
    end
end
Of course I have added hook
Code:
cPluginManager:AddHook(cPluginManager.HOOK_TICK, OnTick);
but it is not working.
Console is not giving any error.
Thank you very much! Big Grin
Reply
Thanks given by:
#2
The reason it's not working is because all you're doing is declaring a variable named 'ForEachPlayerTick' and putting a function in it. To execute it you have to call 'cRoot:Get():ForEachPlayer(ForEachPlayerTick)'
Reply
Thanks given by: _XxFedexX_




Users browsing this thread: 1 Guest(s)