SA-MP Forums Archive
team baance bug - 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)
+--- Thread: team baance bug (/showthread.php?tid=352372)



team baance bug - sanrock - 19.06.2012

I am using

pawn Код:
forward ChangeTeam(playerid);
public ChangeTeam(playerid)
{
      if ((Count1 > Count2) && gTeam[playerid] == TEAM_ZOMBIE)
      {
        SendClientMessageToAll(COLOR_RED,"[BALANCER] Balancing teams");
       
        new Random = Iter_Random(Player);
        foreach(Player, i)
        {
        if(gTeam[i] == TEAM_HUMAN) Count1++;
        if(Count1 == Iter_Count(Player))
        {
             HumanSetting(Random);
        }
        }
        return 0;
      }
      else if ((Count2 > Count1) && gTeam[playerid] == TEAM_HUMAN)
      {
        SendClientMessage(playerid,COLOR_RED, "[BALANCER] Balancing teams");
       
        new Random = Iter_Random(Player);
        foreach(Player, i)
        {
        if(gTeam[i] == TEAM_ZOMBIE) Count2++;
        if(Count2 == Iter_Count(Player))
        {
             ZombieSetting(Random);
        }
        }
        return 0;
      }
      return 1;
}
Count2 = TEAM_ZOMBIE
Count1 = TEAM_HUMAN

Anyway when I use it.

it doesn't change anyones teams when the teams are odd even when the timer happens

pawn Код:
SetTimer("ChangeTeam" ,120000,true);
Thanks


Re: team baance bug - ViniBorn - 19.06.2012

Replace
pawn Код:
SetTimer("ChangeTeam" ,120000,true);
With
pawn Код:
SetTimerEx("ChangeTeam" ,120000,true, "i", playerid);



Re: team baance bug - sanrock - 19.06.2012

But the SetTimer("ChangeTeam" ,120000,true); went under public OnGameModeInit()

and the new Timer wont work under ongamemode because of the playerid?

So where should I put the new one?


Re: team baance bug - Kindred - 19.06.2012

I'm guessing under OnPlayerConnect