I'm trying to make a gamemode using this code
[CODE]if table.Count(player.GetAll()) == 1 then
timer.Create( "RoundTimer", 30, 0, function() print("Round Timer Started") game.CleanUpMap( false ) ply:PrintMessage( HUD_PRINTTALK, "Map Reset") end )
end
[/CODE]
The timer never triggers and I'm guessing it's because of the table.Count(player.GetAll()) Any help in solving this problem would be greatly appreciated.
You could just do
I would advise changing it from == 1 to > 1 because if there are more then 1 player on then the code won't run.
[CODE] if (#player.GetAll() > 0) then --code
end [/CODE]
When is it called?
You must run this code in the some hook or timer, because them runing only once on script loading
[CODE]if #player.GetAll() == 1 then
timer.Create( "RoundTimer", 30, 0, function()
print("Round Timer Started")
game.CleanUpMap( false )
end)
end
local plys = player.GetAll()
for i = 1, #plys do
local ply = plys[i]
ply:PrintMessage( HUD_PRINTTALK, "Map Reset")
end[/CODE]
Sorry, you need to Log In to post a reply to this thread.