- Documentation
- Shared functions
- showCursor
Function
showCursor
Shows 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.
Syntax
Server
bool showCursor(player thePlayer, bool show [, bool toggleControls = true])Client
bool showCursor(bool show [, bool toggleControls = true])Arguments
thePlayerplayer- A player or
root(server only). showbooltrue= show.toggleControlsbool, optional = truetrue= block controls while the cursor is visible.
Returns
true on success.
Example
bindKey("m", "down", function()
showCursor(not isCursorShowing())
end)
See also
isCursorShowingChecks whether the cursor is shown. On the client: by any resource. On the server: whether the server showed it to the player withshowCursor.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.