MisterQuestions Posted October 27, 2014 Share 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? Link to comment
kevenvz Posted October 27, 2014 Share 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. Link to comment
rtx Posted October 27, 2014 Share 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) Link to comment
MisterQuestions Posted October 28, 2014 Author Share Posted October 28, 2014 But when player join again, the counter restarts... Link to comment
FatalTerror Posted October 28, 2014 Share Posted October 28, 2014 But when player join again, the counter restarts... Thats why you should use getRealTime instead. Link to comment
MisterQuestions Posted October 29, 2014 Author Share Posted October 29, 2014 But how to use it, Can you explain me please ? Link to comment
Castillo Posted October 30, 2014 Share Posted October 30, 2014 I think you could use the timestamp. Link to comment
MisterQuestions Posted December 20, 2014 Author Share Posted December 20, 2014 How to use it anyone? Link to comment
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