This is from my Warmod_BFG. Not exactly what you want but could be a starting point for you.
Sets the maximum players allowed on both teams combined, others will be forced to spectator
PHP Code:
new Handle:g_h_max_players = INVALID_HANDLE;
RegConsoleCmd("jointeam", ChooseTeam);
g_h_max_players = CreateConVar("wm_max_players", "10", "Sets the maximum players allowed on both teams combined, others will be forced to spectator (0 = unlimited)", FCVAR_NOTIFY, true, 0.0);
public Action:ChooseTeam(client, args)
{
if (!IsActive(client, true))
{
return Plugin_Continue;
}
if (client == 0)
{
return Plugin_Continue;
}
if (g_match && GetClientTeam(client) > 1 && GetConVarBool(g_h_locked))
{
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Change Teams Midgame");
return Plugin_Stop;
}
new max_players = GetConVarInt(g_h_max_players);
if ((g_ready_enabled || g_match) && max_players != 0 && GetClientTeam(client) <= 1 && CS_GetPlayingCount() >= max_players)
{
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Maximum Players");
ChangeClientTeam(client, SPECTATOR_TEAM);
return Plugin_Stop;
}
return Plugin_Continue;
}
__________________