[help] "Team is full."
#1

Hello, does anybody know how to get an anti-spawn?
I mean if somebody wants to spawn, the team is full, he can't spawn by pressing SHIFT.
The player presses SHIFT, he can't spawn, a message appears ("Team is full.").
Do you understand?
Thanks for help.
Reply
#2

post the script
Reply
#3

Here's a part of my script:
pawn Код:
#define TEAM_ALPHA 1
#define TEAM_GAMMA 2
new AlphaMembers;
new GammaMembers;
public OnPlayerSpawn(playerid)
{
    switch(gClass[playerid])
    {
      case 0:
      {
            AlphaMembers++;
      }
      case 1:
      {
            GammaMembers++;
      }
    }
    return 1;
}
Reply
#4

You can try something like this, though don't know if it'll work.
pawn Код:
public OnPlayerSpawn(playerid)
{
  switch(gClass[playerid])
  {
    case 0:
    {
      AlphaMembers++;
    }
    case 1:
    {
      GammaMembers++;
    }
  }
  if(gClass[playerid] == 0) { if(AlphaMembers > GammaMembers) { SendClientMessage(playeird, color, "TeamFull!"); return 0; } }
  else if(gClass[playerid] == 1) { if(GammaMembers > AlphaMembers) { SendClientMessage(playerid, color, "TeamFull!"); return 0; } }
  return 1;
}
Reply
#5

Return 0; with an IF statement of something under public OnPlayerRequestSpawn(playerid)
Reply
#6

Ah, I understand. In my case it would be:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(gClass[playerid] == 0)
    {
        if(AlphaMembers > GammaMembers)
        {
            SendClientMessage(playerid,COLOR, "Team is full!");
            return 0;
        }
    }
    else if(gClass[playerid] == 1)
    {
        if(GammaMembers > AlphaMembers)
        {
            SendClientMessage(playerid,COLOR, "Team is full.");
            return 0;
        }
    }
    return 1;
}
By the way, I found this at Wiki:
https://sampwiki.blast.hk/wiki/OnPlayerRequestSpawn

Thanks all for help!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)