Jump to content

GUI close button problem


kuwalda

Recommended Posts

Hey, I have been trying to figure out why my close button isn`t working and still have not found anything. Maybe someone can spot where is my mistake?

  
function showRaceGUI ( message ) 
    local screenW, screenH = guiGetScreenSize() 
    raceInformation = guiCreateWindow((screenW - 447) / 2, (screenH - 412) / 2, 447, 412, "Race name", false) 
    GUIaizvert = guiCreateButton(23, 334, 400, 64, "Close", false, raceInformation) 
    showCursor(true) 
end 
  
--Closing button 
function close() 
    if source == GUIaizvert then 
        guiSetVisible(raceInformation,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick", GUIaizvert, close) 
  

Link to comment
  
--Closing button 
function close() 
    if source == GUIaizvert then 
        guiSetVisible(raceInformation,false) 
        showCursor(false) 
    end 
end 
addEventHandler("onClientGUIClick", GUIaizvert, close) 
  

addEventHandler('onClientGUIClick', getRootElement(), 
    function(button, state, absoluteX, absoluteY) 
        if(source == GUIaizvert)then 
            if(button == 'left') then 
            guiSetVisible(raceInformation,false) 
            showCursor(false) 
         end 
    end 
end) 

You had to check if the button was pressed

if(button == 'left') then 

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