Player Class Limit?
#1

How would I make a player class limit so only like 5 people could be one class?
Reply
#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
#3


Yea I forgot the sign for is equal or higher. Couldn't remember you can put both together xD Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)