IsPlayerCrosshairVisible: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} {{New feature/item|3.0161|1.6.0|22751|This function checks if the local player has showing crosshair.}} {{Note|This function always returns true for '''spraycan''' and '''fire extinguisher'''.}} ==Syntax== <syntaxhighlight lang="lua">bool isPlayerCrosshairVisible()</syntaxhighlight> ===Returns=== Returns ''true'' if the player has the crosshair visible, ''false'' otherwise. ==Example== <syntaxhighlight lang="lua"> function check() out...")
 
m (Update note)
Line 3: Line 3:
{{New feature/item|3.0161|1.6.0|22751|This function checks if the local player has showing crosshair.}}
{{New feature/item|3.0161|1.6.0|22751|This function checks if the local player has showing crosshair.}}


{{Note|This function always returns true for '''spraycan''' and '''fire extinguisher'''.}}
{{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==
==Syntax==

Revision as of 13:34, 2 October 2024

ADDED/UPDATED IN VERSION 1.6.0 r22751:
This function checks if the local player has showing crosshair.
[[{{{image}}}|link=|]] 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

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

Example

function check()
   outputChatBox("Crosshair: "..(isPlayerCrosshairVisible() and "visible" or "not visible", 255, 255, 0) -- output text 
end
addCommandHandler("crosshair", check)

See Also