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;
}
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 Код:
|
new Teams;
public OnPlayerConnect(playerid)
{
gTeam[playerid]= Teams;//Or whatever your team system is
if(Teams < 2)
Teams++;
else
Teams=0;
return 1;
}
Originally Posted by Backwardsman97
You could do something as simple as...
pawn Код:
|
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++; }
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++;
}