EASY LITTLE JOB For LUA Coder. Looking for a simple timer.

I would like a simple code for my sandbox server if someone would be kind enough to make it:

Every 25 minutes, I would like a server cleanup to occur using this command: gmod_admin_cleanup
BEFORE this happens (15 seconds before), I would like this command to run: ulx csay Server cleanup in 15 seconds!

If you feel I am ignorant, please feel free to give me a little lesson on what went on in this code. I’d love to learn!
Thank you very much!

I’ll teach you to write this. It will be pretty easy.

[editline]28th January 2013[/editline]

local delay = 1500
local subDelay = 15
function serverCleanup()
game.ConsoleCommand(“ulx csay Server cleanup in 15 seconds!”)
timer.Simple(subDelay, function() game.ConsoleCommand(“gmod_admin_cleanup”) end)
timer.Create(“Cleanup”, delay, 0, serverCleanup)

Timers are fairly simple. In this little bit of code we have 2 timers.
The continuous one:
timer.Create(“Cleanup”, delay, 0, serverCleanup)
Where “cleanup” is the identifying string,
delay is how long it waits before executing the callback function (serverCleanup),
and 0 is how many iterations it will run (0 = infinite).
In summary this timer will run forever and every 25 min or 1500 seconds it will call the serverCleanup() function.

The simple timer:
timer.Simple(subDelay, function() game.ConsoleCommand(“gmod_admin_cleanup”) end)
Has no identifier or iteration variable because it is only run once.
Simply a delay and a callback function.
In summary after the serverCleanup() function is called the warning is given and this timer is created. This timer will run the console command after 15 seconds.

I hope that helps, also i never tested the code but unless I made some blatant error you should be fine.

I’ll make it for you.