31.08.2009, 21:18
I have never done this before, maybe it'd work. An example are two teams
I hope this is what you want. If you got other teams just use 'else if' bla bla.
THIS IS NOT TESTED, I NEVER MADE SOMETHING LIKE THIS, BUT I THINK IT SHOULD WORK !
pawn Код:
// Somewhere on top of script
new PoliceCount;
//=============
//Put this under OnGameModeInit
PoliceCount = 0;
//=============
//Under OnPlayerRequestSpawn
if(gTeam[playerid] == TEAM_POLICE)
{
PoliceCount += 1;
}
//=============
//Under OnPlayerRequestSpawn
if(gTeam[playerid] == TEAM_POLICE && PoliceCount >= 5)
{
SendClientMessage(playerid,COLOR_RED,"There are already 5 police officers, choose another team!");
return 0;
}
//==================
//Put this under OnPlayerDisconnect
if(gTeam[playerid] == TEAM_POLICE)
{
PoliceCount -= 1;
}
I hope this is what you want. If you got other teams just use 'else if' bla bla.
THIS IS NOT TESTED, I NEVER MADE SOMETHING LIKE THIS, BUT I THINK IT SHOULD WORK !