I had a similar problem and came up with this for TF2. It may help you....
Code:
#include <sourcemod>
public Plugin:myinfo =
{
name = "Balance Team",
author = "PC Gamer",
description = "Place equal number of Players on each team",
version = "PLUGIN_VERSION 1.0",
}
public OnPluginStart()
{
RegAdminCmd("sm_balance", Command_balteam, ADMFLAG_SLAY, "Balance the Players on Each Team");
}
public Action Command_balteam(client, args)
{
new pcount = 1
for(new i = 1; i < MaxClients; i++)
{
if (IsClientInGame(i) && (pcount % 2 == 0))
{
ChangeClientTeam(i, 2); //change player to Red Team
}
if (IsClientInGame(i) && (pcount % 2 == 1))
{
ChangeClientTeam(i, 3); //change player to Blue Team
}
if (IsClientInGame(i))
{
pcount++;
}
}
return Plugin_Handled;
}