PHP Code:
#include <amxmodx>
new const Version[] = "0.5";
new g_pSlayNoBots , g_pSlayWithBots , g_pSlayDelay , g_pPluginStartDelay;
new g_Bots , g_iSeconds , g_iSlayID;
new g_szName[ 33 ] , g_shHUD , g_iRoundStartTime;
public plugin_init()
{
register_plugin( "Slay CT" , Version , "bugsy" );
register_event( "HLTV" , "NewRound" , "a" , "1=0" , "2=0" );
register_logevent( "RoundEnd" , 2 , "1=Round_End" );
g_pSlayNoBots = register_cvar( "sct_nobotslay" , "3" );
g_pSlayWithBots = register_cvar( "sct_botslay" , "5" );
g_pSlayDelay = register_cvar( "sct_slaydelay" , "5" );
g_pPluginStartDelay = register_cvar( "sct_rounddelayseconds" , "90" );
g_shHUD = CreateHudSyncObj();
set_task( 1.0 , "SlayCheck" , 139457 , .flags="b" );
}
public client_putinserver( id )
{
g_Bots |= ( is_user_bot( id ) << ( id & 31 ) );
}
public client_disconnect( id )
{
g_Bots &= ~( 1 << ( id & 31 ) );
if ( id == g_iSlayID )
remove_task( g_iSlayID );
}
public NewRound()
{
g_iRoundStartTime = get_systime();
}
public RoundEnd()
{
remove_task( g_iSlayID );
}
public SlayCheck()
{
new iPlayers[ 32 ] , iNum;
if ( !g_iSlayID && ( get_systime() - g_iRoundStartTime ) >= get_pcvar_num( g_pPluginStartDelay ) && ( get_playersnum() > get_pcvar_num( g_Bots ? g_pSlayWithBots : g_pSlayNoBots ) ) )
{
get_players( iPlayers , iNum , "ae" , "CT" );
if ( iNum == 1 )
{
set_task( 1.0 , "DisplayHUD" , ( g_iSlayID = iPlayers[ 0 ] ) , .flags="a" , .repeat=( g_iSeconds = get_pcvar_num( g_pSlayDelay ) + 1 ) );
}
}
}
public DisplayHUD( id )
{
if ( g_szName[ 0 ] == EOS )
get_user_name( id , g_szName , charsmax( g_szName ) );
if ( --g_iSeconds >= 1 )
{
set_hudmessage( 0 , 170 , 255 , -1.0 , 0.40 , 0 , 0.0 , 1.0 , 0.0 , 0.0 , -1 );
ShowSyncHudMsg( 0 , g_shHUD , "%s will be slayed in %d second%s!" , g_szName , g_iSeconds , g_iSeconds > 1 ? "s" : "" );
}
else
{
user_kill( id );
g_iSlayID = 0;
g_szName[ 0 ] = EOS;
}
}