How to do class limit?
#1

Hey, how could I make a class limit? For example, if there's more than 3 players in one team they can't select it and have to select another one.

Thanks.
Reply
#2

use "for(new i = 0; i < MAX_PLAYERS; i ++)"
Reply
#3

Use variables.
Reply
#4

I've tried a lot of things but it doesn't works, any help? I know I have to declare "MAX_PLAYERS" but don't know how.
Reply
#5

try this
pawn Код:
// put this in the to of the script
new teamMembers[15];

// put this is OnGameModeInit
SetTimer("CheckTeams", 100, true);

// put this anywhere in the script
forward CheckTeams();
public CheckTeams()
{
  for(new i = 0; i < MAX_PLAYERS; i ++)
  {
    teamMembers[gTeam[i]] += 1;
  }
}

// then use this in your command
if(teamMembers[1] > 3) // the [1] is the team id
{
  // bla bla bla...
}
Reply
#6

Quote:
Originally Posted by James_Alex(Coder)
try this
pawn Код:
// put this in the to of the script
new teamMembers[15];

// put this is OnGameModeInit
SetTimer("CheckTeams", 100, true);

// put this anywhere in the script
forward CheckTeams();
public CheckTeams()
{
  for(new i = 0; i < MAX_PLAYERS; i ++)
  {
    teamMembers[gTeam[i]] += 1;
  }
}

// then use this in your command
if(teamMembers[1] > 3) // the [1] is the team id
{
  // bla bla bla...
}
OH MY GOD?
100 Ms Timer + a MAX_PLAYER Loop? Bad shizzle..
Reply
#7

on the blahh blahh blahh bit is that where u put code to disable class. If so what is it
Reply
#8

Quote:
Originally Posted by john11johng
on the blahh blahh blahh bit is that where u put code to disable class. If so what is it
You simply do some kind of text message saying,"team is full"
Reply
#9

Quote:
Originally Posted by Mr_FinnigaN
Quote:
Originally Posted by john11johng
on the blahh blahh blahh bit is that where u put code to disable class. If so what is it
You simply do some kind of text message saying,"team is full"
ok thanks. Sorry another question, but how would you insert the last bit into game. Wo
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)