Raised This Month: $ Target: $400
 0% 

[Help] Need good team switch plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Survival
Junior Member
Join Date: Jun 2011
Old 06-30-2011 , 01:48   [Help] Need good team switch plugin
Reply With Quote #1

Hi, can some one create auto witch team, which will work with 32 players.
Or fix this one https://forums.alliedmods.net/showthread.php?t=137016, bcz with nikhilgupta345 my server with 32 players crashing.

Thanks for your help.
Survival is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 06-30-2011 , 02:34   Re: [Help] Need good team switch plugin
Reply With Quote #2

Try this. I re-wrote the plugin:

PHP Code:
// Includes
////////////

#include < amxmodx >
#include < amxmisc >
#include < cstrike >

// Integers
////////////

new g_iCurrentRound;

// PCVars
//////////

new g_pRoundToSwitch;

public 
plugin_init()
{
    
register_plugin"Switch Teams""1.1""nikhilgupta345" );
    
    
register_clcmd"say /roundnumber""CmdDisplayRound" );
    
    
register_logevent"Event_RoundEnd"2"1=Round_End" );
    
    
register_event"TextMsg""Event_GameRestart""a""2&#Game_C""2&#Game_W" ); // Event for "Game Commencing" TextMsg and "Game Will Restart in X Seconds" TextMsg
    
    
g_pRoundToSwitch register_cvar"amx_atsrounds""15" );
}

public 
Event_GameRestartid )
{
    
g_iCurrentRound 1;
}

public 
Event_RoundEnd()
{
    if( 
g_iCurrentRound >= get_pcvar_numg_pRoundToSwitch ) )
    {
        new 
iPlayers32 ], iNum;
        
get_playersiPlayersiNum );
        
        new 
iPlayer;
        new 
CsTeams:iTeam;
        
        for( new 
0iNumi++ )
        {
            
iPlayer iPlayers];
            
            
iTeam cs_get_user_teamiPlayer );
            
            if( 
iTeam == CS_TEAM_CT || iTeam == CS_TEAM_T )
            {
                
add_delayiPlayer );
            }
        }
        
        
g_iCurrentRound 0;
    }
    
    
g_iCurrentRound++;
}

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 );
    }
}

public 
CmdDisplayRoundid )
{    
    
client_printidprint_chat"[ATS] It is currently round %d."g_iCurrentRound );
    return 
PLUGIN_HANDLED;
}

add_delayid )
{
    
set_task0.1 * (+ ((id-1) / 8)), "ChangeTeam"id );

__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please

Last edited by nikhilgupta345; 06-30-2011 at 12:37.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-30-2011 , 02:39   Re: [Help] Need good team switch plugin
Reply With Quote #3

Just for your information (don't know if you are aware of that), you can make this:

PHP Code:
add_delayid )
{
    switch( 
id )
    {
        case 
1..8set_task0.1"ChangeTeam"id );
        case 
9..16set_task0.2"ChangeTeam"id );
        case 
17..24set_task0.3"ChangeTeam"id );
        case 
25..32set_task0.4"ChangeTeam"id );
     }

PHP Code:
add_delayid )
{
    
set_task0.1 * (+ ((id-1) / 8)), "ChangeTeam"id );

joaquimandrade is offline
Survival
Junior Member
Join Date: Jun 2011
Old 06-30-2011 , 06:36   Re: [Help] Need good team switch plugin
Reply With Quote #4

nikhilgupta345, server crashing wiyh error:
Survival is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 06-30-2011 , 12:39   Re: [Help] Need good team switch plugin
Reply With Quote #5

Quote:
Originally Posted by joaquimandrade View Post
Just for your information (don't know if you are aware of that), you can make this:

PHP Code:
add_delayid )
{
    switch( 
id )
    {
        case 
1..8set_task0.1"ChangeTeam"id );
        case 
9..16set_task0.2"ChangeTeam"id );
        case 
17..24set_task0.3"ChangeTeam"id );
        case 
25..32set_task0.4"ChangeTeam"id );
     }

PHP Code:
add_delayid )
{
    
set_task0.1 * (+ ((id-1) / 8)), "ChangeTeam"id );

Didn't feel like doing the math when I wrote it. Just took it from my old plugin. Thanks for doing the math for me Added.

Quote:
Originally Posted by Survival View Post
nikhilgupta345, server crashing wiyh error:
Hmm, that's wierd. Try running it as the only 3rd party plugin running on the server.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:09.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode