Код:
#define TEAM_1 1
#define TEAM_2 2
new Team1 = 0;
new Team2 = 0;
public OnGameModeInit()
{
AddPlayerClass(...); // Team 1
AddPlayerClass(...); // Team 2
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 0) { SetPlayerTeam(playerid, TEAM_1); }
else if(classid == 1) { SetPlayerTeam(playerid, TEAM_2); }
return 1;
}
public OnPlayerSpawn(playerid)
{
if(GetPlayerTeam(playerid) == TEAM_1)
{
Team1 ++;
}
else if(GetPlayerTeam(playerid) == TEAM_1)
{
Team2 ++;
}
}
public OnPlayerRequestSpawn(playerid)
{
if(TEAM_1 > TEAM_2 +1)
{
SendClientMessage(playerid, 0x000000, "Team is full, choose the other");
return 1;
}
elseif(TEAM_1 > TEAM_2 +1)
{
SendClientMessage(playerid, 0x000000, "Team is full, choose the other");
return 1;
}
return 1;
}
I just made this on the spot, so it's not tested yet.