Jump to content

Detect when 24 hours has gone


Xeno

Recommended Posts

How would I detect when 24 hours has gone? And I would also like to put this on a loop, so for example

--sets the 24 hour timer

--hits 00:00 GMT time

--ouputchatchat

--does it all again

How would I do this? I literally have no smegging clue.

Link to comment

try this:

local loopedTimer = nil 
  
function startLoopTimer(player,cmd) 
  if isTimer(loopedTimer) then  
    outputChatBox("Error - Timer already Active!",player,255,0,0) 
  else 
    loopedTimer = setTimer(twentyfourhours,86400000,0) 
    outputChatBox("24hr timer started",root,255,0,0) 
  end 
end 
addCommandHandler("startLoop",startLoopTimer) 
  
function twentyfourhours() 
  outputChatBox("24hour loop timer restarted",root,255,0,0) 
end 
  
function stopLoopTimer(player,cmd) 
  if isTimer(loopedTimer) then 
    killTimer(loopedTimer) 
  end 
end 
addCommandHandler("stopLoop",stopLoopTimer) 

this will start and run endlessly outputting every 24hrs

of course the 24hrs start when u start it, not at 00:00

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...