GM:HUDShouldDraw

From Garry's Mod
Jump to: navigation, search
 GM:HUDShouldDraw( )

Contents

Description

Called when the Gamemode is about to draw a given element on the client's HUD (heads-up display).

NOTE This hook is called HUNDREDS of times per second (more than 5 times per frame on average). You shouldn't be performing any computationally intensive operations.

Arguments

string name

The name of the HUD element. You can find a full list of HUD elements for this hook here.

Returns

boolean

Return false to prevent the given element from being drawn on the client's screen.

Examples

Example

Hides the default health and battery (armor) HUD elements, while still allowing the display of other elements to be controlled by other addons.

local hide = {
	CHudHealth = true,
	CHudBattery = true,
}

hook.Add( "HUDShouldDraw", "HideHUD", function( name )
	if ( hide[ name ] ) then return false end

	-- Don't return anything here, it may break other addons that rely on this hook.
end )


Personal tools
Navigation