manve1 Posted November 19, 2012 Posted November 19, 2012 I have got a slight one of the annoying problems when you can't find problem in the script. My problem is when i click button "close" it doesn't close. gui = guiCreateWindow( 0.3, 0.2, 0.4, 0.6, 'Da window', true ) close = guiCreateButton( 0.1, 0.75, 0.8, 0.15, 'Close', true, gui ) addEventHandler('onClientGUIClick', close, function( p ) if ( localPlayer == p ) then guiSetVisible( gui, false ) showCursor( false ) end end, false ) NOTE: By my knowledge using 'if ( localPlayer == p ) then' it will make it work only to the person who clicked the button. Looking for tutorials or information? check out: www.simpleask.co.uk
myonlake Posted November 19, 2012 Posted November 19, 2012 NOTE: By my knowledge using 'if ( localPlayer == p ) then' it will make it work only to the person who clicked the button. Wrong. When a code is client-side, it will only execute the function or whatever you're doing to the client who's executing it. Whenever someone makes a command client-side, everything in the command handler's function will only be execucted for the player. This can be seen in outputChatBoxes client-side, there's no element argument, because it will automatically be executed to the player executing it. Secondly, there's no element argument in onClientGUIClick event, as I said in the above text. Client-side local gui = guiCreateWindow(0.3, 0.2, 0.4, 0.6, "Da window", true) local close = guiCreateButton(0.1, 0.75, 0.8, 0.15, "Close", true, gui) addEventHandler("onClientGUIClick", close, function() guiSetVisible(gui, false) showCursor(false) end, false) If I helped you, please click the like button on the right Thanks!
manve1 Posted November 19, 2012 Author Posted November 19, 2012 Hmm... But on some of my client scripts i had to use: if (localPlayer == p) then so it doesn't mess up with other people, Still, thanx, I'll keep that in mind Looking for tutorials or information? check out: www.simpleask.co.uk
myonlake Posted November 19, 2012 Posted November 19, 2012 You only have to use that type of check in a couple of events. For example onClientVehicleEnter, but the basic thing is simple. Cheers. If I helped you, please click the like button on the right Thanks!
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