Switch Team Help

Сообщения
43
Реакции
0
Hello i find one plugin for switch team, but i read can make problem if server have very much player im try to use in 32 slot can you tell me if i can use i dont like to crash my server, im using last amxx version


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

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

#pragma semicolon 1

new roundnumber = 0;
new Atsround;

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);

register_clcmd( "say /roundnumber", "sayRound" );
register_concmd( "amx_roundrestart", "restartnumber", ADMIN_KICK );

register_logevent( "roundend", 2, "1=Round_End" );
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", "15" );

}

public sayRound( id )
{
client_print( id, print_chat, "The current round is %i.", roundnumber );
return PLUGIN_HANDLED;
}

public roundend()
{
roundnumber++;

if( roundnumber >= get_pcvar_num( Atsround ) )
{
new players[32], num;
get_players( players, num );

for( new i; i < num; i++ )
add_delay( players[i] ); // Prevent Server Crash with a lot of people.

}
}


public restartnumber( id, level, cid )
{
if( !cmd_access( id, level, cid, 1 ) )
return PLUGIN_HANDLED;

roundnumber = 0;
return PLUGIN_HANDLED;
}

public restart( id )
{
roundnumber = 0;
return PLUGIN_HANDLED;
}

public changeTeam( id )
{
switch( cs_get_user_team( id ) )
{
case CS_TEAM_CT: cs_set_user_team( id, CS_TEAM_T );

case CS_TEAM_T: cs_set_user_team( id, CS_TEAM_CT );
}

roundnumber = 0;
}

add_delay( id )
{
switch( id )
{
case 1..7: set_task( 0.1, "changeTeam", id );
case 8..15: set_task( 0.2, "changeTeam", id );
case 16..23: set_task( 0.3, "changeTeam", id );
case 24..32: set_task( 0.4, "changeTeam", id );
}
}
 
Сообщения
1,082
Реакции
58
Помог
11 раз(а)
trendafili,
Код:
public changeTeam( id ) {
    if(!is_user_connected(id))
        return;

    switch( cs_get_user_team( id ) ) {
        case CS_TEAM_CT: cs_set_user_team( id, CS_TEAM_T );
        case CS_TEAM_T: cs_set_user_team( id, CS_TEAM_CT );
    }

    roundnumber = 0;
}
И обнулять раунд надо раньше, в функции add_delay
 

Пользователи, просматривающие эту тему

Сейчас на форуме нет ни одного пользователя.
Сверху Снизу