onClientCursorMove | Multi Theft Auto: Wiki Skip to content

onClientCursorMove

Client-side
Server-side
Shared

This event is called by the root element whenever the cursor is moved over the screen, by the player. It returns information about the world coordinates as well as the screen coordinates of where the player moved the cursor.

Parameters

float cursorX, float cursorY, int absoluteX, int absoluteY, float worldX, float worldY, float worldZ
  • cursorX: the relative X coordinate of the mouse cursor. 0 = left side of the screen, 1 = right side.
  • cursorY: the relative Y coordinate of the mouse cursor. 0 = top of the screen, 1 = bottom.
  • absoluteX: the X coordinate of the mouse cursor, in pixels, measured from the left side of the screen.
  • absoluteY: the Y coordinate of the mouse cursor, in pixels, measured from the top of the screen.
  • worldX: the 3D in-game world X coordinate that the cursor is pointing at.
  • worldY: the 3D in-game world Y coordinate that the cursor is pointing at.
  • worldZ: the 3D in-game world Z coordinate that the cursor is pointing at.

Source

element: The source of this event is the root element.

Code Examples

client

This example creates a text label at the bottom of the screen which displays the mouse position in pixels.

addEventHandler( "onClientResourceStart", resourceRoot,
function ( )
textLabel = guiCreateLabel( 0, .9, 1, .1, "X: -; Y: -", true );
guiLabelSetHorizontalAlign( textLabel, "center" );
end
);
addEventHandler( "onClientCursorMove", root,
function ( _, _, x, y )
guiSetText( textLabel, "X: " .. tostring( x ) .. "; Y: ".. tostring( y ) )
end
);