Jump to content

Make a countdown?


Recommended Posts

Posted

Hey can somebody help me? How can i make a coutdown, Not a simple race countdown

A countdown of days, hours, minutes, seconds, miliseconds?

Can some body help me?

I want to draw a text ("dxDrawText") with the countdown.

But how?

"El conocimiento jamás debe detenerse, por que es lo único que nos salvará cuando no nos quede más".

Att: -|TG|-Mister[Q]<.

Posted
local countdownMS = getTickCount() + 86400000 
  
function getTimeMS(ms) 
    local hours = math.floor(ms/3600000) 
    ms = ms - hours * 3600000 
    local minutes = math.floor(ms/60000) 
    ms = ms - minutes * 60000 
    local seconds = math.floor(ms/1000) 
    return hours,minutes,seconds 
end 
addEventHandler("onClientRender",root,function() 
    local h,m,s = getTimeMS(countdownMS-getTickCount()) 
    dxDrawText("Hours: "..h.." Minutes: "..m.." Seconds:"..s,100,100) 
end) 

I think this should be what you mean, haven't tested it so it might contain buggs.

Posted

Use 'getRealTime()' otherwise 'getTickCount()' would return the machine's runtime. (That would work just fine if you want the countdown to be relative to player's joining)

signatures.php?user=TIM3&combo=69&bg=1

Posted

I think you could use the timestamp.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • 1 month later...

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