John_Scott Posted November 8, 2014 Share Posted November 8, 2014 Hi! I have a problem with a timer funtcion. I would like to call the main function more thank 1 time, and the timer inside the main function can count only once. Code: function drawKillingText() if (text) then local screenW, screenH = guiGetScreenSize() dxDrawText ( text, screenW / 2, 100, screenWidth, screenHeight, tocolor(255, 255, 255, 255), 2, "arial", "center", "center", true, false, false, true ) setTimer (function() text = "" end, 1250, 1 ) end end addEventHandler ( "onClientRender", root, drawKillingText ) So, when the dxDraw text shows up for 1250ms the timer function reset that, but if I call the function agait, the timer can't start. How can I do this? Exit from the function, or reset the timer? Thanks for helping! Link to comment
Enargy, Posted November 8, 2014 Share Posted November 8, 2014 why 'setTimer' inside of 'onClientRender'? Link to comment
John_Scott Posted November 8, 2014 Author Share Posted November 8, 2014 NearGreen said: why 'setTimer' inside of 'onClientRender'? You're right, it was the problem. Thank you! 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