14.04.2009, 01:08
pawn Код:
// Top of script
#define TeamAmount 10 // Replace this if you want more teams
#define MaxTeamPlayers 25 // Max players allowed on a team
PlayersOnTeam[TeamAmount];
// Anywhere in script
public OnPlayerSpawn(playerid)
{
if(PlayersOnTeam[Team[playerid]] > MaxTeamPlayers) // Replace team with your variable for teams e.g. gTeam
{
SendClientMessage(playerid, color, "Team full, Assigning you to a different team"); // Replace color with a color of your choice
Team[playerid] = random(MaxTeamPlayers);// Replace team with your variable for teams e.g. gTeam
SetPlayerHealth(playerid, 0);
return 1;
}
else
{
PlayersOnTeam[Team[playerid]]++;// Replace team with your variable for teams e.g. gTeam
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayersOnTeam[Team[playerid]]--;// Replace team with your variable for teams e.g. gTeam
return 1;
}