IsPlayerCrosshairVisible: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(5 intermediate revisions by one other user not shown)
Line 8: Line 8:
<syntaxhighlight lang="lua">bool isPlayerCrosshairVisible()</syntaxhighlight>
<syntaxhighlight lang="lua">bool isPlayerCrosshairVisible()</syntaxhighlight>


function aim()
===Returns===
     if isPlayerCrosshairVisible() then
Returns ''true'' if the player has the crosshair visible, ''false'' otherwise.
        outputChatBox("your sight is visible")
 
     else
==Example==
        outputChatBox("your crosshair is not visible")
<syntaxhighlight lang="lua">
    end
addCommandHandler("aim", function()
end
     local AimStatusText = isPlayerCrosshairVisible() and "Visbile" or "Hidden"
addCommandHandler("aimcheck", aim)
     outputChatBox("Your AIM is: ".. AimStatusText)
end)
</syntaxhighlight>


==See Also==
==See Also==
{{Client player functions}}
{{Client player functions}}

Latest revision as of 02:03, 5 December 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

addCommandHandler("aim", function()
    local AimStatusText = isPlayerCrosshairVisible() and "Visbile" or "Hidden"
    outputChatBox("Your AIM is: ".. AimStatusText)
end) 

See Also