Garry's Mod Wiki

hook.Remove

  hook.Remove( string eventName, any identifier )

Description

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

Arguments

1 string eventName
The event name.
2 any identifier
The unique identifier of the hook to remove, usually a string.

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.