Turbe$Z Posted May 15, 2017 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 My Fun server: My DD server:
Turbe$Z Posted May 15, 2017 Author 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 My Fun server: My DD server:
#BrosS Posted May 15, 2017 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 “من أراد الفشل عليه بالنجاح”
Turbe$Z Posted May 15, 2017 Author Posted May 15, 2017 Just now, #BrosS said: replace 1000 with 1 cuz there no such thing but still not working My Fun server: My DD server:
#BrosS Posted May 15, 2017 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 “من أراد الفشل عليه بالنجاح”
Turbe$Z Posted May 15, 2017 Author 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 My Fun server: My DD server:
Dimos7 Posted May 15, 2017 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
#BrosS Posted May 15, 2017 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 “من أراد الفشل عليه بالنجاح”
Dimos7 Posted May 15, 2017 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
Turbe$Z Posted May 15, 2017 Author 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 My Fun server: My DD server:
Moderators IIYAMA Posted May 17, 2017 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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