Saudi Server Posted August 18, 2010 Posted August 18, 2010 hello how r u pls How to Make button Close works i am created windows , images and button close but not work close ^^ http://img842.imageshack.us/img842/110/98979157.jpg I'm waiting for your help
Castillo Posted August 18, 2010 Posted August 18, 2010 (edited) function closeGUI () if (source == YOUR_GUI_BUTTON_ELEMENT) then guiSetVisible ( YOURGUIWINDOW, false ) end end addEventHandler("onClientGUIClick",YOUR_GUI_BUTTON_ELEMENT,closeGUI,false) Edited August 18, 2010 by Guest
dzek (varez) Posted August 18, 2010 Posted August 18, 2010 share your code with us if you want ask us where to put code..
Saudi Server Posted August 18, 2010 Author Posted August 18, 2010 (edited) ok code lua : GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(107,86,630,459,"saudi ! ~",false) GUIEditor_Image[1] = guiCreateStaticImage(67,31,516,380,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,395,119,55,"Close",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") Edited August 18, 2010 by Guest
Saudi Server Posted August 18, 2010 Author Posted August 18, 2010 ^^ where add function closeGUI () if (source == YOUR_GUI_BUTTON_ELEMENT) then guiSetVisible ( YOURGUIWINDOW, false ) end end addEventHandler("onClientGUIClick",YOUR_GUI_BUTTON_ELEMENT,closeGUI,false)
Castillo Posted August 18, 2010 Posted August 18, 2010 GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(107,86,630,459,"saudi ! ~",false) GUIEditor_Image[1] = guiCreateStaticImage(67,31,516,380,"",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,395,119,55,"Close",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[1],"clear-normal") function closeGUI () if (source == GUIEditor_Button[1]) then guiSetVisible ( GUIEditor_Window[1], false ) end end addEventHandler("onClientGUIClick",GUIEditor_Button[1],closeGUI,false)
Saudi Server Posted August 18, 2010 Author Posted August 18, 2010 thxx solid But does not appear the mouse pointer and I want it begins with the start server
Castillo Posted August 18, 2010 Posted August 18, 2010 thxx solid But does not appear the mouse pointer and I want it begins with the start server Do you know about something called "mta wiki"? well there you can find showCursor function and check how it works.
Saudi Server Posted August 18, 2010 Author Posted August 18, 2010 ok thxx man I will never forget kindness
Castillo Posted August 18, 2010 Posted August 18, 2010 the source check is unneeded I've had problems before thats why i added it, like i click on any gui part not the element i want and it executes the function.
dzek (varez) Posted August 18, 2010 Posted August 18, 2010 this is achieved with 4th argument (false) in addEventHandler. So again: Source check is unneeded
Callum Posted August 18, 2010 Posted August 18, 2010 I find a more efficient way is; addEventHandler("onClientGUIClick",GUIEditor_Button[1],function() guiSetVisible(GUIEditor_Window[1],false) end,false) Add that right below the line of code on which the button is created.
50p Posted August 19, 2010 Posted August 19, 2010 I find a more efficient way is; addEventHandler("onClientGUIClick",GUIEditor_Button[1],function() guiSetVisible(GUIEditor_Window[1],false) end,false) Add that right below the line of code on which the button is created. Even more efficient way: addEventHandler("onClientGUIClick",GUIEditor_Button[1],function() guiSetVisible(source,false) end,false)
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