View Single Post
Ahmad111
Member
Join Date: Jul 2019
Old 08-15-2019 , 07:44   Re: [ReQ] teams switch after round 10
Reply With Quote #8

Quote:
Originally Posted by iceeedr View Post
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Auto Team Switcher"
#define VERSION "1.0"
#define AUTHOR "nikhilgupta345"

new ctrounds
new trrounds
new Atsround;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_clcmd"say /roundnumber""sayRound" );
    
register_concmd"amx_roundrestart""restartnumber"ADMIN_KICK );
    
    
register_logevent"roundend"2"1=Round_End" );
    
register_event("SendAudio""EventTRWin","a""2&%!MRAD_terwin")
    
register_event("SendAudio""EventCTWin","a""2&%!MRAD_ctwin")
    
register_event"TextMsg","restart","a","2&#Game_C""2&#Game_W" ); // Event for "Game Commencing" TextMsg and "Game Will Restart in X Seconds" TextMsg
    
    
Atsround register_cvar"amx_atsrounds""10" );
    
}

public 
EventTRWin()
{
    
trrounds++
}

public 
EventCTWin()
{
    
ctrounds++
}

public 
sayRoundid )
{
    
client_printidprint_chat"The current round is CT %i - TR %i."ctroundstrrounds );
    return 
PLUGIN_HANDLED;
}

public 
roundend()
{
    if( 
trrounds >= get_pcvar_numAtsround ) || ctrounds >= get_pcvar_numAtsround ))
    {
        new 
players[32], num;
        
get_playersplayersnum );
        
        for( new 
inumi++ )
            
add_delayplayers[i] ); // Prevent Server Crash with a lot of people.
            
    
}
}


public 
restartnumberidlevelcid )
{
    if( !
cmd_accessidlevelcid) )
        return 
PLUGIN_HANDLED;
    
    
trrounds ctrounds 0
    
return PLUGIN_HANDLED;
}

public 
restartid )
{
    
trrounds ctrounds 0
    
return PLUGIN_HANDLED;
}

public 
changeTeamid )
{
    switch( 
cs_get_user_teamid ) )
    {
        case 
CS_TEAM_CTcs_set_user_teamidCS_TEAM_T );
        
        case 
CS_TEAM_Tcs_set_user_teamidCS_TEAM_CT );
    }

    
trrounds ctrounds 0
}

add_delayid )
{
    switch( 
id )
    {
        case 
1..7set_task0.1"changeTeam"id );
        case 
8..15set_task0.2"changeTeam"id );
        case 
16..23set_task0.3"changeTeam"id );
        case 
24..32set_task0.4"changeTeam"id );
    }

can you make a cvar for on/off the plugin ?
Ahmad111 is offline