I used this for my "Zombie Swarm" server.
PHP Code:
#include <amxmodx>
#include <cstrike>
new round_count, cvar_maxrounds
public plugin_init()
{
register_plugin("Auto Team Switcher", "0.1", "RazaR")
register_logevent("event_round_end", 2, "1=Round_End")
// hoy many rounds to be played before switching teams
cvar_maxrounds = register_cvar("amx_maxrounds", "15")
}
public event_round_end()
{
round_count++
if ( round_count >= get_pcvar_num(cvar_maxrounds) )
{
round_count = 0
client_print(0, print_chat, "[Zombie Swarm] Round limit reached, switching teams...")
for (new i=1; i<=32; i++)
{
if (!is_user_connected(i))
continue;
if (cs_get_user_team(i) == CS_TEAM_UNASSIGNED || cs_get_user_team(i) == CS_TEAM_SPECTATOR)
continue;
if (cs_get_user_team(i) == CS_TEAM_T)
cs_set_user_team(i, CS_TEAM_CT)
else
cs_set_user_team(i, CS_TEAM_T)
}
}
}
Cvars
PHP Code:
amx_maxrounds 15 | 15 is default //# of rounds it takes to switch a team
Changing the prefix of the mod goes as following:
PHP Code:
client_print(0, print_chat, "[Zombie Swarm] Round limit reached, switching teams...")
to
PHP Code:
client_print(0, print_chat, "[WHAT EVER YOU WANT] Round limit reached, switching teams...")