Team Balance and Auto Team Balance
#9

In my opinion foreach is essential part of a gamemode and except the pre-made iterators, you can make your own iterators which come in handy for many cases.

To add to gurmani11's post, when I read "auto team balance" I remembered something I had written in the past:
pawn Код:
// modified for his version:

AutoTeamBalance()
{
    new i, j, random_player;

    Iter_Clear(TeamRedPlayer);
    Iter_Clear(TeamBluePlayer);

    foreach(i : Player)
    {
        if (/* player is logged in/spawned etc. - able to play in next round, in other words */)
        {
            Iter_Add(TeamRedPlayer, i);
        }
    }

    for (i = 0, j = Iter_Count(TeamRedPlayer) / 2; i <= j; i++)
    {
        random_player = Iter_Random(TeamRedPlayer);
     
        Iter_Add(TeamBluePlayer, random_player);
        Iter_Remove(TeamRedPlayer, random_player);
    }
}
Reply


Messages In This Thread
Team Balance and Auto Team Balance - by NeXoR - 11.10.2016, 12:59
Re: Team Balance and Auto Team Balance - by oMa37 - 11.10.2016, 13:02
Re: Team Balance and Auto Team Balance - by iLearner - 11.10.2016, 13:02
Re: Team Balance and Auto Team Balance - by NeXoR - 11.10.2016, 13:06
Re: Team Balance and Auto Team Balance - by iLearner - 11.10.2016, 13:26
Re: Team Balance and Auto Team Balance - by gurmani11 - 11.10.2016, 13:51
Re: Team Balance and Auto Team Balance - by NeXoR - 11.10.2016, 13:55
Re: Team Balance and Auto Team Balance - by Isolated - 11.10.2016, 14:16
Re: Team Balance and Auto Team Balance - by Konstantinos - 11.10.2016, 14:32
Re: Team Balance and Auto Team Balance - by gurmani11 - 11.10.2016, 14:54

Forum Jump:


Users browsing this thread: 1 Guest(s)