Raised This Month: $51 Target: $400
 12% 

Switching Teams in 3 rounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Osviux
Senior Member
Join Date: May 2009
Location: Lithuania
Old 05-04-2009 , 13:10   Switching Teams in 3 rounds
Reply With Quote #1

I need a plugin soo teams would change every 3 rounds because no one wants to be a zombie for ever ;D
Osviux is offline
Send a message via Skype™ to Osviux
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-04-2009 , 13:24   Re: Switching Teams in 3 rounds
Reply With Quote #2

I've made it before and I've edited it for your needs.

PHP Code:

                        
/* AUTO TEAMS SWITCH 
                             version 1.0
                              by Dores  */

#include <amxmodx>
#include <fakemeta>

#define OFFSET_TEAM    114
#define IsValidTeam(%1)    ( 1 <= %1 <= 2 )


new p_Onp_Rounds;
new 
g_iCounter 0g_iMaxPlayers;
new 
g_Msg_TeamInfo;

public 
plugin_init()
{
    
register_plugin("Auto Team Switch""1.0""Dores");
    
    
p_On register_cvar("ats_on""1");
    
p_Rounds register_cvar("ats_rounds""3");
    
register_event("TextMsg""RoundRestart_Attempt""a""2&#Game_c""2&#Game_w");
    
register_logevent("RoundEnd"2"3=Terrorists_Win");
    
register_logevent("RoundEnd"2"3=CTs_Win");
    
g_iMaxPlayers get_maxplayers();
    
g_Msg_TeamInfo get_user_msgid("TeamInfo");
}

public 
plugin_end()
{
    
g_iCounter 0;
}

public 
RoundRestart_Attempt()
{
    
g_iCounter 0;
}

public 
RoundEnd()
{
    if(
get_pcvar_num(p_On) && get_playersnum() > 1)
    {
        new 
max get_pcvar_num(p_Rounds);
        if(
g_iCounter++ == max)
        {
            
set_hudmessage(02551700.260.0406.012.0);
            
show_hudmessage(0"Switching teams!");
            
            
g_iCounter 0;
            
            new 
teamoppTeam;
            for(new 
<= g_iMaxPlayers i++)
            {
                if(!
is_user_connected(i))    continue;
                
                
team get_user_team(i);
                if(!
IsValidTeam(team))    continue;
                
                
oppTeam team 1;
                
fm_set_user_team(ioppTeam);
            }
        }
        
        else
        {
            
set_hudmessage(5025700.00.1506.012.0);
            
show_hudmessage(0"Rounds left until teams switch: %d"max g_iCounter);
        }
    }
    
    return 
PLUGIN_CONTINUE;
}

fm_set_user_team(indexiTeam)
{
    static const 
Teams[][] =
    {
        
""// NULL
        
"TERRORIST",
        
"CT"
    
}
    
    
set_pdata_int(indexOFFSET_TEAMiTeam);
    
dllfunc(DLLFunc_ClientUserInfoChangedindexengfunc(EngFunc_GetInfoKeyBufferindex));
    
    
message_begin(MSG_ONE_UNRELIABLEg_Msg_TeamInfo, { 00}, index);
        
write_byte(index);
        
write_string(Teams[iTeam]);
    
message_end();
    
    return 
1;

__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 05-04-2009 at 15:33.
Dores is offline
Osviux
Senior Member
Join Date: May 2009
Location: Lithuania
Old 05-04-2009 , 13:29   Re: Switching Teams in 3 rounds
Reply With Quote #3

That plugin doesnt work and this one works fine

Quote:
#include < amxmodx >
#include < cstrike >

new g_iRounds
new g_pSwitchAfter

public plugin_init( )
{
register_plugin( "TeamSwitcher", "1.0", "Battousai-sama" )
register_logevent( "LogeventEndRound", 2, "1=Round_End" )

g_pSwitchAfter = register_cvar( "amx_switch_after", "3" )
}

public
LogeventEndRound( )
{
if (
g_iRounds++ > get_pcvar_num( g_pSwitchAfter ) )
{
new
iPlayers[ 32 ]
new
iNum
get_players
( iPlayers, iNum )

for ( new
a = 0; a < iNum; a++ )
switch (
cs_get_user_team( iPlayers[ a ] ) )
{
case
1:
cs_set_user_team( iPlayers[ a ], CS_TEAM_CT, CS_CT_GIGN )
case
2:
cs_set_user_team( iPlayers[ a ], CS_TEAM_T, CS_T_LEET )
}

g_iRounds = 0
return
}
g_iRounds++
}
When 3 rounds pass teams changes

Last edited by Osviux; 05-04-2009 at 13:55.
Osviux is offline
Send a message via Skype™ to Osviux
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-04-2009 , 15:33   Re: Switching Teams in 3 rounds
Reply With Quote #4

Sorry, fixed my code if anyone still want to use it.

EDIT: My code also tells the players how many rounds left.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ

Last edited by Dores; 05-04-2009 at 15:39.
Dores is offline
Osviux
Senior Member
Join Date: May 2009
Location: Lithuania
Old 05-05-2009 , 10:07   Re: Switching Teams in 3 rounds
Reply With Quote #5

it still doesnt work does it work for you? D:
Osviux is offline
Send a message via Skype™ to Osviux
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-05-2009 , 15:59   Re: Switching Teams in 3 rounds
Reply With Quote #6

It works but not right... Never mind, use the other code...
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
rumbeto
Member
Join Date: Feb 2007
Old 05-05-2009 , 17:06   Re: Switching Teams in 3 rounds
Reply With Quote #7

Hi, I was wondering if this could be made a little more complex. Could anyone do it to switch teams on half of the time elapsed? What I mean - the plugin gets the map timelimit at map start and switches teams when half of the map time have elapsed. This could be very easily done this way: at the end of every round the plugin checks if half of the time have passed and switches the teams the next round.

Last edited by rumbeto; 05-05-2009 at 17:38.
rumbeto is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 05-05-2009 , 18:38   Re: Switching Teams in 3 rounds
Reply With Quote #8

I think someone has already requested this somewhere, try searching.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
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 02:29.


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