Thread: auto swap teams
View Single Post
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 05-09-2008 , 10:57   Re: auto swap teams
Reply With Quote #7

Quote:
Originally Posted by Sn!ff3r View Post
better than this is
PHP Code:
set_cvar_num("sv_restartround",1
It is better with pcvar if you use that way.
Here is the script :
PHP Code:
#include <amxmodx>
#include <cstrike>

new round_countsv_restartround
new cvar_maxrounds

public plugin_init()
{
    
register_plugin("Auto Team Switcher""0.1""RazaR")
    
register_logevent("event_round_end"2"1=Round_End")

    
cvar_maxrounds    =    register_cvar("amx_maxrounds""15")
    
sv_restartround    =    get_cvar_pointer("sv_restartround")
}

public 
event_round_end()
{
    
round_count++
 
    if ( 
round_count >= get_pcvar_num(cvar_maxrounds) )
    {
        
round_count 0
        client_print
(0print_chat"[Zombie Swarm] Round limit reached, switching teams...")

        new 
numplayers[32]
        
get_players(playersnum"h")

        for (new 
0<= numi++)
        {
            if (!
is_user_connected(players[i]))
                continue

            if (
cs_get_user_team(players[i]) == CS_TEAM_UNASSIGNED || cs_get_user_team(players[i]) == CS_TEAM_SPECTATOR)
                continue

            if (
cs_get_user_team(players[i]) == CS_TEAM_T)
                
cs_set_user_team(players[i], CS_TEAM_CT)

            else
                
cs_set_user_team(players[i], CS_TEAM_T)

        }
        
set_pcvar_string(sv_restartround"1")
    }

__________________
atomen is offline
Send a message via MSN to atomen