Repeating Server Command

How would I make a function that would make the server console run a command every 300 seconds?
And in what folder would this go?

[lua]timer.Create(“MyTimer” , 300 , 0 , function() RunConsoleCommand(“mycommand” , “myarg1” , “myarg2”) end )[/lua]

lua/autorun/server

Ninja’d :ninja:

lua/autorun/server, also:

[lua]
local interval = 300
local times = 0 – 0 = infinite.

timer.Create(“RunMyFunction”, interval, times, function()
game.ConsoleCommand("mycommand argument
")
end)
[/lua]

You could even improve on it.

[lua]

local commands = {}
function util.RepeatCommand(cmd , delay , reps , args)
table.insert(commands , {command = cmd , del = delay , reps = reps , arguments = args})
end

hook.Add(“Think” , “utilRepeatCommandThink” , function()
for k , v in pairs(commands) do
if not v.LastRun then v.LastRun = 0 v.Repeats = 0 end
if not (v.LastRun > CurTime()) or (v.Repeats >= v.reps) then
game.ConsoleCommand(v.command , table.concat(v.arguments , " ")
v.Repeats = v.Repeats + 1
v.LastRun = CurTime() + v.delay
end
end
end[/lua]
Untested.