Browser::sendMouseClickEvent

From RAGE Multiplayer Wiki
Revision as of 20:45, 13 December 2024 by Shr0x (talk | contribs) (Created page with "{{ClientsideJsFunction}} {{JSContainer| == sendMouseClickEvent == This function simulates mouse click events in a CEF browser. It enables interactions with the in-game browser interface programmatically by sending click coordinates, button type, and associated flags. === Syntax === <syntaxhighlight lang="javascript"> browser.sendMouseClickEvent(buttonType, x, y, isUp); </syntaxhighlight> === Required Arguments === * '''buttonType:''' {{RageType|number}} - The mouse but...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax

sendMouseClickEvent

This function simulates mouse click events in a CEF browser. It enables interactions with the in-game browser interface programmatically by sending click coordinates, button type, and associated flags.

Syntax

browser.sendMouseClickEvent(buttonType, x, y, isUp);

Required Arguments

  • buttonType: number - The mouse button type:
 * 0: Left button
 * 1: Middle button
 * 2: Right button
  • x: number - X coordinate of the click position.
  • y: number - Y coordinate of the click position.
  • isUp: boolean - Indicates if the click is a press (`false`) or release (`true`).

Return Value

  • Undefined

Example

const browser = mp.browsers.at(1);
// Simulate a left mouse button click at coordinates (200, 300)
browser.sendMouseClickEvent(0, 200, 300, false); // Mouse press
browser.sendMouseClickEvent(0, 200, 300, true);  // Mouse release


See Also