Jump to content

Time format


Tomc0

Recommended Posts

Hello guys, I need some help with one my scripts: I need a timer, that counts the playtime of the player.

So, if I have a code like that:

  
playTime = 0 
  
function updateTimer() 
   playTime = playTime + 1  
end 
  
setTimer(updateTimer,60000,0) 

How I can format the "playTime" variable like that: 1h,24m?

Because right now, I just have a variable like "81 minutes" what is lame as hell.

So can you guys help me with switching minutes to hours?

Yes, I know, I could do that like this:

if(playTime >= 60) then 
   playTime = "1h 0m"  
end 

But that's not good, because I can't do it forever.

So, thanks for the help!

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