Jump to content

show cursor help


johhnhd

Recommended Posts

Posted

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

Posted (edited)
addEventHandler ( "onClientGUIClick", root, 
function () 
    if ( source == closeBut ) then 
        destroyElement(theWindow,false) 
        showCursor ( false ) 
    end 
end) 

Edited by Guest
jIcd9sc.png

Not worry about the future. Very soon it will come.

Posted
function hide(     ) 
  
if  ( source == closeBut ) then 
    guiSetVisible(theWindow,false) 
    showCursor(false) 
   end 
end 
  
  
addEventHandler("onClientGUIClick" , root, hide) 

Discord ID : nxFairlywell#6895

 

Posted
addEventHandler ( "onClientGUIClick", root, 
function () 
    if ( source == closeBut ) then 
        destroyElement(theWindow,false) 
        showCursor ( false ) 
    end 
end) 

Didn't work

Posted
function hide(     ) 
  
if  ( source == closeBut ) then 
    guiSetVisible(theWindow,false) 
    showCursor(false) 
   end 
end 
  
  
addEventHandler("onClientGUIClick" , root, hide) 

This didn't work as well

Posted

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

Posted
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) 
  

Posted
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 :(

Posted
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) 

jIcd9sc.png

Not worry about the future. Very soon it will come.

  • Moderators
Posted

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 

  Tutorials  4x 

 

Posted
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
Posted

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 

  Tutorials  4x 

 

Posted

Code #,

addEventHandler('onClientGUIClick', root, 
function () 
 if ( source == Button ) then 
  guiSetVisible(Window,false) 
   showCursor(false) 
    end 
 end 
) 

Old Nick : MaxUr

,

#Skype : maxurmaxur

BBM : 577287FC

Posted
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?

Posted
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

Posted
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
Posted

try it yourself: :idea:

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 

  Tutorials  4x 

 

Posted

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.

logo-small.png?v=3 tiny-sapdfr.png

 

If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]

Posted

Then I stand corrected. I was fairly sure I could hide my login panel's cursor with one of my other resources. :lol:

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...