johhnhd Posted October 10, 2014 Share Posted October 10, 2014 Easiest thing to do with GUI but this has just got my head in a twist. function hide() destroyElement(theWindow) showCursor ( false ) end addEventHandler ( "onClientGUIClick", closeBut, hide, false ) It deletes the GUI but cursor still shows. TY in advanced Link to comment
Banex Posted October 10, 2014 Share Posted October 10, 2014 (edited) addEventHandler ( "onClientGUIClick", root, function () if ( source == closeBut ) then destroyElement(theWindow,false) showCursor ( false ) end end) Edited October 10, 2014 by Guest Link to comment
nxFairlywell Posted October 10, 2014 Share Posted October 10, 2014 function hide( ) if ( source == closeBut ) then guiSetVisible(theWindow,false) showCursor(false) end end addEventHandler("onClientGUIClick" , root, hide) Link to comment
johhnhd Posted October 11, 2014 Author Share Posted October 11, 2014 addEventHandler ( "onClientGUIClick", root, function () if ( source == closeBut ) then destroyElement(theWindow,false) showCursor ( false ) end end) Didn't work Link to comment
johhnhd Posted October 11, 2014 Author Share Posted October 11, 2014 function hide( ) if ( source == closeBut ) then guiSetVisible(theWindow,false) showCursor(false) end end addEventHandler("onClientGUIClick" , root, hide) This didn't work as well Link to comment
johhnhd Posted October 12, 2014 Author Share Posted October 12, 2014 Post the full code function guiClick (button, state, absoluteX, absoluteY) if (source == spawnBut) then triggerServerEvent ("carSpawn", lp) elseif (source == destroyBut) then triggerServerEvent ("carDestroy", lp) elseif (source == closeBut) then guiSetVisible (theWindow, false) showCursor (false) end end addEventHandler ("onClientGUIClick", getRootElement(), guiClick) Link to comment
johhnhd Posted October 12, 2014 Author Share Posted October 12, 2014 the mouse only goes at certain times and you have to reconnect to fix it Link to comment
johhnhd Posted October 12, 2014 Author Share Posted October 12, 2014 function guiClick (button, state, absoluteX, absoluteY) if (source == spawnBut) then triggerServerEvent ("carSpawn", lp) guiSetVisible (theWindow, false) showCursor (false) elseif (source == destroyBut) then triggerServerEvent ("carDestroy", lp) guiSetVisible (theWindow, false) showCursor (false) elseif (source == closeBut) then guiSetVisible (theWindow, false) showCursor (false) end end addEventHandler ("onClientGUIClick", getRootElement(), guiClick) using that now but it doesn't get rid of cursor Link to comment
Banex Posted October 12, 2014 Share Posted October 12, 2014 addEventHandler ("onClientGUIClick", root, function () if (source == spawnBut) then triggerServerEvent ("carSpawn", lp) guiSetVisible (theWindow, false) showCursor (false) elseif (source == destroyBut) then triggerServerEvent ("carDestroy", lp) guiSetVisible (theWindow, false) showCursor (false) elseif (source == closeBut) then guiSetVisible (theWindow, false) showCursor (false) end end) Link to comment
Moderators IIYAMA Posted October 12, 2014 Moderators Share Posted October 12, 2014 Every resource is using it's own showCursor management. They all can enable it, but they all must disabled it in order to hide it. Short saying: They have no influences at each other. Link to comment
johhnhd Posted October 12, 2014 Author Share Posted October 12, 2014 Every resource is using it's own showCursor management. They all can enable it, but they all must disabled it in order to hide it. Short saying: They have no influences at each other. I dont get what you are getting at here Link to comment
Moderators IIYAMA Posted October 12, 2014 Moderators Share Posted October 12, 2014 I am telling you, that it isn't going to work what ever you do. Unless you try to understand the meaning of what I just said. If you do not understand (my)English, then find somebody who can translate it for you. Link to comment
EH10 Posted October 13, 2014 Share Posted October 13, 2014 Code #, addEventHandler('onClientGUIClick', root, function () if ( source == Button ) then guiSetVisible(Window,false) showCursor(false) end end ) Link to comment
Anubhav Posted October 13, 2014 Share Posted October 13, 2014 Code #, addEventHandler('onClientGUIClick', root, function () if ( source == Button ) then guiSetVisible(Window,false) showCursor(false) end end ) LMFAO, he already told it doesn't work. Are you blind? Link to comment
EH10 Posted October 13, 2014 Share Posted October 13, 2014 Code #, addEventHandler('onClientGUIClick', root, function () if ( source == Button ) then guiSetVisible(Window,false) showCursor(false) end end ) LMFAO, he already told it doesn't work. Are you blind? Not .Warning Link to comment
Dealman Posted October 13, 2014 Share Posted October 13, 2014 Every resource is using it's own showCursor management. They all can enable it, but they all must disabled it in order to hide it. Short saying: They have no influences at each other. Not entirely sure what you're trying to say... If resource 1 enables the cursor via showCursor - resource 2 can still hide it by using showCursor. The cursor is a global thing - it's not tied to specific resources. Link to comment
Moderators IIYAMA Posted October 13, 2014 Moderators Share Posted October 13, 2014 try it yourself: Resource 1: addCommandHandler("lol1", function() outputChatBox("lol1") showCursor( not isCursorShowing() ) end) Resource 2: addCommandHandler("lol2", function() outputChatBox("lol2") showCursor(false) end) Also there also another problem, which will overwrite showCursor. That happens when you change the gui input mode. I am not a gui expert and I probably only created circa 12 gui's in my live, but this is what I know about enable the mouse. Link to comment
tosfera Posted October 13, 2014 Share Posted October 13, 2014 IIYama is right, if Resource1 shows the cursor you're going to have a hard time hiding the cursor with a script in Resource2. In fact, What IIYama already told you. This is impossible, every resource has their own cursor and is unique. You can't hide it without permission of the other resource. To make this a little simplier. If Kid1 has a piece of pie, Kid2 is not allowed to take that pie. If he does, he's a thief. MTA protected this and won't allow theft. Link to comment
Dealman Posted October 13, 2014 Share Posted October 13, 2014 Then I stand corrected. I was fairly sure I could hide my login panel's cursor with one of my other resources. 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