Player Class Limit?
#2

I have never done this before, maybe it'd work. An example are two teams

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 !
Reply


Messages In This Thread
Player Class Limit? - by DeltaAirlines12 - 31.08.2009, 21:09
Re: Player Class Limit? - by XtremeChio - 31.08.2009, 21:18
Re: Player Class Limit? - by XtremeChio - 01.09.2009, 12:56

Forum Jump:


Users browsing this thread: 1 Guest(s)