Jump to content

onclientclick works with cursor show only?


Eth

Recommended Posts

Posted

as title says, onclientclick function is only executed when showcursor is true. and I am pretty sure it's something wrong in mta because I saw this page here: https://bugs.multitheftauto.com/view.php?id=2509

and I tried Jax test script, and it works only (output "clicked") if I have showcursor enabled but does nothing when showcurser is disabled, any ideas?

Posted

That would work, but I want to detect if a mouse has clicked on a player so onclientkey won't work like expected

Posted

You can use the event "onClientClick" and check if the clicked element is a player or not, like that

addEventHandler ( "onClientClick", getRootElement() 
function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, element) 
    if element and getElementType(element) == "player" then 
        --your code 
    end 
end) 

Posted
I know, but the event doesn't trigger if the player's cursor is not on.
addEventHandler ( "onClientClick", getRootElement() 
function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, element) 
    if not isCursorShowing() then return end  
    if element and getElementType(element) == "player" then 
        --your code 
    end 
end) 

Posted
I know, but the event doesn't trigger if the player's cursor is not on.
addEventHandler ( "onClientClick", getRootElement() 
function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, element) 
    if not isCursorShowing() then return end  
    if element and getElementType(element) == "player" then 
        --your code 
    end 
end) 

You still didn't get me, I want to know if there is a way to detect if a player has clicked on an other player , I tried to use onClientClick, but the problem is that onClientClick requires you to have the cursor on in order for it to work, if the player cursor is not showed then onClientClick doesn't work and I don't want that :/

Posted

So, you mean you want to get a message inform you for each time a player clicked on a player? and obviously to click on someone you've to use the cursor..

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