Ulysses
General => Developers Corner => Topic started by: Digital Spit on June 13, 2014, 08:54:18 PM
-
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
-
Use hooks.
Playerjoin or connect or spawn.
I forget exactly which.
Timer would still be best for making sure players stayed long enough after joining though.
Really should figure out why you were getting the error.
-
Use hooks.
Playerjoin or connect or spawn.
I forget exactly which.
Timer would still be best for making sure players stayed long enough after joining though.
Really should figure out why you were getting the error.
Will do JamminR, thanks for the help!