29.06.2013, 17:11
(
Last edited by Blackazur; 29/06/2013 at 06:30 PM.
)
~fixed~
new team1 = 6; // exm team 1 has 6 players
new team2 = 10; // exm team 2 heas 10 players
new timer;
public OnFilterScriptInit()
{
timer = SetTimer("balanceteams", 1000, 1);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public balanceteams()
{
if (team1 > team2)
{
team2++;
team1--;
}
if (team1 < team2)
{
team2--;
team1++;
}
if(team1 == team2)
{
KillTimer(timer);
}
return 1;
}
maybe this example help you.
pawn Code:
|
stock Balance() {
new
count,
player[MAX_PLAYERS]
;
foreach(Player, i) {
player[count++] = i;
}
for(new rand, half = count / 2; halft--; count--) {
rand = random(count);
HumanSetup(player[rand]);
player[rand] = player[count];
}
while(count) {
ZombieSetup(player[--count]);
}
}