Code:
/*
* "Blue screen of death", version "A", by ".sρiηX҉." fades the victim's
* 'screen blue on death' for any HLDS mod that supports being killed.
* The cvar is bsod_delay <#> in seconds to affect the fade time.
* CONFIRMED KILLS flash/fade count cvar is bsod_confirm_kills <#>.
* It must be whole numbers on both cvars. 0 disables the effects.
* Thread: forums.alliedmods.net/showthread.php?t=227407
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
* Credits:Valve, OLO, AMXX DEV TEAM.
* Inspired by: Haunted House for the Atari 2600. youtu.be/lbjVffUGjxA?t=127
* One can use green screen and others. GREEN is defined below. It's RGB.
*/
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define BLUE write_byte(0);write_byte(0);write_byte(random_num(200,255))
#define GREEN write_byte(0);write_byte(random_num(200,255));write_byte(0)
#define FLAGS write_short(0x0001)
#define ALPHA write_byte(500)
new g_cvar_bsod_iDelay, g_cvar_bsod_iConfmkills;
public plugin_init(){
register_plugin("Blue screen of death","A",".sρiηX҉.");
RegisterHam(Ham_Killed, "player", "FnKiller");
g_cvar_bsod_iDelay = register_cvar("bsod_delay", "5");
g_cvar_bsod_iConfmkills = register_cvar("bsod_confirm_kills", "11");
}
public FnKiller(victim,attacker){
set_task_ex(0.1, "FnKill", attacker, .flags = SetTask_RepeatTimes, .repeat = get_pcvar_num(g_cvar_bsod_iConfmkills));
if(!is_user_alive(victim))
FnFade(victim);
}
public FnKill(attacker){
if(is_user_connected(attacker))
{
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},attacker);
write_short(1000);
write_short(1000);
FLAGS;
write_byte(random_num(0,255));
write_byte(random_num(0,255));
write_byte(random_num(0,255));
ALPHA;
message_end();
}
return;
}
#define DELAY write_short(get_pcvar_num(g_cvar_bsod_iDelay)*4096)
public FnFade(victim){
if(is_user_connected(victim))
{
message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},victim);
DELAY;DELAY;FLAGS;BLUE;ALPHA; //This is where you can change BLUE to GREEN
message_end();
}
return;
}