• Run command at specific time
    3 replies, posted
I was wondering what the best way would be to run a command at a specific time. I was considering having an infinite loop that checks constantly but this doesn't seem like a good idea.
You can (it isn't a full list) timer.Create Loop of timer.Simple Hooks with os.time cooldowns
I want to run an action once per day just after 8:30 PM; would this work? local function checkTime()     if (os.date("%H") = "20") and tonumber(os.date("%M")) >= 30 and tonumber(os.date("%M")) <= 35 then         -- Perform action         timer.Stop("830Timer")         timer.Create("RestartTimer", 1000, 1, function() timer.Start("830Timer") end) end hook.Add( "Initialize", "Start Timer", function() timer.Create( "830Timer", 60, 0, checkTime ) end)
As an option You can get distance between os.time and next 8:30 and set first timer.
Sorry, you need to Log In to post a reply to this thread.