everlastroleplay Posted August 30, 2014 Share Posted August 30, 2014 function dxGui() if ( addEventHandler("onClientRender",root,versionSys) == true ) then guiSetVisible ( closebtn, true ) showCursor ( true ) else removeEventHandler("onClientRender",root,dxWindow) guiSetVisible ( closebtn, false ) showCursor ( false ) end end addCommandHandler("test", dxGui) closebtn = guiCreateButton(475, 377, 65, 23, "", false) guiSetAlpha(closebtn, 0.17) function versionSys() dxDrawRectangle(228, 242, 327, 163, tocolor(52, 154, 202, 154), false) dxDrawRectangle(227, 241, 329, 28, tocolor(0, 0, 0, 255), false) dxDrawRectangle(228, 242, 327, 26, tocolor(52, 154, 202, 234), false) dxDrawRectangle(474, 376, 67, 25, tocolor(0, 0, 0, 255), false) dxDrawRectangle(475, 377, 65, 23, tocolor(52, 154, 202, 255), false) dxDrawText("Close", 494, 379, 526, 394, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false) dxDrawText("Server Information", 331, 246, 517, 269, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) dxDrawText("Script Version : EG:RP v1.0\nServer Owner : Sebastian Martin Drake\n\nWebsite : [url=http://www.everlastroleplay.info]www.everlastroleplay.info[/url]\nServer IP : [url=mtasa://192.99.250.12:22003]mtasa://192.99.250.12:22003[/url]", 240, 279, 477, 369, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) dxDrawText("Created By Z3R0 © EG:RP", 240, 379, 341, 404, tocolor(255, 255, 255, 255), 1.00, "clear", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender",root,versionSys) addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()), function ( ) if (source == closebtn) then destroyElement(versionSys) destroyElement(closebtn) end end ) Everything appears fine but when i press the close btn it don't close. Link to comment
xXMADEXx Posted August 30, 2014 Share Posted August 30, 2014 You never added the onClientGUIClick event. Link to comment
everlastroleplay Posted August 30, 2014 Author Share Posted August 30, 2014 I did, The problem was that I missed out removeEventHandler. Link to comment
Et-win Posted September 1, 2014 Share Posted September 1, 2014 I would just make 1 function with 1 event handler for all buttons, then you don't have to add/remove it constantly 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