Moderators IIYAMA Posted April 4, 2013 Moderators Posted April 4, 2013 local confirmButton = guiCreateButton(5, 5, 90, 70, "SPAWN!", false, spawnConfirmWindow) addEventHandler("onClientGUIClick", confirmButton, spawnClientPlayer) destroyElement(confirmButton) Will the handler still be there? 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
Moderators IIYAMA Posted April 4, 2013 Author Moderators Posted April 4, 2013 Thank you! That was a fast answer 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
Booo Posted April 4, 2013 Posted April 4, 2013 function destroyElement(element) element = nil end تذكر عند تصفحك للأنترنت قوله تعالى: (( وهو معكم أين ما كنتم والله بما تعملون بصير )) ا
DiSaMe Posted April 4, 2013 Posted April 4, 2013 function destroyElement(element) element = nil end Makes no sense. Replaces destroyElement by a function which sets its own local variable to nil, therefore doing absolutely nothing. -
MR.S3D Posted April 5, 2013 Posted April 5, 2013 local confirmButton = guiCreateButton(5, 5, 90, 70, "SPAWN!", false, spawnConfirmWindow) addEventHandler("onClientGUIClick", confirmButton, spawnClientPlayer) destroyElement(confirmButton) Will the handler still be there? local confirmButton = guiCreateButton(5, 5, 90, 70, "SPAWN!", false, spawnConfirmWindow) addEventHandler("onClientGUIClick", confirmButton, spawnClientPlayer) --- if you need destroy removeEventHandler("onClientGUIClick", confirmButton, spawnClientPlayer) -- to remove this event destroyElement(confirmButton) -- then destroy element Welcom to my server Q.5 Current game type in my server Drift my Email : [email protected] Programming level: 90%
Moderators IIYAMA Posted April 5, 2013 Author Moderators Posted April 5, 2013 Now I get again two differed answers from two experienced posters........... (not me "Experienced"...) If I delete the element that is handled and after that I handle again, there won't be any errors. Is the handler gone from the previous element? grrrr I hate it when I can't see what happens..... 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
MR.S3D Posted April 5, 2013 Posted April 5, 2013 Now I get again two differed answers from two experienced posters...........(not me "Experienced"...) If I delete the element that is handled and after that I handle again, there won't be any errors. Is the handler gone from the previous element? grrrr I hate it when I can't see what happens..... Is the handler gone from the previous element? yes you should remove this handler then destroy element to prevent any errors Welcom to my server Q.5 Current game type in my server Drift my Email : [email protected] Programming level: 90%
Jaysds1 Posted April 5, 2013 Posted April 5, 2013 ok, either way the event handler would be destroyed, because for one, the element wouldn't exist anymore thus the event handler would be no use and wouldn't be triggered, and even if you remove the event handler, I think it would save some ram, but either way the event handler would be destroyed. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
MR.S3D Posted April 5, 2013 Posted April 5, 2013 ok, either way the event handler would be destroyed, because for one, the element wouldn't exist anymore thus the event handler would be no use and wouldn't be triggered, and even if you remove the event handler, I think it would save some ram, but either way the event handler would be destroyed. Great answer Welcom to my server Q.5 Current game type in my server Drift my Email : [email protected] Programming level: 90%
Moderators IIYAMA Posted April 5, 2013 Author Moderators Posted April 5, 2013 YES! thx guys. 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
Jaysds1 Posted April 6, 2013 Posted April 6, 2013 Np My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
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