Jump to content

guiSetVisible problem


|H|TiTanium

Recommended Posts

Posted

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 ) 
        if ( guiGetVisible ( myWindow ) == true ) then 
                guiSetVisible ( myWindow, false ) 
        else               
                guiSetVisible ( myWindow, true ) 
        showCursor( true ) 
        end 
end 
addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) 
  
function closeGUI ( ) 
        guiSetVisible ( myWindow, false ) 
        showCursor( false ) 
end 
addEventHandler("onClientGUIClick", myButton2, closeGUI, false) 

Posted

I can also see a little bug in your script, always use this while you're making a marker;

if ( hitElement == getLocalPlayer() and source == ) then 

Else it will trigger for all the players and not only the client (hitElement)

Posted

The window will not be shown to all players because it's clientside.

But the window will be shown whenever he hits an marker.

Posted
The window will not be shown to all players because it's clientside.

Incorrect... For some reason you do have to do a check on the hitelement otherwise it will show for all players.. Not really sure why, but it does.

Posted
The window will not be shown to all players because it's clientside.

Incorrect... For some reason you do have to do a check on the hitelement otherwise it will show for all players.. Not really sure why, but it does.

^ that is still a black box for me too. Client side is only for the player thats doing something, like single player. But somehow the entire server will get the GUI...

Posted

Done. Something strange happened to me, yesterday GUI was working fine, today I could just see the Cursor, so I did what you have said to and works fine now.

function showGUI( hitElement, matchingDimension ) 
        if ( hitElement == getLocalPlayer() and source == myMarker ) then 
                guiSetVisible ( myWindow, true ) 
                showCursor( true ) 
        else               
        end 
end 
addEventHandler( "onClientMarkerHit", getRootElement(), showGUI ) 
  
function closeGUI ( ) 
        guiSetVisible ( myWindow, false ) 
        showCursor( false ) 
end 
addEventHandler("onClientGUIClick", myButton2, closeGUI, false) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...