PRoConEvents.MULTIbalancer.TotalPlayerCount C# (CSharp) Method

TotalPlayerCount() public method

public TotalPlayerCount ( ) : int
return int
        public int TotalPlayerCount()
        {
            fPlayerCount = 0;
            if (fGameVersion != GameVersion.BF3) { // BF4 and BFH
            fBF4CommanderCount = 0;
            fBF4SpectatorCount = 0;

            lock (fAllPlayers) {
            foreach (String name in fAllPlayers) {
                PlayerModel p = GetPlayer(name);
                if (p == null) continue;
                if (p.Role == ROLE_PLAYER) {
                    ++fPlayerCount;
                } else if (p.Role == ROLE_COMMANDER_PC || p.Role == ROLE_COMMANDER_MOBILE) {
                    ++fBF4CommanderCount;
                } else if (p.Role == ROLE_SPECTATOR) {
                    ++fBF4SpectatorCount;
                }
            }
            }
            } else {
            lock (fAllPlayers) {fPlayerCount = fAllPlayers.Count;}
            }
            return fPlayerCount;
        }
MULTIbalancer