isPlayerCrosshairVisible | Multi Theft Auto: Wiki Skip to content

isPlayerCrosshairVisible

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


This function checks if the local player has showing crosshair.

Note

This function checks if the crosshair is rendered by GTA. Please note that hud components are not associated with this function, so the function may return true even if the "crosshair" component is hidden with setPlayerHudComponentVisible . If you need checking use isPlayerHudComponentVisible .

Syntax

bool isPlayerCrosshairVisible ( )

Returns

  • bool: value

Returns true if the player has the crosshair visible, false otherwise.

Code Examples

shared
addCommandHandler("crosshair", function()
local crosshairStatus = isPlayerCrosshairVisible() and "visible" or "hidden"
outputChatBox("Your crosshair is: "..crosshairStatus)
end)

See Also