[INC] ScreenFade Util

For scripting examples for learning how to use AMXX.
User avatar
Archive-Poster
Posts: 1327
Gender:
United States of America

[INC] ScreenFade Util

Post by Archive-Poster »

Two stocks :

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)
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 :

Code: Select all

cvar_pointer = register_cvar("cvar_color", "RRRGGGBBB")
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

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
} 
Attachments
screenfade_util.inc.zip
(990 Bytes) Downloaded 5 times

Who is online

Users browsing this forum: No registered users and 1 guest