• What would be the best way of doing this?
    3 replies, posted
I need to make a timer that times a week then runs a line of code I was thinking of using timer but every time the server restarts the timer would restart, any ideas?
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cookie/Set]cookie.Set[/url] stores a value in the SQLite database of the server, assuming you run it server side. When you do the thing, cookie.Set( "MyCookieName", os.time() ). You should probably do it in an infinitely repeating [url=http://wiki.garrysmod.com/page/timer/Create]timer[/url], probably a 10 minute one is enough for an entire week. Compare os.time() with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cookie/GetNumber]cookie.GetNumber[/url] of your cookie.
A cheap and nasty method would be to have a cron job at the OS level run a command (possibly through RCon) that triggers the event.
Okay, I didn't really think of those thanks guys for you help.
Sorry, you need to Log In to post a reply to this thread.