Jump to content

show cursor help


johhnhd

Recommended Posts

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

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.

Link to comment

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

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