Eth Posted March 13, 2016 Share Posted March 13, 2016 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? Link to comment
EstrategiaGTA Posted March 13, 2016 Share Posted March 13, 2016 Use the event onClientKey, with the key "mouse1". Link to comment
Eth Posted March 13, 2016 Author Share Posted March 13, 2016 That would work, but I want to detect if a mouse has clicked on a player so onclientkey won't work like expected Link to comment
KariiiM Posted March 13, 2016 Share Posted March 13, 2016 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
Eth Posted March 15, 2016 Author Share Posted March 15, 2016 I know, but the event doesn't trigger if the player's cursor is not on. Link to comment
KariiiM Posted March 15, 2016 Share Posted March 15, 2016 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
Eth Posted March 16, 2016 Author Share Posted March 16, 2016 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
KariiiM Posted March 16, 2016 Share Posted March 16, 2016 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.. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now