A simple Team Balancer ++
#3

I'll give you a little snippet out of my code, so you can get the basic idea. You seem to have a relatively firm grasp on pawno, so it shoudln't be a challenge

pawn Код:
public AutoAssign(playerid)
{
    new RedCount, BlueCount;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(EventTeam[i] == EVENT_TEAM_RED)
        {
            RedCount ++;
        }
        if(EventTeam[i] == EVENT_TEAM_BLUE)
        {
            BlueCount ++;
        }
    }
    if(RedCount > BlueCount)
    {
        return EVENT_TEAM_BLUE;
    }
    if(BlueCount > RedCount)
    {
        return EVENT_TEAM_RED;
    }
    if(BlueCount == RedCount)
    {
        new decide = random(2);
        if(decide == 0)
        {
            return EVENT_TEAM_RED;
        }
        if(decide == 1)
        {
            return EVENT_TEAM_BLUE;
        }
    }
    return 0;
}
Reply


Messages In This Thread
A simple Team Balancer ++ - by legho - 08.01.2012, 21:16
Re: A simple Team Balancer ++ - by JamesC - 08.01.2012, 23:33
Re: A simple Team Balancer ++ - by Rob_Maate - 09.01.2012, 00:25
Re: A simple Team Balancer ++ - by Lorenc_ - 09.01.2012, 01:22
Re: A simple Team Balancer ++ - by Rob_Maate - 09.01.2012, 06:09
Re: A simple Team Balancer ++ - by Lorenc_ - 09.01.2012, 06:51
Re: A simple Team Balancer ++ - by Rob_Maate - 09.01.2012, 07:53
Re: A simple Team Balancer ++ - by legho - 09.01.2012, 17:41
Re: A simple Team Balancer ++ - by Lorenc_ - 09.01.2012, 20:31
Re: A simple Team Balancer ++ - by legho - 10.01.2012, 16:39

Forum Jump:


Users browsing this thread: 2 Guest(s)