Jump to content

[HELP] onClientClick!!


off

Recommended Posts

Posted

I'm using "onClientClick", but he is considering "Mouse1"(This is left click) and "mouse2"(This is right click) and I want to consider only the the first. How can I do this?

i5 7400 3.0GHZ
B150M-GAMING 3 DDR4
HyperX FURY 8GB 2133Mhz DDR4
Galax GTX 1060 6GB OC

Posted

Check which mouse button is being clicked, it has an argument specifying it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Check which mouse button is being clicked, it has an argument specifying it.

Where?

i5 7400 3.0GHZ
B150M-GAMING 3 DDR4
HyperX FURY 8GB 2133Mhz DDR4
Galax GTX 1060 6GB OC

Posted
string button, string state, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld

Parameters:

button: This refers the button used to click on the mouse, can be left, right, or middle'

state: This can be used to tell if the user released or pressed the mouse button, where up is passed if the button is released, and down is passed if the button is pushed

absoluteX: This refers to the 2D x coordinate the user clicked on his screen, and is an absolute position in pixels.

absoluteY: This refers to the 2D y coordinate the user clicked on his screen, and is an absolute position in pixels.

worldX: This represents the 3D x coordinate the player clicked on the screen, and is relative to the GTA world.

worldY: This represents the 3D y coordinate the player clicked on the screen, and is relative to the GTA world.

worldZ: This represents the 3D z coordinate the player clicked on the screen, and is relative to the GTA world.

clickedWorld: This represents any physical entity elements that were clicked. If the player clicked on no MTA element, it's set to false.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
string button, string state, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ, element clickedWorld

Parameters:

button: This refers the button used to click on the mouse, can be left, right, or middle'

state: This can be used to tell if the user released or pressed the mouse button, where up is passed if the button is released, and down is passed if the button is pushed

absoluteX: This refers to the 2D x coordinate the user clicked on his screen, and is an absolute position in pixels.

absoluteY: This refers to the 2D y coordinate the user clicked on his screen, and is an absolute position in pixels.

worldX: This represents the 3D x coordinate the player clicked on the screen, and is relative to the GTA world.

worldY: This represents the 3D y coordinate the player clicked on the screen, and is relative to the GTA world.

worldZ: This represents the 3D z coordinate the player clicked on the screen, and is relative to the GTA world.

clickedWorld: This represents any physical entity elements that were clicked. If the player clicked on no MTA element, it's set to false.

Well, I set as the left, but nothing was changed.

i5 7400 3.0GHZ
B150M-GAMING 3 DDR4
HyperX FURY 8GB 2133Mhz DDR4
Galax GTX 1060 6GB OC

Posted

Set it how? this is how you must do it:

addEventHandler ( "onClientClick", root, 
    function ( button ) 
        if ( button == "left" ) then 
            -- Code here 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Set it how? this is how you must do it:
addEventHandler ( "onClientClick", root, 
    function ( button ) 
        if ( button == "left" ) then 
            -- Code here 
        end 
    end 
) 

Thanks, worked. I'm newbie in LUA.

i5 7400 3.0GHZ
B150M-GAMING 3 DDR4
HyperX FURY 8GB 2133Mhz DDR4
Galax GTX 1060 6GB OC

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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