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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Where Added ?

To your lua file...?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

share your code with us if you want ask us where to put code..

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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)

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

this is achieved with 4th argument (false) in addEventHandler. So again:

Source check is unneeded

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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.

Retired

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