Quake Style - Quake 3 Tutorials
Game Enhancements - Forcing Teams for CTF!
Puts players on the team with less players when they enter the game.

Forcing Teams!

This tutorial will make it so anyone joining a team or ctf game will automatically be assigned to the team with fewer players.

Open g_client.c and goto line 695 in the ClientConnect function. Add the following line of code:
  
int team;
 

Move down to about line 747 and change this function:
 
	if ( g_gametype.integer >= GT_TEAM &&
		client->sess.sessionTeam != TEAM_SPECTATOR ) {
		BroadcastTeamChange( client, -1 );
	}


so it looks like this:
  

	if ( g_gametype.integer >= GT_TEAM )
	{
		team = PickTeam(clientNum);
		client->sess.sessionTeam = team;
		BroadcastTeamChange(client, team);
	}
 

This calls the PickTeam function wich returns the team number of the team with fewer players. client->sess.sessionTeam = team; makes sure the player is assigned to the team returned by PickTeam;


-- Credits:
   Tutorial by Gerbil!
   Return to QS Tutorials

-- Important:
   If you do use something from QuakeStyle in your mod, please give us credit.
   Our code is copyrighted, but we give permission to everyone to use it in any way they see fit, as long as we are recognized.