Skip to content

Commit

Permalink
draft: simple balancer
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalle Minkner committed Nov 8, 2024
1 parent d5beb6f commit 1ec7f42
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/TeamBalancer.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -28,5 +27,23 @@ public override void Unload(bool hotReload)
{
Console.WriteLine(Localizer["core.unload"]);
}

public Tuple<int, int> 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);
}
}
}

0 comments on commit 1ec7f42

Please sign in to comment.