This is how wrecked helped me a while back so here you go
PHP Code:
/**
* Sends screenfade message to a player
*
* @param id Player index to screenfade
* @param r Red value in rgb format
* @param g Green value in rgb format
* @param b Blue value in rgb format
* @param alpha Fade alpha
* @param holdtime Float on how long to hold
*/
stock ScreenFade(id, r, g, b, alpha, Float:holdtime)
{
new _holdtime = floatround(holdtime * 10.0),
duration = floatround(_holdtime * 1.25);
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenFade" ), { 0, 0, 0 }, id);
write_short(1<<duration); // duration
write_short(1<<_holdtime); // holdtime
write_short(2); // fade out
write_byte(r);
write_byte(g);
write_byte(b);
write_byte(alpha);
message_end();
}
Usage example:
Code:
ScreenFade( id, 255, 0, 0, 120, 10.0 )
That would make a screenfade (red, semi-transparent) for 10 seconds. The 6th parameter must be a float.
__________________