manve1 Posted August 13, 2012 Share Posted August 13, 2012 Everywhere i click on my GUI, it closes it, and idk whats the problem with the script: CLIENT: gui = guiCreateStaticImage(0,0,0.6,0.593,"images/gui.png", true) button_exit = guiCreateStaticImage(0.93,0.015,0.05,0.05,"images/exit.png",true,gui) button_maximize = guiCreateStaticImage(0.87,0.015,0.05,0.05,"images/maximize.png",true,gui) button_minimize = guiCreateStaticImage(0.81,0.015,0.05,0.05,"images/minimize.png",true,gui) button_house = guiCreateStaticImage(0.02,0.015,0.212,0.049,"images/house.png",true,gui) function showGUI2() guiSetVisible(gui,true) showCursor(true) end addEvent("showGUI2",true) addEventHandler("showGUI2", getRootElement(), showGUI2) function hideGUI2() if (button_exit) then guiSetVisible (gui,false) showCursor(false) end end addEvent("hideGUI2",true) addEventHandler("hideGUI2", getRootElement(), hideGUI2) addEventHandler("onClientGUIClick", getRootElement(), hideGUI2) SERVER: marker1 = createMarker(1969.2709960938,-2186.6633300781,12.5,"cylinder",1.5,255,0,255,255) function showGUI(hitPlayer) triggerClientEvent (hitPlayer,"showGUI2",getRootElement(),hitPlayer) end addEventHandler ("onMarkerHit",marker1,showGUI) Link to comment
Xeno Posted August 13, 2012 Share Posted August 13, 2012 function showGUI2() guiSetVisible(gui,true) showCursor(true) end addEvent("showGUI2",true) addEventHandler("showGUI2", getRootElement(), showGUI2) function hideGUI2() if (button_exit) then guiSetVisible (gui,false) showCursor(false) end end addEvent("hideGUI2",true) addEventHandler("hideGUI2", getRootElement(), hideGUI2) addEventHandler("onClientGUIClick", getRootElement(), hideGUI2,false) Try using the search function in the future. Link to comment
manve1 Posted August 13, 2012 Author Share Posted August 13, 2012 (edited) i did... didn't find it. EDIT: Ur solution didn't work Edited August 13, 2012 by Guest Link to comment
manve1 Posted August 13, 2012 Author Share Posted August 13, 2012 Did my solution work? it now doesn't even close it... Link to comment
Xeno Posted August 13, 2012 Share Posted August 13, 2012 gui = guiCreateStaticImage(0,0,0.6,0.593,"images/gui.png", true) button_exit = guiCreateStaticImage(0.93,0.015,0.05,0.05,"images/exit.png",true,gui) button_maximize = guiCreateStaticImage(0.87,0.015,0.05,0.05,"images/maximize.png",true,gui) button_minimize = guiCreateStaticImage(0.81,0.015,0.05,0.05,"images/minimize.png",true,gui) button_house = guiCreateStaticImage(0.02,0.015,0.212,0.049,"images/house.png",true,gui) function showGUI2() guiSetVisible(gui,true) showCursor(true) end addEvent("showGUI2",true) addEventHandler("showGUI2", getRootElement(), showGUI2) function hideGUI2() if (button_exit) then guiSetVisible (gui,false) showCursor(false) end end addEvent("hideGUI2",true) addEventHandler("hideGUI2", getRootElement(), hideGUI2) addEventHandler("onClientGUIClick", button_exit, hideGUI2) My mistake - its because you had getElementRoot() which basically means everything. addEventHandler("onClientGUIClick", [name of element being clicked], [function to be triggered when clicked]) See if it works. Link to comment
manve1 Posted August 13, 2012 Author Share Posted August 13, 2012 Nope, still everywhere i click it closes it. Link to comment
Xeno Posted August 13, 2012 Share Posted August 13, 2012 addEventHandler("onClientGUIClick", button_exit, hideGUI2,false) Try that again, and if it doesn't work I don't know. Link to comment
manve1 Posted August 13, 2012 Author Share Posted August 13, 2012 addEventHandler("onClientGUIClick", button_exit, hideGUI2,false) Try that again, and if it doesn't work I don't know. Thx, now it works 100% 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