Thread: auto swap teams
View Single Post
NestleMilo
BANNED
Join Date: May 2008
Location: http://zombieplague.org
Old 05-09-2008 , 07:42   Re: auto swap teams
Reply With Quote #2

I used this for my "Zombie Swarm" server.

PHP Code:
#include <amxmodx>
#include <cstrike>
 
new round_countcvar_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
(0print_chat"[Zombie Swarm] Round limit reached, switching teams...")
 
for (new 
i=1i<=32i++)
{
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(iCS_TEAM_CT)
else
cs_set_user_team(iCS_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(0print_chat"[Zombie Swarm] Round limit reached, switching teams..."
to

PHP Code:
client_print(0print_chat"[WHAT EVER YOU WANT] Round limit reached, switching teams..."

Last edited by NestleMilo; 05-09-2008 at 07:48.
NestleMilo is offline