- Documentation
- Client functions
- setCursorPosition
Function
setCursorPosition
Moves the cursor to a spot in the game window (pixels). Returns false when the game window is not active or is minimised.
Syntax
bool setCursorPosition(int cursorX, int cursorY)Arguments
cursorXint- X in pixels.
cursorYint- Y in pixels.
Returns
true on success.
Example
local sw, sh = guiGetScreenSize()
showCursor(true)
setCursorPosition(sw / 2, sh / 2)
See also
getCursorPositionReturns the cursor position as a fraction of the screen 0-1 (x, y). Works only while the cursor is shown. The next three results (a world point) are zeros for now;getWorldFromScreenPositiongives the world point under the cursor.showCursorShows or hides the mouse cursor. The cursor stays visible while at least one resource wants it, so hiding it in one resource does not close another's cursor. By default, while the cursor is shown, the ped controls are blocked.