I was messing around with ways to reward players for staying in game and helping us reach our goal of reaching our player cap.
How can I get this to run automatically? I originally had it in a timer to run every 4 minutes, but I was receiving lua errors (though it would run fine)
My question is how can I get this to run without locking it into a timer?
local Players = player.GetAll()
for i = 1, table.Count(Players) do
local ply = Players[i]
if table.Count(Players) <= 5 then
ply:addMoney( 150 )
ply:ChatPrint( "[TPG] " .. i .. "/40 players connected - initializing cash give-away.")
elseif table.Count(Players) >= 20 then
ply:addMoney( 200 )
ply:ChatPrint( "[TPG] " .. i .. "/40 players connected - initializing cash give-away.")
elseif table.Count(Players) >=30 then
ply:addMoney( 250 )
ply:ChatPrint( "[TPG] " .. i .. "/40 players connected - initializing & upgrading cash give-away.")
elseif table.Count(Players) == 40 then
ply:addMoney(300)
ply:ChatPrint( "[TPG] " .. i .."/40 players connected - initializing & upgrading cash give-away.")
end
end