View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-22-2020 , 20:44   Re: Remaining CT = slay
Reply With Quote #3

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_szName33 ] , 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" "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_task1.0 "SlayCheck" 139457 , .flags="b" );
}

public 
client_putinserverid )
{
    
g_Bots |= ( is_user_botid ) << ( id 31 ) );
}

public 
client_disconnectid )
{
    
g_Bots &= ~( << ( id 31 ) );
    
    if ( 
id == g_iSlayID )
        
remove_taskg_iSlayID );
}

public 
NewRound()
{
    
g_iRoundStartTime get_systime();
}

public 
RoundEnd()
{
    
remove_taskg_iSlayID );
}

public 
SlayCheck()
{
    new 
iPlayers32 ] , iNum;
    
    if ( !
g_iSlayID && ( get_systime() - g_iRoundStartTime ) >= get_pcvar_numg_pPluginStartDelay ) && ( get_playersnum() > get_pcvar_numg_Bots g_pSlayWithBots g_pSlayNoBots ) ) )
    {
        
get_playersiPlayers iNum "ae" "CT" );
        
        if ( 
iNum == )
        {
            
set_task1.0 "DisplayHUD" , ( g_iSlayID iPlayers] ) , .flags="a" , .repeat=( g_iSeconds get_pcvar_numg_pSlayDelay ) + )  );
        }
    }
}

public 
DisplayHUDid )
{
    if ( 
g_szName] == EOS )
        
get_user_nameid g_szName charsmaxg_szName ) );
    
    if ( --
g_iSeconds >= 
    {
        
set_hudmessage170 255 , -1.0 0.40 0.0 1.0 0.0 0.0 , -);
        
ShowSyncHudMsgg_shHUD "%s will be slayed in %d second%s!" g_szName g_iSeconds g_iSeconds "s" "" );
    }
    else
    {
        
user_killid );
        
g_iSlayID 0;
        
g_szName] = EOS;
    }

__________________

Last edited by Bugsy; 05-24-2020 at 11:01.
Bugsy is offline