IsPlayerCrosshairVisible: Difference between revisions
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...") |
|||
(11 intermediate revisions by 4 users not shown) | |||
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 | {{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== | ||
Line 13: | Line 13: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function | addCommandHandler("crosshair", function() | ||
local crosshairStatus = isPlayerCrosshairVisible() and "visible" or "hidden" | |||
outputChatBox("Your crosshair is: "..crosshairStatus) | |||
end) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client player functions}} | {{Client player functions}} |
Latest revision as of 08:38, 5 December 2024
Syntax
bool isPlayerCrosshairVisible()
Returns
Returns true if the player has the crosshair visible, false otherwise.
Example
addCommandHandler("crosshair", function() local crosshairStatus = isPlayerCrosshairVisible() and "visible" or "hidden" outputChatBox("Your crosshair is: "..crosshairStatus) end)
See Also
- getLocalPlayer
- getPlayerMapBoundingBox
- getPlayerMapOpacity
- isPlayerMapVisible
- isPlayerHudComponentVisible
- resetBlurLevel
- Shared
- getPlayerTeam
- getPlayerBlurLevel
- setPlayerBlurLevel
- getPlayerSerial
- forcePlayerMap
- getPlayerScriptDebugLevel
- getPlayerFromName
- getPlayerMoney
- getPlayerName
- getPlayerNametagColor
- getPlayerNametagText
- getPlayerPing
- getPlayerWantedLevel
- givePlayerMoney
- isPlayerMapForced
- isPlayerNametagShowing
- setPlayerHudComponentVisible
- setPlayerMoney
- setPlayerNametagColor
- setPlayerNametagShowing
- setPlayerNametagText
- takePlayerMoney
- countPlayersInTeam
- getPlayersInTeam
- isVoiceEnabled
- setControlState
- getControlState