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
Posted
function hide(     ) 
  
if  ( source == closeBut ) then 
    guiSetVisible(theWindow,false) 
    showCursor(false) 
   end 
end 
  
  
addEventHandler("onClientGUIClick" , root, hide) 

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

  • 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.

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.

Posted

Code #,

addEventHandler('onClientGUIClick', root, 
function () 
 if ( source == Button ) then 
  guiSetVisible(Window,false) 
   showCursor(false) 
    end 
 end 
) 
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

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.

  • 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.

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.

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