ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. setPlayerHudComponentVisible

Function

setPlayerHudComponentVisible

Server and clientPlayersIdentical to MTA:SA

Shows or hides a game HUD component. Each component works on its own: hiding money keeps health, armour, the weapon, the clock and the rest of the HUD in place. "all" affects all of them at once (including the radar) and clears earlier settings of single components. Components: ammo, armour (or armor), breath, clock, health, money, weapon, wanted, area_name, vehicle_name, radio, radar, all. The setting survives death and respawn; after reconnecting set it again (e.g. in onPlayerJoin).

Syntax

Server

bool setPlayerHudComponentVisible(player thePlayer, string component, bool show)

Client

bool setPlayerHudComponentVisible(string component, bool show)

Arguments

thePlayerplayer
A player or root (server only).
componentstring
Component name (see getHudComponentNames).
showbool
true shows it.

Returns

true on success, false for an unknown component.

Example

addEventHandler("onClientResourceStart", resourceRoot, function()
    setPlayerHudComponentVisible("money", false)
    setPlayerHudComponentVisible("area_name", false)
end)

See also