[INC] ScreenFade Util
Posted: Fri Sep 25, 2026 5:28 pm
Two stocks :
Details :
fxtime and time in seconds (that's the main idea of this util).
Color, type : {0-255,0-255,0-255}
Alpha, type : 0-255
bReliable : if true, uses MSG_ONE or MSG_ALL, if false uses MSG_ONE_UNRELIABLE or MSG_BROADCAST
bExternal : if true uses emessage
How to use this stock with a cvar that handle color ?
Cvar should be like this :
Even if some values are less than 100, you should put the 3 digits, aka 10 -> 010
Then to retrieve the color use :
Code: Select all
// Main util
UTIL_ScreenFade(id=0,iColor[3]={0,0,0},Float:flFxTime=-1.0,Float:flHoldTime=0.0,iAlpha=0,iFlags=FFADE_IN,bool:bReliable=false,bool:bExternal=false)
// Util from main util
UTIL_FadeToBlack(id,Float:fxtime=3.0,bool:bReliable=false,bool:bExternal=false)fxtime and time in seconds (that's the main idea of this util).
Color, type : {0-255,0-255,0-255}
Alpha, type : 0-255
bReliable : if true, uses MSG_ONE or MSG_ALL, if false uses MSG_ONE_UNRELIABLE or MSG_BROADCAST
bExternal : if true uses emessage
How to use this stock with a cvar that handle color ?
Cvar should be like this :
Code: Select all
cvar_pointer = register_cvar("cvar_color", "RRRGGGBBB")Then to retrieve the color use :
Code: Select all
get_cvar_color( g_pCvar )
{
new Color[3]
new iTemp = get_pcvar_num(g_pCvar)
Color[0] = iTemp / 1000000
iTemp %= 1000000
Color[1] = iTemp / 1000
Color[2] = iTemp % 1000
return Color
}