Teambalance help.
#1

pawn Код:
for(new p = 0; p < GetMaxPlayers(); p++)
    {
        if(IsPlayerConnected(p))
        {
            if (gTeam[p] == TEAM_HOBO)
            {
                count1++;
            }
            else if (gTeam[p] == TEAM_RICH)
            {
                count2++;
            }
        }
    }
    if ((count1 > count2) && gTeam[playerid] == TEAM_HOBO)
    {
        SendClientMessage(playerid, COLOR_SERVER, "[SERVER]: Choose another team to keep the teams even!");
        SetPlayerHealth(playerid,100.0);
        return 0;
    }
    else if ((count2 > count1) && gTeam[playerid] == TEAM_RICH)
    {
        SendClientMessage(playerid, COLOR_SERVER, "[SERVER]: Choose another team to keep the teams even!");
        SetPlayerHealth(playerid,100.0);
        return 0;
    }
    return 1;
}
Alright, so that's my team balancer but it's not working properly.

I can only select 1 class at the beginning :S

And I am only capeable to select 1 team.

Help please
Reply
#2

Bumpy dumy.
Reply
#3

Same reason as above.
Reply
#4

Bump.
Reply
#5

Код:
public OnPlayerRequestSpawn(playerid)
{
  new Count1, Count2;
  for(new p = 0; p < GetMaxPlayers(); p++)
  {
    if (GetPlayerTeam(p) == TEAM_Terrorist) Count1++;
    else if (GetPlayerTeam(p) == TEAM_Army) Count2++;
  }
  if ((Count1 > Count2) && GetPlayerTeam(playerid) == TEAM_Army)
  {
    SendClientMessage(playerid,COLOR_RED, "[BALANCER] Balancing teams. Choose Another Team");
    return 0;
  }
  else if ((Count2 > Count1) && GetPlayerTeam(playerid) == TEAM_Terrorist)
  {
    SendClientMessage(playerid,COLOR_RED, "[BALANCER] Balancing teams. Choose Another Team");
    return 0;
  }
  return 1;
}
Rember to change TEAMS !
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)