Skip to content

Commit

Permalink
Fix warden queue, allow anyone if 0 CTs
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Jan 28, 2024
1 parent 75a9cd1 commit 6e1d609
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions mod/Jailbreak.Teams/Queue/QueueBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ public HookResult OnRequestToJoinTeam(CCSPlayerController? invoked, CommandInfo
if (!int.TryParse(command.ArgByIndex(1), out int team))
return HookResult.Stop;

if (Utilities.GetPlayers().Find(c => c.GetTeam() == CsTeam.CounterTerrorist) == null)
return HookResult.Continue; // If no CTs, let anyone on CT team

// Player is attempting to join CT and is not a guard?
// If so, stop them!!
if ((CsTeam)team == CsTeam.CounterTerrorist && !state.IsGuard)
Expand Down
6 changes: 4 additions & 2 deletions mod/Jailbreak.Warden/Commands/WardenCommandsBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,13 @@ public void Command_Warden(CCSPlayerController? player, CommandInfo command)
// Is a CT and queue is open
if (isCt && _queue.Active)
{
if (_queue.InQueue(player))
if (!_queue.InQueue(player)) {
if (_queue.TryEnter(player))
_notifications.JOIN_RAFFLE.ToPlayerChat(player);
return;
}

if (!_queue.InQueue(player))
if (_queue.InQueue(player))
if (_queue.TryExit(player))
_notifications.LEAVE_RAFFLE.ToPlayerChat(player);

Expand Down

0 comments on commit 6e1d609

Please sign in to comment.