Jump to content

How to Make button Close works


Recommended Posts

Posted (edited)
function closeGUI ()
if (source == YOUR_GUI_BUTTON_ELEMENT) then
guiSetVisible ( YOURGUIWINDOW, false )
end
end
addEventHandler("onClientGUIClick",YOUR_GUI_BUTTON_ELEMENT,closeGUI,false)

Edited by Guest
Posted (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 by Guest
Posted

^^ where add

function closeGUI ()
if (source == YOUR_GUI_BUTTON_ELEMENT) then
guiSetVisible ( YOURGUIWINDOW, false )
end
end
addEventHandler("onClientGUIClick",YOUR_GUI_BUTTON_ELEMENT,closeGUI,false)

Posted
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)

Posted
thxx solid :D

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.

Posted
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.

Posted

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.

Posted
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)

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...