SA-MP Forums Archive
team balance not working - 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 balance not working (/showthread.php?tid=481940)



team balance not working - ReD_HunTeR - 18.12.2013

Код:
    new CountTerrorist, CountArmy;
    for(new p = 0; p < GetMaxPlayers(); p++)
     {
       if (GetPlayerTeam(p) == TEAM_TERRORIST) CountTerrorist++;
       else if (GetPlayerTeam(p) == TEAM_ARMY) CountArmy++;
     }
    if ((CountTerrorist > CountArmy) && GetPlayerTeam(playerid) == TEAM_TERRORIST)
    {
      SendClientMessage(playerid,COLOR_RED, "Terrorist is full. please choose Army.");
      GameTextForPlayer(playerid, "~r~Terrorist is full ~n~ ~b~Please Chooose Army", 3000, 5);
      return 0;
    }
    else if ((CountArmy > CountTerrorist) && GetPlayerTeam(playerid) == TEAM_ARMY)
    {
      SendClientMessage(playerid,COLOR_RED, "Army is full. please choose Terrorist.");
      GameTextForPlayer(playerid, "~b~Army is full ~n~ ~b~Please Chooose Terrorist", 3000, 5);
      return 0;
    }
help please, thats not working


Re: team balance not working - ReD_HunTeR - 18.12.2013

no help?


Re: team balance not working - Riddick94 - 18.12.2013

That code is shit, to be honest.

Do this that way, whenever player joins and he's choosing his team (let's say he chosen team CS) just add +1 to this team, but before that do a check (if statement) is that team full or not.

So basically, do a check when player is trying to choose a team, I don't know why you're using loops there.


Re: team balance not working - ReD_HunTeR - 19.12.2013

someone to help me fix this balancer?