Garry's Mod Wiki

Player:ScreenFade

  Player:ScreenFade( number flags, number clr = color_white, number fadeTime, number fadeHold )

Description

Fades the screen

Arguments

1 number flags
Fade flags defined with SCREENFADE enum.
2 number clr = color_white
The color of the screenfade
3 number fadeTime
Fade(in/out) effect transition time ( From no fade to full fade and vice versa ).

This is limited to 7 bits integer part and 9 bits fractional part.

4 number fadeHold
Fade effect hold time.

This is limited to 7 bits integer part and 9 bits fractional part.

Example

Flashes the screen red to nothing over 0.3 seconds when a player gets hurt.

hook.Add( "PlayerHurt", "hurt_effect_fade", function( ply ) ply:ScreenFade( SCREENFADE.IN, Color( 255, 0, 0, 128 ), 0.3, 0 ) end )