☠ RaZeR ☠ Posted February 6, 2016 Share Posted February 6, 2016 (edited) i want to reset the countdown by button # and the " if " in line 12 | didnt work >> check if the window visble then start contdown !! the countdown start after the resource start local countdownMS = getTickCount() + 350000 function getTimeMS(ms) local minutes = math.floor(ms/60000) ms = ms - minutes * 60000 local seconds = math.floor(ms/1000) return minutes,seconds end ----------- setTimer (function() if ( guiGetVisible ( idlewind ) == true ) then local m,s = getTimeMS(countdownMS-getTickCount()) guiSetText( timer, " Minutes: "..m.." | Seconds:"..s ); end end, 1000, 0 ) Edited February 6, 2016 by Guest Link to comment
Bonus Posted February 6, 2016 Share Posted February 6, 2016 I don't really understand what you want. If you want the countdown to start after opening the GUI, why do you put countdownMS there and don't put the setTimer in the function, which opens the GUI? If you want to reset the countdown just use countdownMS = getTickCount() + 350000 again Link to comment
☠ RaZeR ☠ Posted February 6, 2016 Author Share Posted February 6, 2016 want the countdown to start after opening the GUI ------ want to reset the countdown Link to comment
☠ RaZeR ☠ Posted February 6, 2016 Author Share Posted February 6, 2016 I don't really understand what you want.If you want the countdown to start after opening the GUI, why do you put countdownMS there and don't put the setTimer in the function, which opens the GUI? If you want to reset the countdown just use countdownMS = getTickCount() + 350000 again setTimer (function() if ( guiGetVisible ( idlewind ) == true ) then local countdownMS = getTickCount() + 350000 <<<<<<<<<<<<<<< local m,s = getTimeMS(countdownMS-getTickCount()) guiSetText( timer, " Minutes: "..m.." | Seconds:"..s ); end end end, 1000, 0 ) Link to comment
Bonus Posted February 6, 2016 Share Posted February 6, 2016 local countdownMS = false setTimer ( function() if guiGetVisible ( idlewind ) then if not countdownMS then countdownMS = getTickCount() + 350000 end local m,s = getTimeMS(countdownMS-getTickCount()) guiSetText( timer, " Minutes: "..m.." | Seconds:"..s ); else countdownMS = false -- if you wanna stop the countdown when gui is closed. end end, 1000, 0 ) And just use countdownMS = getTickCount() + 350000 again to reset the Countdown. 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