AlexWo Posted March 19, 2014 Share Posted March 19, 2014 Hey I have a problem that my gui don't disapear when i click on the exit button Script(client): LSPolice = createMarker( 1554, -1675, 15.28, "cylinder", 1.5, 0, 0, 255) function MarkerHit ( hitPlayer, matchingDimension ) outputChatBox ( getPlayerName(hitPlayer) .. ", you entered the Police-Job Marker in LS", 255, 255, 0 ) local policeWindow = guiCreateWindow ( 0.25, 0.25, 0.4, 0.4, "Policejob LS", true ) local policePanel = guiCreateTabPanel ( 0, 0.1, 1, 1, true, policeWindow ) -- create a tab panel which fills the whole window local policeMap = guiCreateTab( "Job Information", policePanel ) guiCreateLabel(0.02, 0.04, 0.94, 0.2, "Welcome to the Police Department in Los Santos", true, policeMap) guiCreateLabel(0.02, 0.08, 0.94, 0.92, "Press 'Accept' to accept the Job and get your Equipment", true, policeMap) guiCreateLabel(0.02, 0.12, 0.94, 0.92, "Press 'Exit' to close this gui and exit", true, policeMap) exitbutton = guiCreateButton( 0.5, 0.5, 0.1, 0.05, "Exit", true, policeMap ) acceptbutton = guiCreateButton( 0.3, 0.5, 0.1, 0.05, "Accept", true, policeMap ) showCursor ( true ) end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) function wclose(state) if state == "left" then if source == exitbutton then guiSetVisible(policeWindow, false) showCursor(false) end end end addEventHandler("onClientGUIClick", getRootElement(), wclose) Would be pretty cool if somebody could help me Link to comment
cheez3d Posted March 19, 2014 Share Posted March 19, 2014 The policeWindow is only valid inside the first function as it is a local variable and I do NOT suggest making it a global variable. Try to rethink your functions. Link to comment
AlexWo Posted March 19, 2014 Author Share Posted March 19, 2014 Thanks for the very fast answer But what exactly will happen if I make it not "local"? Link to comment
Castillo Posted March 19, 2014 Share Posted March 19, 2014 That script will create the GUI everytime you hit the marker, so you should destroy these GUI elements once you click "Exit". 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