FlyingSpoon Posted October 28, 2014 Share Posted October 28, 2014 I don't know what's wrong but this should work, function openClose() regOn = guiCreateWindow(236, 410, 351, 110, "Register at our website!", false) guiWindowSetSizable(regOn, false) regNote = guiCreateLabel(15, 25, 317, 61, "Sorry, our server is currently under construction, however\nyou can apply online,\n\n[url=http://www.SoonAvailable.com]http://www.SoonAvailable.com[/url]", false, regOn) closeMe = guiCreateButton(300, 80, 42, 20, "Close", false, regOn) if bRegister then guiSetVisible( regOne, true) else if closeMe then guiSetVisible( regOne, false) end end end addEventHandler("onClientGUIClick", getRootElement(), openClose) When I click on the 'Register' button, that GUI appears however once I click 'Close' it don't go away? Why is this, I am sure it should work. Link to comment
Bonsai Posted October 28, 2014 Share Posted October 28, 2014 You are creating the elements on every click. You are also not checking which button was pressed. Just check the wiki for examples. Link to comment
-Blaze- Posted October 28, 2014 Share Posted October 28, 2014 function openClose() regOn = guiCreateWindow(236, 410, 351, 110, "Register at our website!", false) guiWindowSetSizable(regOn, false) regNote = guiCreateLabel(15, 25, 317, 61, "Sorry, our server is currently under construction, however\nyou can apply online,\n\n[url=http://www.SoonAvailable.com]http://www.SoonAvailable.com[/url]", false, regOn) closeMe = guiCreateButton(300, 80, 42, 20, "Close", false, regOn) if bRegister then guiSetVisible( regOne, true) else if closeMe then guiSetVisible( regOne, false) end end end addEventHandler("onClientGUIClick", getRootElement(), openClose) use if source == bRegister and elseif source == closeMe. Link to comment
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