hook.Remove

From Garry's Mod
Jump to: navigation, search
 hook.Remove( )

Contents

Description

Removes the hook with the supplied identifier from the given event.

Arguments

string eventName

The event name.

Arguments

any identifier

The unique identifier of the hook to remove, usually a string.

Examples

Example

Darkens the player's screen for 15 seconds.

hook.Add( "HUDPaint", "my_hook_identifier", function()
	
	surface.SetDrawColor( 0, 0, 0, 150 )
	surface.DrawRect( 0, 0, ScrW(), ScrH() )
	
end )

timer.Simple( 15, function()

	hook.Remove( "HUDPaint", "my_hook_identifier" )

end )

Output:

After the hook gets removed, the dark overlay doesn't appear anymore.
Personal tools
Navigation