SetPlayerHudComponentVisible

From Multi Theft Auto: Wiki
Revision as of 13:43, 11 January 2017 by Haha (talk | contribs) (→‎Syntax)
Jump to navigation Jump to search

[[{{{image}}}|link=|]] Note: This function is identical to showPlayerHudComponent

This function will show or hide a part of the player's HUD.

EJECT

TO

PSEUDO

SKRYPTER

Requirements

This template will be deleted.

Example

Click to collapse [-]
Server

This example hides the ammo and weapon displays for players when they join.

-- Hide some of the hud components when a player joins the server
addEventHandler ( "onPlayerJoin", root, 
    function ()
        setPlayerHudComponentVisible ( source, "ammo", false )    -- Hide the ammo displays for the newly joined player
        setPlayerHudComponentVisible ( source, "weapon", false )  -- Hide the weapon displays for the newly joined player
    end
)
Click to collapse [-]
Client

This example hides the ammo and weapon displays for players when they join.

-- Hide the hud when the resource is started
local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }

addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
	for _, component in ipairs( components ) do
		setPlayerHudComponentVisible( component, false )
	end
end)

See Also