WiBox Posted May 29, 2018 Share Posted May 29, 2018 (edited) For use as Help please? I was trying but I don't got a idea from where i start outputChatBox("......., Time left:"..Time1.. "seconds.", localPlayer, 255, 255, 0) time which I need is 1 hour ( 3600 seconds ) I need that the time left will be 1 hour and each each 5 minutes I made it appear my only problem i need the time left to work, I don't know the basics of make how much time left... I appreciate who help. Edited May 29, 2018 by SSKE Link to comment
Awang Posted May 29, 2018 Share Posted May 29, 2018 (edited) You should use setTimer(), set 5 minute to execute and make a recursive algorithm with an outside counter. If the counter reach the 12 value, it means you reach the 1 hour... And you can decrease your variable in each loop and write out into the chat... Edited May 29, 2018 by Awang Link to comment
WiBox Posted May 29, 2018 Author Share Posted May 29, 2018 (edited) What I mean example: Time left is 12300 second! after 2300 seconds.. Time left is 10000 second! that what I don't know the basics or what the command for use.. And if you can make it or make a example I'll appreciate that. Edited May 29, 2018 by SSKE Link to comment
Awang Posted May 29, 2018 Share Posted May 29, 2018 (edited) local Timer = 12300 function timer() setTimer(function() if Timer <= 0 then Timer = Timer-2300 outputChatBox("Time is:".. Timer) timer() end end, 2300,1) end Thats what you can do with setTimer() Edited May 29, 2018 by Awang Link to comment
WiBox Posted May 29, 2018 Author Share Posted May 29, 2018 Thanks, I'll try it, what I'm doing is a event, each 1 hour it will be auto-started, so I made every 5 minutes it will appear a message for they know which time left for the event start, i need a way to they know how much remain so the event starts. I appreciate you're help Link to comment
WiBox Posted May 29, 2018 Author Share Posted May 29, 2018 (edited) Sorry for asking but can you fix this coding? local Time1 = 3600000 function a( plr ) function timer() setTimer(function() if Time1 >= 0 then Time1 = Time1-600000 for _, in ipairs () do outputChatBox("The event will start every hour once. TimeLeft:"..Time1" Seconds.", localPlayer, 0, 255, 0) timer() end end end, 600, 1 ) end addEventHandler("onResourceStart", root, timer ) end Edited May 29, 2018 by SSKE Link to comment
AHMED MOSTAFA Posted May 29, 2018 Share Posted May 29, 2018 35 minutes ago, SSKE said: Sorry for asking but can you fix this coding? local Time1 = 3600000 function a( plr ) function timer() setTimer(function() if Time1 >= 0 then Time1 = Time1-600000 for _, in ipairs () do outputChatBox("The event will start every hour once. TimeLeft:"..Time1" Seconds.", localPlayer, 0, 255, 0) timer() end end end, 600, 1 ) end addEventHandler("onResourceStart", root, timer ) end write debugscript 3 in the console panel to see your errors and try to fix it by yourself first Link to comment
WiBox Posted May 29, 2018 Author Share Posted May 29, 2018 (edited) Oh thanks! Edited May 29, 2018 by SSKE 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