|H|TiTanium Posted August 10, 2013 Share Posted August 10, 2013 Basically, my script is about a GUI which should open when a player enters a marker, but it doesn't work, when I enter server, the GUI automatically shows up on my screen instead of being hidden til I get to marker, here I got the code. I just need your help to make the GUI appears when a player reaches the marker. function showGUI( hitElement, matchingDimension ) if ( guiGetVisible ( myWindow ) == true ) then guiSetVisible ( myWindow, false ) else guiSetVisible ( myWindow, true ) showCursor( true ) end end addEventHandler( "onMarkerHit", myMarker, showGUI ) function closeGUI( leaveElement, matchingDimension ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler( "onMarkerLeave", myMarker, closeGUI ) Link to comment
Vision Posted August 11, 2013 Share Posted August 11, 2013 onMarkerHit and onMarkerLeave is a server-side event, try to use onClientMarkerHit and onClientMarkerLeave. Link to comment
|H|TiTanium Posted August 11, 2013 Author Share Posted August 11, 2013 Ok, it works a bit better now, but the main problem and the last one is that when a player enters the server the GUI shows up automatically instead of keeping hidden. I don't know what is wrong. I need a help to make GUI hidden and then just show up when a player hits marker function showGUI( hitElement, matchingDimension ) guiSetVisible ( myWindow, true ) showCursor( true ) end addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) function closeGUI ( ) guiSetVisible ( myWindow, false ) showCursor( false ) end addEventHandler("onClientGUIClick", myButton2, closeGUI, false) 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