Jump to content

How to Make button Close works


Recommended Posts

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 by Guest
Link to comment
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)

Link to comment
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)

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...