diff --git a/src/TeamBalancer.cs b/src/TeamBalancer.cs index 3809714..b01c083 100644 --- a/src/TeamBalancer.cs +++ b/src/TeamBalancer.cs @@ -1,8 +1,7 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Modules.Utils; using System.IO.Compression; -using System.Text.Json; -using System.Text.Json.Serialization; namespace TeamBalancer { @@ -28,5 +27,23 @@ public override void Unload(bool hotReload) { Console.WriteLine(Localizer["core.unload"]); } + + public Tuple CountActivePlayers() + { + int count_t = 0; + int count_ct = 0; + foreach (CCSPlayerController player in Utilities.GetPlayers()) + { + if (player.Team == CsTeam.CounterTerrorist) + { + count_ct++; + } + else if (player.Team == CsTeam.Terrorist) + { + count_t++; + } + } + return Tuple.Create(count_t, count_ct); + } } }