Player Class Limit? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Player Class Limit? (
/showthread.php?tid=94755)
Player Class Limit? -
DeltaAirlines12 - 31.08.2009
How would I make a player class limit so only like 5 people could be one class?
Re: Player Class Limit? -
XtremeChio - 31.08.2009
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 !
Re: Player Class Limit? -
XtremeChio - 01.09.2009
Yea I forgot the sign for is equal or higher. Couldn't remember you can put both together xD Thanks.