Hugos Posted June 14, 2019 Share Posted June 14, 2019 I have such a function: function btn_edit(button) if button == "left" then name = guiCreateEdit(0, 0, 0, 0, "", false) setTimer(function() dxDrawText(guiGetText(name), 455, 316, 690, 346, tocolor(255, 255, 255), 1, Font13, "left", "center", clip, wordBreak, true) guiFocus(name) guiSetAlpha(name, 0) guiEditSetMaxLength(name, 32) end, 1, 0) end end ( addEventHandler("onClientGUIClick", btn, btn_edit) ) Does not work "removeEventHandler". In another function, when I click I hide all the specified functions except this one. I can't understand why she's not hiding. Help, please! Link to comment
Scripting Moderators ds1-e Posted June 14, 2019 Scripting Moderators Share Posted June 14, 2019 (edited) 6 minutes ago, Hugos said: I have such a function: function btn_edit(button) if button == "left" then name = guiCreateEdit(0, 0, 0, 0, "", false) setTimer(function() dxDrawText(guiGetText(name), 455, 316, 690, 346, tocolor(255, 255, 255), 1, Font13, "left", "center", clip, wordBreak, true) guiFocus(name) guiSetAlpha(name, 0) guiEditSetMaxLength(name, 32) end, 1, 0) end end ( addEventHandler("onClientGUIClick", btn, btn_edit) ) Does not work "removeEventHandler". In another function, when I click I hide all the specified functions except this one. I can't understand why she's not hiding. Help, please! Any errors/warnings? Show removeEventHandler line. Edited June 14, 2019 by majqq Link to comment
Hugos Posted June 14, 2019 Author Share Posted June 14, 2019 6 minutes ago, majqq said: Any errors/warnings? Show removeEventHandler line. I use: removeEventHandler("onClientGUIClick", btn, btn_edit) But the function and the text is not hiding Link to comment
Scripting Moderators ds1-e Posted June 14, 2019 Scripting Moderators Share Posted June 14, 2019 3 minutes ago, Hugos said: I use: removeEventHandler("onClientGUIClick", btn, btn_edit) But the function and the text is not hiding I believe that's happening because timer is going all the time, removing event handler doesn't make that timer will be destroyed. Timer is set for 1 ms interval, and unlimited times to execute. https://wiki.multitheftauto.com/wiki/SetTimer Try to assign timer to variable, and kill it after removing event handler, with: https://wiki.multitheftauto.com/wiki/KillTimer 1 Link to comment
Hugos Posted June 14, 2019 Author Share Posted June 14, 2019 33 minutes ago, majqq said: I believe that's happening because timer is going all the time, removing event handler doesn't make that timer will be destroyed. Timer is set for 1 ms interval, and unlimited times to execute. https://wiki.multitheftauto.com/wiki/SetTimer Try to assign timer to variable, and kill it after removing event handler, with: https://wiki.multitheftauto.com/wiki/KillTimer Oh, Thank! 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