31.08.2009, 21:09
How would I make a player class limit so only like 5 people could be one class?
// 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;
}