Turbe$Z Posted May 15, 2017 Share Posted May 15, 2017 (edited) local countdown = 120 G3 = guiCreateLabel(0.49, 0.67, 0.03, 0.02, tostring(countdown).." mp", true) guiSetFont(G3, "default-bold-small") guiSetVisible(G3,false) addEventHandler("onClientGUIClick",root, function () if source == buttonGuest then removeEventHandler("onClientRender",root,a123) addEventHandler("onClientRender", root, dxhavendeg) guiSetVisible(buttonLogin,false) guiSetVisible(buttonRegister,false) guiSetVisible(buttonGuest,false) guiSetVisible(editPassword,false) guiSetVisible(editUsername,false) setTimer(function () countdown = countdown - 1 if countdown >= 0 then guiSetText(G3, tostring(countdown)) else outputChatBox("asd") end end, 120000, 1000) end end ) what wrong? Edited May 15, 2017 by Turbo777 Link to comment
Turbe$Z Posted May 15, 2017 Author Share Posted May 15, 2017 3 minutes ago, Dimos7 said: what exacly you want to do? when i click on the button, show and start the timer from 120 Link to comment
#BrosS Posted May 15, 2017 Share Posted May 15, 2017 (edited) 28 minutes ago, Turbo777 said: end, 120000, 1000) replace 1000 with 0 cuz there no such thing 0* Edited May 15, 2017 by #BrosS Link to comment
Turbe$Z Posted May 15, 2017 Author Share Posted May 15, 2017 Just now, #BrosS said: replace 1000 with 1 cuz there no such thing but still not working Link to comment
#BrosS Posted May 15, 2017 Share Posted May 15, 2017 Just now, Turbo777 said: but still not working setTimer(function () countdown = countdown - 1 if countdown >= 0 then guiSetText(G3, tostring(countdown)) else outputChatBox("asd") end end, 1000, 0) 1 Link to comment
Turbe$Z Posted May 15, 2017 Author Share Posted May 15, 2017 1 minute ago, #BrosS said: setTimer(function () countdown = countdown - 1 if countdown >= 0 then guiSetText(G3, tostring(countdown)) else outputChatBox("asd") end end, 1000, 0) the counter does not countdown sorry for my bad English:c Link to comment
Dimos7 Posted May 15, 2017 Share Posted May 15, 2017 local countdown = 120 G3 = guiCreateLabel(0.49, 0.67, 0.03, 0.02, tostring(countdown).." mp", true) guiSetFont(G3, "default-bold-small") guiSetVisible(G3,false) addEventHandler("onClientGUIClick",root, function (button, state) if button == "left"and state=="up" and source == buttonGuest then removeEventHandler("onClientRender",root,a123) addEventHandler("onClientRender", root, dxhavendeg) guiSetVisible(buttonLogin,false) guiSetVisible(buttonRegister,false) guiSetVisible(buttonGuest,false) guiSetVisible(editPassword,false) guiSetVisible(editUsername,false) setTimer(function () countdown = countdown - 1 if countdown >= 0 then guiSetText(G3, tostring(countdown)) else outputChatBox("asd") end end, 1000, 0) end end ) try see if that work 1 Link to comment
#BrosS Posted May 15, 2017 Share Posted May 15, 2017 4 minutes ago, Turbo777 said: the counter does not countdown sorry for my bad English:c no it's working and i just tested it try again with my code Link to comment
Dimos7 Posted May 15, 2017 Share Posted May 15, 2017 (edited) after change the code do a restart to the resource to see if it works Edited May 15, 2017 by Dimos7 1 Link to comment
Turbe$Z Posted May 15, 2017 Author Share Posted May 15, 2017 1 minute ago, Dimos7 said: after change the code do a restart to the resource to see if it works Working, thank you! 1 Link to comment
Moderators IIYAMA Posted May 17, 2017 Moderators Share Posted May 17, 2017 end, 1000, countdown) I do recommend this. There is no need for an infinity timer since you already know that it is going to stop at 0. 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