KraZ Posted January 29, 2012 Share Posted January 29, 2012 Why doesn't this work i get something to do with a error on the line 48 saying '(' expected to close to ')' function ViewGUI () --This is the line i get error on. if ( guiGetVisible ( window ) == true ) then showCursor(false) guiSetVisible(window,false) elseif ( guiGetVisible ( window ) == false ) then showCursor(true) guiSetVisible(window,true) end end function binds () bindKey ( "F1", "down", ViewGUI ) end addCommandHandler ( "bindme", binds ) end Link to comment
FatalTerror Posted January 29, 2012 Share Posted January 29, 2012 function ViewGUI () --This is the line i get error on. if ( guiGetVisible ( window ) == true ) then showCursor(false) guiSetVisible(window,false) elseif ( guiGetVisible ( window ) == false ) then showCursor(true) guiSetVisible(window,true) end end function binds () bindKey ( "F1", "down", ViewGUI ) end addCommandHandler ( "bindme", binds ) Link to comment
JR10 Posted January 29, 2012 Share Posted January 29, 2012 You can also shorten the code to be: function ViewGUI () guiSetVisible (window,not guiGetVisible ( window ) ) showCursor(guiGetVisible (window)) end function binds () bindKey ( "F1", "down", ViewGUI ) end addCommandHandler ( "bindme", binds ) Link to comment
drk Posted January 29, 2012 Share Posted January 29, 2012 Or include all in one, JR10: bindKey('F1','down', function() guiSetVisible(window,not guiGetVisible(window)) showCursor(guiGetVisible(window)) end) Why he needs a command to bind F1? .-. 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