Zentharus Posted July 6, 2013 Share Posted July 6, 2013 Alright, i got this stuff fixed up, yet i have a problem with my script, i have it showcursor and setinputenabled activated once script starts addEventHandler ( "onClientGUIClick", Lobby.button[1], hideBoxes, false) addEventHandler ( "onClientGUIClick", Lobby.button[2], hideBoxes2, false) end showCursor(true) guiSetInputEnabled(false) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), createWindow ) function hideBoxes ( button, state ) if button == "left" and state == "up" then setElementDimension ( localPlayer, 0 ) guiSetEnabled(guiButtons, false) guiSetEnabled(guiButtons1, false) guiSetVisible(guiButtons, false) guiSetVisible(guiButtons1, false) showCursor(false) guiSetInputEnabled(true) end end function hideBoxes2 ( button, state ) if button == "left" and state == "up" then setElementDimension( localPlayer, 1 ) guiSetEnabled(guiButtons, false) guiSetEnabled(guiButtons1, false) guiSetVisible(guiButtons, false) guiSetVisible(guiButtons1, false) showCursor(false) guiSetInputEnabled(true) end end Yet, the cursor doesn't go away and it doesn't do guiSetInputEnabled(true) upon clicking a button, why is this? Link to comment
iMr.3a[Z]eF Posted July 6, 2013 Share Posted July 6, 2013 Alright, i got this stuff fixed up, yet i have a problem with my script, i have it showcursor and setinputenabled activated once script starts addEventHandler ( "onClientGUIClick", Lobby.button[1], hideBoxes, false) addEventHandler ( "onClientGUIClick", Lobby.button[2], hideBoxes2, false) end showCursor(true) guiSetInputEnabled(false) addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), createWindow ) function hideBoxes ( button, state ) if button == "left" and state == "up" then setElementDimension ( localPlayer, 0 ) guiSetEnabled(guiButtons, false) guiSetEnabled(guiButtons1, false) guiSetVisible(guiButtons, false) guiSetVisible(guiButtons1, false) showCursor(false) guiSetInputEnabled(true) end end function hideBoxes2 ( button, state ) if button == "left" and state == "up" then setElementDimension( localPlayer, 1 ) guiSetEnabled(guiButtons, false) guiSetEnabled(guiButtons1, false) guiSetVisible(guiButtons, false) guiSetVisible(guiButtons1, false) showCursor(false) guiSetInputEnabled(true) end end Yet, the cursor doesn't go away and it doesn't do guiSetInputEnabled(true) upon clicking a button, why is this? its no't full codes, i can't help you like this -.- Link to comment
Zentharus Posted July 6, 2013 Author Share Posted July 6, 2013 You dont need the full code, the rest of it is just creating the GUI Therefore it isn't needed. Link to comment
aim-killer Posted July 6, 2013 Share Posted July 6, 2013 (edited) i am sure that guiSetInputEnabled must be true when the gui appears and false inside the function hideBoxes guiSetInputEnabled ( false ) is the same as guiSetInputMode ( "allow_binds" ) guiSetInputEnabled ( true ) is the same as guiSetInputMode ( "no_binds" ) idk whats wrong with the cursor addEventHandler ( "onClientGUIClick", Lobby.button[1], hideBoxes, false) addEventHandler ( "onClientGUIClick", Lobby.button[2], hideBoxes2, false) end showCursor(true) guiSetInputEnabled(true) -- there is a new function for this called guiSetInputMode, you can use that instead addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), createWindow ) function hideBoxes ( button, state ) if button == "left" and state == "up" then setElementDimension ( localPlayer, 0 ) guiSetEnabled(guiButtons, false) guiSetEnabled(guiButtons1, false) guiSetVisible(guiButtons, false) guiSetVisible(guiButtons1, false) showCursor(false) guiSetInputEnabled(false) end end function hideBoxes2 ( button, state ) if button == "left" and state == "up" then setElementDimension( localPlayer, 1 ) guiSetEnabled(guiButtons, false) guiSetEnabled(guiButtons1, false) guiSetVisible(guiButtons, false) guiSetVisible(guiButtons1, false) showCursor(false) guiSetInputEnabled(false) end end and it would be helpful if u provided the full code Edited July 6, 2013 by Guest Link to comment
Zentharus Posted July 6, 2013 Author Share Posted July 6, 2013 Ill give it a try later. Link to comment
DiSaMe Posted July 6, 2013 Share Posted July 6, 2013 It doesn't work because the the order in which the code is executed is relevant. You use addEventHandler on functions which have not been created at the top of the script. Link to comment
Zentharus Posted July 6, 2013 Author Share Posted July 6, 2013 Well crystal, the reason i have it in this order, i have the addEventHandler commands added in that location because its directly under my code of where it creates the GUI, and the end part ends my entire script above. Link to comment
DiSaMe Posted July 6, 2013 Share Posted July 6, 2013 Oh, didn't notice that. Anyway, did you try outputting messages to see which parts of the code are executed when they should? Link to comment
Zentharus Posted July 6, 2013 Author Share Posted July 6, 2013 Not at all, and i wouldn't know how to do that, im not a very good scripter so yeah.. 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