Garry's Mod Wiki

GM:HUDShouldDraw

boolean GM:HUDShouldDraw( string name )

Description

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

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

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

Returns

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

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 )

Page Links


Special Pages


Wikis

?

Render Time: 45ms

DB GetPage 4
Generate Html 8
SaveChanges (1) 18
Render Body 0
Render Sidebar 12