johhnhd Posted October 10, 2014 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
Banex Posted October 10, 2014 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 Not worry about the future. Very soon it will come.
nxFairlywell Posted October 10, 2014 Posted October 10, 2014 function hide( ) if ( source == closeBut ) then guiSetVisible(theWindow,false) showCursor(false) end end addEventHandler("onClientGUIClick" , root, hide) Discord ID : nxFairlywell#6895
johhnhd Posted October 11, 2014 Author Posted October 11, 2014 addEventHandler ( "onClientGUIClick", root, function () if ( source == closeBut ) then destroyElement(theWindow,false) showCursor ( false ) end end) Didn't work
johhnhd Posted October 11, 2014 Author 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
darhal Posted October 11, 2014 Posted October 11, 2014 Post the full code #include <iostream> int main() { std::cout << "C++ is amazing <3" << std::endl; return 0; } I left MTA !... I m doing some tuts about (servers and scripting here) subscribe please
johhnhd Posted October 12, 2014 Author 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)
johhnhd Posted October 12, 2014 Author Posted October 12, 2014 the mouse only goes at certain times and you have to reconnect to fix it
johhnhd Posted October 12, 2014 Author 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
Banex Posted October 12, 2014 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) Not worry about the future. Very soon it will come.
Moderators IIYAMA Posted October 12, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
johhnhd Posted October 12, 2014 Author 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
Moderators IIYAMA Posted October 12, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
EH10 Posted October 13, 2014 Posted October 13, 2014 Code #, addEventHandler('onClientGUIClick', root, function () if ( source == Button ) then guiSetVisible(Window,false) showCursor(false) end end ) Old Nick : MaxUr , #Skype : maxurmaxur BBM : 577287FC
Anubhav Posted October 13, 2014 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? See my some resources: Skin shop: https://community.multitheftauto.com/in ... ls&id=8008 Note script: https://community.multitheftauto.com/in ... ls&id=8009 Rules Panel: https://community.multitheftauto.com/in ... ls&id=8246 Random Money: https://community.multitheftauto.com/in ... ls&id=8718
EH10 Posted October 13, 2014 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 Old Nick : MaxUr , #Skype : maxurmaxur BBM : 577287FC
Dealman Posted October 13, 2014 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. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Moderators IIYAMA Posted October 13, 2014 Moderators 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. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
tosfera Posted October 13, 2014 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. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
Dealman Posted October 13, 2014 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. If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
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