Jump to content

How to make a timer label?


Recommended Posts

@Raysmta, he may have misunderstood your question at first place. You should at least give him some respect for trying to help you.

And about your question, you may use:

  
setTimer 
getTimerDetails 
guiCreateLabel 

Set a timer using setTimer then get remaining time using getTimerDetails and then put that remaining time inside the guiCreateLabel function. Read about those function in the wiki and you will be done.

Hint:

  
timeRemaining, executesRemaining, totalExecutes = getTimerDetails(theTimer) -- Get the timers details 
  

Link to comment

the lazy way would probably be something like. there's probably a better way though. just trying to help you from top of my head

  
local countdown = 120 
local label = guiCreateLabel(pos, tostring(countdown), parent of) 
  
  
setTimer(function () 
    countdown = countdown - 1 
    if countdown >= 0 then 
        guiSetText(label, tostring(countdown)) 
    else 
        --you've reached 0! 
    end 
end, 120000, 1000) 
  
  

but you could work around

getTimerDetails 

to get the timeRemaining (in ms) - 1000 to get into seconds

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...