MisterQuestions Posted October 27, 2014 Posted October 27, 2014 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?
kevenvz Posted October 27, 2014 Posted October 27, 2014 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.
rtx Posted October 27, 2014 Posted October 27, 2014 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)
MisterQuestions Posted October 28, 2014 Author Posted October 28, 2014 But when player join again, the counter restarts...
FatalTerror Posted October 28, 2014 Posted October 28, 2014 But when player join again, the counter restarts... Thats why you should use getRealTime instead.
MisterQuestions Posted October 29, 2014 Author Posted October 29, 2014 But how to use it, Can you explain me please ?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now