Jump to content

onclientclick works with cursor show only?


Eth

Recommended Posts

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) 

Link to comment
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) 

Link to comment
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 :/

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