Full team
#1

Hello!

Im looking for, if a Team have 4 players spawned, if someone want to spawn in that team, he cant

Someone know something about this?
Reply
#2

Team Balance?
pawn Code:
#define BALANCER 20 // Amount of players in team

public OnGameModeInit() {
     for(new i=0; i<MAX_PLAYERS; i++) {
          SetTimerEx("Trololo",AmountOfMinToCheckTeamBalance,true,"d", i);
     }
     return 1;
}

forward Trololo(playerid);
public Trololo(playerid)
{
      if(TeamInfo[playerid] > BALANCER)  {
           SetPlayerTeam(playerid,MYTEAM);
      }
      if(TeamInfo[playerid] < BALANCER) {
           SetPlayerTeam(playerid,MYTEAM2);
      }
      return 1;
}
Reply
#3

No, i mean, if a team for example Army have 5 players spawned, and the 6th want to spawn, he cant.
Reply
#4

pawn Code:
new count;
for(new i;i<MAX_PLAYERS;i++)
{
    if(PlayerTeam[i] == 3) count ++;//Of course change this line
}
if(count > 5)
{
    //You can freeze player, set their pos to somewhere, and make them spectating other player.
}
else
{
    //Spawn player
}
Reply
#5

pawn Code:
new
    iArmyCounts,
    iRobberCounts
;

public OnPlayerSpawn( playerid )
{
    if ( GetPlayerTeam( playerid ) == TEAM_ARMY ) iArmyCounts ++;
    if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS ) iRobberCounts ++;

    return 1;
}

public OnPlayerRequestSpawn( playerid )
{
    if ( GetPlayerTeam( playerid ) == TEAM_ARMY )
    {
        if ( iArmyCounts < iRobberCounts )
            return !SendClientMessage( playerid, -1, "Please join robbers team." );
    }

    if ( GetPlayerTeam( playerid ) == TEAM_ROBBERS )
    {
        if ( iRobberCounts < iArmyCounts )
            return !SendClientMessage( playerid, -1, "Please join army team." );
    }

    return 1;
}
pawn Code:
return !print( "lol" );
// ==
return print( "lol" ), 0;
// afaik xD
Hope this one works, and helped you.

EDIT: I got what do you meant.

pawn Code:
new
    iArmyCounts
;

public OnPlayerSpawn( playerid )
{
    if ( GetPlayerTeam( playerid ) == TEAM_ARMY )
        iArmyCounts ++;

    return 1;
}

public OnPlayerRequestSpawn( playerid )
{
    if ( GetPlayerTeam( playerid ) == TEAM_ARMY )
    {
        if ( iArmyCounts >= 5 )
            return !SendClientMessage( playerid, -1, "Team army is full." );
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)