[UNSOLVED] Team Balance With 3 Teams
#1

Hi,

I'm searching for a Team Balance script for 3 teams... I know, there are a lot of topics about Team Balancing but I couldn't find a script...

Thanks...

EDIT: I tried myself, but it doesn't works...
Reply
#2

This maybe works for Team one and two (in one way) so far. You need to add the other stuff by yourself anyway, but you can use the same concept.

Have Fun.

pawn Код:
public Ballance()
{
new TeamPlayers[*Amount of Teams*];
for(new i=0; i<MAX_PLAYERS; i++)if(IsPlayerConnected(i))TeamPlayers[GetPlayerTeam(i)]++;

if(TeamPlayers[TEAM_TWO]<TeamPlayers[TEAM_ONE]) //Start: Ballance Team One
{
new RandPla=random(TeamPlayers[TEAM_ONE]);
if(GetPlayerTeam(RandPla)!=TEAM_ONE)
{
for(RandPla; RandPla<=MAX_PLAYERS && GetPlayerTeam(RandPla)!=TEAM_ONE, RandPla++) ForcePlayerClassSelection(RandPla);
}
if(RandPla==MAX_PLAYERS)Ballance();
else ForcePlayerClassSelection(RandPla);
} //End: Ballance Team One

return 1;
}
Reply
#3

Quote:
Originally Posted by DeathOnaStick
This maybe works for Team one and two (in one way) so far. You need to add the other stuff by yourself anyway, but you can use the same concept.

Have Fun.

pawn Код:
public Ballance()
{
new TeamPlayers[*Amount of Teams*];
for(new i=0; i<MAX_PLAYERS; i++)if(IsPlayerConnected(i))TeamPlayers[GetPlayerTeam(i)]++;

if(TeamPlayers[TEAM_TWO]<TeamPlayers[TEAM_ONE]) //Start: Ballance Team One
{
new RandPla=random(TeamPlayers[TEAM_ONE]);
if(GetPlayerTeam(RandPla)!=TEAM_ONE)
{
for(RandPla; RandPla<=MAX_PLAYERS && GetPlayerTeam(RandPla)!=TEAM_ONE, RandPla++) ForcePlayerClassSelection(RandPla);
}
if(RandPla==MAX_PLAYERS)Ballance();
else ForcePlayerClassSelection(RandPla);
} //End: Ballance Team One

return 1;
}
The thing is, I also have a balance script for 2 teams but I don't know how to change it to 3...
TnQ Anyway (:
Reply
#4

You could do something as simple as...

pawn Код:
new Teams;

public OnPlayerConnect(playerid)
{
   gTeam[playerid]= Teams;//Or whatever your team system is

   if(Teams < 2)
      Teams++;
   else
      Teams=0;

   return 1;
}
Reply
#5

Quote:
Originally Posted by Backwardsman97
You could do something as simple as...

pawn Код:
new Teams;

public OnPlayerConnect(playerid)
{
  gTeam[playerid]= Teams;//Or whatever your team system is

  if(Teams < 2)
     Teams++;
  else
     Teams=0;

  return 1;
}
Doesn't works..
Reply
#6

Well,

We are still searching..
Someone have it?

Tnx already

Reply
#7

* BUMP *
Reply
#8

Show us the balance code you already got?
Reply
#9

Quote:
Originally Posted by lrZ^ aka LarzI
Show us the balance code you already got?
Код:
public OnPlayerRequestSpawn(playerid)
{
	if (CountA > CountB && GetPlayerTeam(playerid) == TEAM_A)
	{
		SendMsg(playerid, 5000, "~b~NOTICE: ~w~This team is full!");
		return 0;
	}
	else if (CountB > CountA && GetPlayerTeam(playerid) == TEAM_B)
	{
		SendMsg(playerid, 5000, "~b~NOTICE: ~w~This team is full!");
		return 0;
	}
	else return 1;
}

OnPlayerDeath and OnplayerDisconnect;
			if (GetPlayerTeam(playerid) == TEAM_A)
		 	{
		 		CountA--;
		  }
		  	else if (GetPlayerTeam(playerid) == TEAM_B)
		  	{
		  		CountB--;
		  	}

OnPlayerSpawn;
			if (GetPlayerTeam(playerid) == TEAM_A)
		 	{
		 		CountA++;
		  }
		  	else if (GetPlayerTeam(playerid) == TEAM_B)
		  	{
		  		CountB++;
		  	}
Reply
#10

Try this (not tested, i'm at work.. cannot test right now)

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if ( CountA > CountB && CountA > CountC && GetPlayerTeam(playerid) == TEAM_A)
    {
        SendMsg(playerid, 5000, "~b~NOTICE: ~w~This team is full!");
        return 0;
    }
    else if ( CountB > CountA && CountB > CountC && GetPlayerTeam(playerid) == TEAM_B)
    {
        SendMsg(playerid, 5000, "~b~NOTICE: ~w~This team is full!");
        return 0;
    }
    else if ( CountC > CountA && CountC > CountB && GetPlayerTeam(playerid) == TEAM_C)
    {
        SendMsg(playerid, 5000, "~b~NOTICE: ~w~This team is full!");
        return 0;
    }
    else return 1;
}

OnPlayerDeath and OnplayerDisconnect;
if (GetPlayerTeam(playerid) == TEAM_A)
{
    CountA--;
}
else if (GetPlayerTeam(playerid) == TEAM_B)
{
    CountB--;
}
else if (GetPlayerTeam(playerid) == TEAM_C)
{
    CountC--;
}

OnPlayerSpawn;
if (GetPlayerTeam(playerid) == TEAM_A)
{
    CountA++;
}
else if (GetPlayerTeam(playerid) == TEAM_B)
{
    CountB++;
}
else if (GetPlayerTeam(playerid) == TEAM_C)
{
    CountC++;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)