Auto-team balance.. - 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: Auto-team balance.. (
/showthread.php?tid=181887)
Auto-team balance.. -
The_Moddler - 07.10.2010
So, how can I make if there are 5 people on one team, will not let you join until there are ~3 people on the other team?
Thanks
Re: Auto-team balance.. -
willsuckformoney - 07.10.2010
You can like
pawn Code:
#define MAX_TEAM_MEMBERS 20 //Change to yours...
//OnFilterScriptInIt
SetTimerEx("AutoBalance",600000,true,"d",playerid); //600000 = 10minutes.
forward AutoBalance(playerid);
public AutoBalance(playerid)
{
//Use 'if' statement to see how many people on team, something like this
if(gTeam[playerid] > MAX_TEAM_MEMBERS)
{
SetPlayerTeam(playerid,2); // Something like this should work.
}
return 1;
}
Re: Auto-team balance.. -
kyoto - 12.11.2010
Thanks
Re: Auto-team balance.. -
Hiddos - 12.11.2010
A better idea:
pawn Code:
new TeamPlayers[ <Amount of teams here> ];
public OnPlayerRequestSpawn(playerid)
{
for(new teams; teams < [Team Amount]; teams++)
{
if(teams == GetPlayerTeam(playerid)) continue; //Or gTeam[playerid], or w/e you use.
if(TeamPlayers[Player Team Variable] > TeamPlayers[teams] + 3)
{
SendClientMessage(playerid, COLOR_RED, "You can't join this team as it would unbalance the game!");
return 0;
}
}
}
Just a small sketch of a situation, unsure if I made some mistakes in my code though.
Re: Auto-team balance.. -
Jeroen52 - 26.03.2011
I am looking for this too but sometimes there are like 6 players online and sometimes all are humans and sometimes everyone is a zombie because everyone is infected but then the teambalancer with the timer wont work because it wont reach the max teams and the one OnPlayerRequestSpawn wont work because when the Human gets infected he just changes skin, teams and weapons.