AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Team switch with some things (https://forums.alliedmods.net/showthread.php?t=117769)

Storas1337 02-04-2010 13:59

Team switch with some things
 
Hello i found in internet plugin sma which every round writing round number and after 15rounds Team T and CT is changing TEAMS(without restart)
What me need:
Maybe ho one can add RESTART after 15rounds?
And if it possible make calculation of RESULT OF TEAMS ETC T 2 - CT 3
3.Maybe if you can make ROUND WRITE ONLY EVERY FIVE ROUNDS ITS VERY
good no more help needed
THNX WHO whant helps
Code:

#include <amxmodx>
#include <fakemeta>

#define OFFSET_TEAM    114

enum
{
    TEAM_NULL, // LOL NULL
    TEAM_T,
    TEAM_CT,
    TEAM_SPECTATOR
}

new g_iCounter = 0;
new p_Rounds;
new g_Msg_TeamInfo;
new g_iMaxPlayers;

public plugin_init()
{
    register_plugin( "Team Switch", "1.5", "TBagT" );
   
    p_Rounds = register_cvar( "ats_rounds", "15" );
    register_event("TextMsg", "RoundRestart_Attempt", "a", "2&#Game_C", "2&Game_W");
    register_logevent("logevent_round_start2", 2, "1=Round_Start")
    register_logevent("logevent_round_end2", 2, "1=Round_End")
    g_iMaxPlayers = get_maxplayers();
    g_Msg_TeamInfo = get_user_msgid( "TeamInfo" );
}

public server_changelevel( map[] )
{
    g_iCounter = 0;
}

public plugin_pause()
{
    g_iCounter = 0;
}

public RoundRestart_Attempt()
{
    g_iCounter = 0;
}
public logevent_round_end2()
{
    if( get_playersnum() > 1 )
    {
        if ( g_iCounter >= get_pcvar_num( p_Rounds ) )
        {
            g_iCounter = 0;
           
            new team, oppTeam;
            for( new i = 1 ; i <= g_iMaxPlayers ; i++ )
            {
                if( !is_user_connected( i ) )    continue;
               
                team = get_user_team( i );
                if( team == TEAM_SPECTATOR )    continue;
       
                set_hudmessage( 200, 0, 0, -1.0, -1.0, 1, 6.0, 12.0 );
                show_hudmessage( 0, "Switching teams!" );
       
                oppTeam = team % 2 + 1;
                fm_set_user_team( i, oppTeam );
            }
        }
        else
        {
            set_hudmessage( 0, 100, 0, -1.0, -1.0, 1, 6.0, 12.0 );
            show_hudmessage( 0, "Teams will switch in: %d (rounds)", ( get_pcvar_num( p_Rounds ) - g_iCounter ) );
        }
    }
   
}
public logevent_round_start2()
{
    g_iCounter++;
}
fm_set_user_team( index, iTeam )
{
    static const Teams[][] =
    {
        "", // NULL
        "TERRORIST",
        "CT"
    }
   
    set_pdata_int( index, OFFSET_TEAM, iTeam );
    dllfunc( DLLFunc_ClientUserInfoChanged, index, engfunc( EngFunc_GetInfoKeyBuffer, index ) );
   
    message_begin( MSG_ONE_UNRELIABLE, g_Msg_TeamInfo, { 0, 0, 0 }, index );
    write_byte( index );
    write_string( Teams[ iTeam ] );
    message_end();
   
    return 1;
}



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

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