Click

From RAGE Multiplayer Wiki

Client-Side Event

 C#  JavaScript



C# Syntax

public delegate void OnClickDelegate(int x, int y, bool up, bool right);

Parameters

  • x: x expects, System.Int32
  • y: y expects, System.Int32
  • up: up expects, System.Boolean
  • right: right expects, System.Boolean

Example

Events.OnClick += OnClick;
public void OnClick(int x, int y, bool up, bool right)
{
    //Do stuff
}


JavaScript Syntax

This event is triggered when a player use mouse click.

Parameters

  • absoluteX: Number
  • absoluteY: Number
  • upOrDown: String
  • leftOrRight: String
  • relativeX: Number
  • relativeY: Number
  • worldPosition: Vector3
  • hitEntity: Number

Example

mp.events.add('click', (x, y, upOrDown, leftOrRight, relativeX, relativeY, worldPosition, hitEntity) => {
    mp.gui.chat.push("Mouse X:" + x + " | Mouse Y:" + y); // Displays mouse position on click.

    if (upOrDown == "up")
         mp.gui.chat.push("Mouse Clicked Up with " + leftOrRight + " button.");

    if (upOrDown == "down")
         mp.gui.chat.push("Mouse Clicked Down with " + leftOrRight + " button.");
});


See also

Checkpoint

Colshape

Entity

Player

Streaming

Vehicle

Waypoint