SA-MP Forums Archive
How do i make a 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: How do i make a class limit? (/showthread.php?tid=69196)



How do i make a class limit? - Tranist - 16.03.2009

I made a new thread since no one was going to answer 5 questions in ne thread, so i ask-
How do i make a limit for a class (only one player ma choose this class) and a limit that depends on how many players other classes have (like there can only be a diffrence a diffrence of 2 people between cops and robbers team, I.E- there can be 4 cops and the player wont be allowed to choose cops if there isnt 3-5 robbers, and vice versa)?
HUUUUGE Thanks in advance.
P.S- sorry if my english isnt perfect, im not English speaking.


Re: How do i make a class limit? - john11johng - 25.08.2009

http://forum.sa-mp.com/index.php?topic=113300.0


Re: How do i make a class limit? - SpiderPork - 25.08.2009

I'm feeling generous today

pawn Код:
// Defines
new TeamPlayers[Number_Of_Teams],
  gTeam[MAX_PLAYERS];

// OnPlayerRequestClass
gTeam[playerid] = classid;

// OnPlayerRequestSpawn
if(TeamPlayers[gTeam[playerid] >= Max_Team_Members)
{
   SendClientMessage(playerid, RED, "This team is full.");
   return 0;
}

// OnPlayerSpawn
TeamPlayers[gTeam[playerid]]++;

// OnPlayerDeath
TeamPlayers[gTeam[playerid]]--;
Should work, I think (untested).