Preview
Client-side function

getCursorPosition

This function gets the current position of the mouse cursor. Note that for performance reasons, the world position returned is always 300 units away. If you want the exact world point (similar to onClientClick), use processLineOfSight between the camera position and the worldX/Y/Z result of this function. (See example below)

Syntax

float getCursorPosition ( )

Returns

Returns 5 values: cursorX, cursorY, worldX, worldY, worldZ. The first two values are the 2D relative screen coordinates of the cursor. The 3 values that follow are the 3D world map coordinates that the cursor points at. If the cursor isn't showing, returns false as the first value.

Issues

  • mtasa-blue #1166 : getCursorPosition() returns false even when cursor is showing due to opened console

Examples