This request leaves more questions than answers. Now admins can blank out their screen and words come up in the middle. Need more information or just change the message how you like.
Code:
#include amxmodx
//Screenfade color.
#define BLK ewrite_byte(0);ewrite_byte(0);ewrite_byte(0)
#define BLU ewrite_byte(0);ewrite_byte(0);ewrite_byte(random_num(200,255))
#define GRN ewrite_byte(0);ewrite_byte(random_num(200,255));ewrite_byte(0)
#define PNK ewrite_byte(255);ewrite_byte(random_num(170,200));ewrite_byte(203)
#define PUR ewrite_byte(118);ewrite_byte(random_num(25,75));ewrite_byte(137)
#define DELAY ewrite_short(get_pcvar_num(g_cvar_bsod_iDelay)*4096) //Remember 4096 is ~1-sec per 'spec unit'
#define FLAGS ewrite_short(0x0001)
#define FADE_IN ewrite_short(1<<0)
#define FADE_OUT ewrite_short(1<<1)
#define FADE_HOLD ewrite_short(1<<2)
#define ALPHA ewrite_byte(255)
static g_fade
new g_cvar_bsod_iDelay
new const MESSAGE[] = "HUD MESSAGE or menu?"
public plugin_init()
{
register_plugin("Black","1.0","SPiNX")
g_fade = get_user_msgid("ScreenFade")
g_cvar_bsod_iDelay = register_cvar("screen_fade_time", "10");
register_clcmd("say /black","@fadeout",ADMIN_KICK,"Black screenfade.")
}
@fadeout(id)
if(is_user_connected(id))
{
emessage_begin(MSG_ONE_UNRELIABLE,g_fade,{0,0,0},id)
DELAY;DELAY;FADE_OUT;BLK;ALPHA;
emessage_end();
bright_message(id)
}
public bright_message(id)
{
if(is_user_connected(id))
{
static Float:xTex;
xTex = -1.0
static Float:yTex;
yTex = -1.0
static Float:fadeInTime; fadeInTime = 0.5;
static Float:fadeOutTime; fadeOutTime = 0.5;
static Float:holdTime; holdTime = 1.0;
static Float:scanTime; scanTime = 1.2;
static effect; effect = 2;
emessage_begin ( MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, { 0, 0, 0 }, id )
ewrite_byte(TE_TEXTMESSAGE);
ewrite_byte(0); //(channel)
ewrite_short(FixedSigned16(xTex,1<<13)); //(x) -1.0 = center)
ewrite_short(FixedSigned16(yTex,1<<13)); //(y) -1.0 = center)
ewrite_byte(effect); //(effect) 0 = fade in/fade out, 1 is flickery credits, 2 is write out (training room)
ewrite_byte(iRainbow()); //(red)
ewrite_byte(iRainbow()); //(GRN)
ewrite_byte(iRainbow()); //(BLU)
ewrite_byte(200); //(alpha)
ewrite_byte(iRainbow()); //(red) - effect color
ewrite_byte(iRainbow()); //(GRN)
ewrite_byte(iRainbow()); //(BLU)
ewrite_byte(25); //(alpha)
ewrite_short(FixedUnsigned16(fadeInTime,1<<8));
ewrite_short(FixedUnsigned16(fadeOutTime,1<<8));
ewrite_short(FixedUnsigned16(holdTime,1<<8));
if(effect == 2)
ewrite_short(FixedUnsigned16(scanTime,1<<8));
ewrite_string(MESSAGE); //Words you see on screen.
emessage_end();
}
}
//stock iRainbow() return random(256); //comment/uncomment for random color text.
stock iRainbow() return 255 //comment/uncomment for white text.
stock FixedSigned16( Float:value, scale )
// Converts floating-point number to signed 16-bit fixed-point representation
{
new Output;
Output = floatround( value * scale )
if ( Output > 3276 )
Output = 32767
if ( Output < -32768 )
Output = -32768;
return Output;
}
stock FixedUnsigned16( Float:value, scale )
// Converts floating-point number to unsigned 16-bit fixed-point representation
{
new Output;
Output = floatround( value * scale )
if ( Output < 0 )
Output = 0;
if ( Output > 0xFFFF )
Output = 0xFFFF;
return Output;
}