Help me with Team Balancer - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me with Team Balancer (
/showthread.php?tid=140504)
Help me with Team Balancer -
Awerop - 09.04.2010
Someone help me make a team balancer? i tried, it gave no errors but it still doesnt work, ,, lets to many players on one team
i have 5 teams,,, help please
Re: Help me -
Grim_ - 09.04.2010
Take off of this example:
playerid - the player
team_1 - the team that is being calculated by the ratio
team_2 - the other team
ratio - the ratio of which to balance team 1 from team 2
teamvar - the variable to hold the player's team
EXAMPLE:
pawn Код:
OnPlayerSpawn(playerid)
{
TeamBalance(playerid, TEAM_GREEN, TEAM_BLUE, 1, Team); // Sets the balance of the teams equal
}
pawn Код:
TeamBalance(playerid, team_1, team_2, ratio, teamvar[]) {
new result_var = (Players() / ratio);
for(new x = 0; x < MAX_PLAYERS; x++) {
if(teamvar[x] == team_1) {
count++;
}
}
if(count < result_var) {
teamvar[playerid] = team_1;
} else {
teamvar[playerid] = team_2;
}
}
Re: Help me with Team Balancer -
Awerop - 09.04.2010
on my server i have something like this
Код:
if(TeamPlayers[gTeam[playerid]-1] > Players /5 +1)
{
GameTextForPlayer(playerid, "~g~THIS TEAM IS ~r~FULL~w~, choose ~b~another~w~!", 1500, 3);
return 0;
}
return 1;
}