07.10.2010, 19:41
So, how can I make if there are 5 people on one team, will not let you join until there are ~3 people on the other team?
Thanks
Thanks
#define MAX_TEAM_MEMBERS 20 //Change to yours...
//OnFilterScriptInIt
SetTimerEx("AutoBalance",600000,true,"d",playerid); //600000 = 10minutes.
forward AutoBalance(playerid);
public AutoBalance(playerid)
{
//Use 'if' statement to see how many people on team, something like this
if(gTeam[playerid] > MAX_TEAM_MEMBERS)
{
SetPlayerTeam(playerid,2); // Something like this should work.
}
return 1;
}
new TeamPlayers[ <Amount of teams here> ];
public OnPlayerRequestSpawn(playerid)
{
for(new teams; teams < [Team Amount]; teams++)
{
if(teams == GetPlayerTeam(playerid)) continue; //Or gTeam[playerid], or w/e you use.
if(TeamPlayers[Player Team Variable] > TeamPlayers[teams] + 3)
{
SendClientMessage(playerid, COLOR_RED, "You can't join this team as it would unbalance the game!");
return 0;
}
}
}