/* ========================================================================= */
#include <amxmodx>
new const _Plugin[ ][ ] = { "ScreenFade Round + Hud Info", "1.0.1", "Sky" };
new const _Prefix[ ] = "[ SKY ]";
/* ========================================================================= */
new gCountRound, gTScore, gCScore;
new g_Message_ScreenFade;
const UNIT_SECOND = (1<<12);
const FFADE_IN = 0x0000;
/* ========================================================================= */
public plugin_init( )
{
register_plugin( _Plugin[ 0 ], _Plugin[ 1 ], _Plugin[ 2 ] );
register_event( "HLTV","event_NewRound","a","1=0","2=0" );
register_event( "SendAudio", "event_WinTerrorist", "a", "2&%!MRAD_terwin" );
register_event( "SendAudio", "event_WinPolices", "a", "2&%!MRAD_ctwin" );
register_event( "SendAudio", "event_RoundDraw","a","2&%!MRAD_rounddraw" );
register_event( "TextMsg","event_GameRestart","a","2&#Game_w" );
register_logevent( "event_GameCommencing",2,"1=Game_Commencing" );
register_logevent( "event_WinPolices", 6, "3=Target_Saved" );
register_logevent( "event_WinTerrorist", 6, "3=Target_Bombed" );
g_Message_ScreenFade = get_user_msgid( "ScreenFade" );
set_task( 1.0, "ShowScoreHud", _, _, _, "b" );
}
/* ========================================================================= */
public event_GameCommencing( )
{
gCountRound = 0;
gTScore = 0;
gCScore = 0;
}
public event_NewRound( ) ++gCountRound;
public event_GameRestart( )
{
if( gCountRound > 0 )
{
gCountRound = 0;
gTScore = 0;
gCScore = 0;
}
}
public event_WinTerrorist( )
{
set_Msg( 0, 1 );
++gTScore;
return PLUGIN_HANDLED;
}
public event_WinPolices( )
{
set_Msg( 0, 2 );
++gCScore;
return PLUGIN_HANDLED;
}
public event_RoundDraw( )
{
set_Msg( 0, 3 );
return PLUGIN_HANDLED;
}
/* ========================================================================= */
public ShowScoreHud( )
{
static RandomR, RandomG, RandomB;
RandomR = random_num( 0, 100 ); RandomG = random_num( 0, 200 ); RandomB = random_num( 0 , 255 );
set_hudmessage( RandomR, RandomG, RandomB, -1.0, 0.0, 0, 0.5, 2.0, 0.08, 2.0, true );
show_hudmessage( 0,"Terroristas: %d | Policías: %d^nRondas: %d", gTScore, gCScore, gCountRound );
}
public set_Msg( id, type )
{
if( type == 1 )
{
client_print( id, print_chat, "%s La ronda %d fue ganada por los Terroristas.", _Prefix, gCountRound );
message_begin( MSG_ONE_UNRELIABLE, g_Message_ScreenFade, _, id );
write_short( ( UNIT_SECOND ) * 2 );
write_short( 0 );
write_short( FFADE_IN );
write_byte( 255 ); // color rojo
write_byte( 0 ); // color verde
write_byte( 0 ); // color azul
write_byte( 255 );
message_end( );
}
if( type == 2 )
{
client_print( id, print_chat, "%s La ronda %d fue ganada por los Policias.", _Prefix, gCountRound );
message_begin( MSG_ONE_UNRELIABLE, g_Message_ScreenFade, _, id );
write_short( ( UNIT_SECOND ) * 2 );
write_short( 0 );
write_short( FFADE_IN );
write_byte( 0 ); // color rojo
write_byte( 68 ); // color verde
write_byte( 255 ); // color azul
write_byte( 255 );
message_end( );
}
if( type == 3 ) client_print( id, print_chat, "%s La ronda %d fue empatada.", _Prefix, gCountRound );
}
/* ========================================================================= */