Looking For TeamBalancer [URGENT]
#3

I just learned this some time ago, it's called 'module division', I've got a big problem with maths so I can't really explain it to you good, but I give you an example which I use myself:


pawn Код:
// on top
new PlayerTeam[MAX_PLAYERS];
new team;

// somewhere else:

for (new i = 0; i <MAX_PLAYERS; i ++)
{
  if(IsPlayerConnected(i))
  {
    team = playerid % 2;

    if(team == 0)
    {
      PlayerTeam[i] = 1;
    }
    if(team == 1)
    {
      PlayerTeam[i] = 2;
    }
  }
  return 1;
}
This would (if you had 50 players), make 25 people team 1 and the other 25 people team 2, if a new player would connect, you could do (make sure to set PlayerTeam[playerid] to 0 at (dis)connect) onplayerspawn:

pawn Код:
if(PlayerTeam[playerid] == 0)
{
  team = playerid % 2;
  if(team == 0)
  {
    PlayerTeam[i] = 1;
  }
  if(team == 1)
  {
    PlayerTeam[i] = 2;
  }
}
No idea how to do it for 7 teams lol I'm too noob for that, but take a look at the wiki page, might make more sense to you then me:

http://en.wikipedia.org/wiki/Modulo_operation
Reply


Messages In This Thread
Looking For TeamBalancer [URGENT] - by Kyle - 01.08.2009, 09:17
Re: Looking For TeamBalancer [URGENT] - by Joe Staff - 01.08.2009, 09:57
Re: Looking For TeamBalancer [URGENT] - by -Sneaky- - 01.08.2009, 10:09
Re: Looking For TeamBalancer [URGENT] - by Kyle - 01.08.2009, 10:32
Re: Looking For TeamBalancer [URGENT] - by yezizhu - 01.08.2009, 12:01
Re: Looking For TeamBalancer [URGENT] - by Burridge - 01.08.2009, 12:05

Forum Jump:


Users browsing this thread: 1 Guest(s)