isPlayerHudComponentVisible | Multi Theft Auto: Wiki Skip to content

isPlayerHudComponentVisible

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 can be used to check whether an hud component is visable or not.

Syntax

bool isPlayerHudComponentVisible ( string component )
Required Arguments
  • component: The component you wish to check. Valid values are:

Returns

  • bool: value

Returns true if the component is visable, false if not.

Code Examples

shared
addEventHandler("onClientResourceStart",resourceRoot,function()
local components = {"ammo","area_name","armour","breath","clock","health","money",
"radar","vehicle_name","weapon","radio","wanted","crosshair"
} --Table filled with all the available components to check
for _,component in ipairs(components)do
if isPlayerHudComponentVisible(component)then --check if the component is visible
outputChatBox("Hud Component: "..component.." is visible!") --if it is then tell the client that
else
outputChatBox("Hud Component: "..component.." is not visible!") --if it is not then tell the client that it isn't
end
end
end)

See Also