diff --git a/lang/Jailbreak.English/Teams/RatioNotifications.cs b/lang/Jailbreak.English/Teams/RatioNotifications.cs index f9ed4476..531a0cf2 100644 --- a/lang/Jailbreak.English/Teams/RatioNotifications.cs +++ b/lang/Jailbreak.English/Teams/RatioNotifications.cs @@ -39,7 +39,7 @@ public class RatioNotifications : IRatioNotifications, ILanguage new SimpleView { PREFIX, "You were swapped back to the prisoner team!" }; - + public IView LEFT_GUARD => new SimpleView { diff --git a/mod/Jailbreak.Teams/Queue/QueueBehavior.cs b/mod/Jailbreak.Teams/Queue/QueueBehavior.cs index a2dabd87..d3993637 100644 --- a/mod/Jailbreak.Teams/Queue/QueueBehavior.cs +++ b/mod/Jailbreak.Teams/Queue/QueueBehavior.cs @@ -1,6 +1,7 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; +using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; using CounterStrikeSharp.API.Modules.Utils; using Jailbreak.Formatting.Extensions; @@ -20,7 +21,7 @@ public class QueueBehavior : IGuardQueue, IPluginBehavior private readonly IRatioNotifications _notifications; private readonly IPlayerState _state; - + private BasePlugin _parent; public QueueBehavior(IPlayerStateFactory factory, IRatioNotifications notifications, ILogger logger) { @@ -60,7 +61,7 @@ public bool TryExitQueue(CCSPlayerController player) public bool TryPop(int count) { - var queue = Queue.Where(p=>p.IsReal()).ToList(); + var queue = Queue.Where(p => p.IsReal()).ToList(); if (queue.Count <= count) { @@ -136,6 +137,7 @@ public IEnumerable Queue public void Start(BasePlugin parent) { + _parent = parent; // Listen for the player requesting to join a team. // Thanks, destoer! parent.AddCommandListener("jointeam", OnRequestToJoinTeam); @@ -158,11 +160,28 @@ public HookResult OnRequestToJoinTeam(CCSPlayerController? invoked, CommandInfo if (command.ArgCount < 2) return HookResult.Stop; + if (!state.IsGuard) + _parent.AddTimer(0.1f, () => + { + if (!invoked.IsReal()) + return; + if (invoked.GetTeam() != CsTeam.CounterTerrorist) + return; + _notifications.ATTEMPT_TO_JOIN_FROM_TEAM_MENU + .ToPlayerChat(invoked) + .ToPlayerCenter(invoked); + invoked.ChangeTeam(CsTeam.Terrorist); + }); if (!int.TryParse(command.ArgByIndex(1), out var 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 + + // Force player to prisoner if they attempt to join prisoners + // Allows for uncapped prisoners regardless of mapos + if((CsTeam)team == CsTeam.Terrorist) + invoked.ChangeTeam(CsTeam.Terrorist); // Player is attempting to join CT and is not a guard? // If so, stop them!! @@ -265,6 +284,20 @@ public void Command_Guard(CCSPlayerController? player, CommandInfo command) { if (player == null) return; + if (player.AuthorizedSteamID == null) + { + player.PrintToCenter("Steam has not yet authorized you. Please try again later."); + return; + } + + // AdminData? data = AdminManager.GetPlayerAdminData(player.AuthorizedSteamID!); + + // if (data == null || !data.Groups.Contains("#ego/e")) + // { + // player.PrintToCenter("You must be an =(e)= to join the guard queue. Apply at https://edgm.rs/join"); + // return; + // } + HandleQueueRequest(player); } @@ -276,4 +309,4 @@ public void Command_Leave(CCSPlayerController? player, CommandInfo command) return; HandleLeaveRequest(player); } -} +} \ No newline at end of file diff --git a/mod/Jailbreak.Warden/Global/WardenBehavior.cs b/mod/Jailbreak.Warden/Global/WardenBehavior.cs index 93848892..0fc5af01 100644 --- a/mod/Jailbreak.Warden/Global/WardenBehavior.cs +++ b/mod/Jailbreak.Warden/Global/WardenBehavior.cs @@ -146,6 +146,8 @@ private void UnmarkPrisonersBlue() { foreach (var player in _bluePrisoners) { + if(!player.IsReal()) + continue; var pawn = player.Pawn.Value; if (pawn == null) continue; diff --git a/public/Jailbreak.Public/Mod/Draw/BeamLine.cs b/public/Jailbreak.Public/Mod/Draw/BeamLine.cs index 7587ee30..a99432c6 100644 --- a/public/Jailbreak.Public/Mod/Draw/BeamLine.cs +++ b/public/Jailbreak.Public/Mod/Draw/BeamLine.cs @@ -54,7 +54,8 @@ public override void Draw() public override void Remove() { KillTimer?.Kill(); - _beam?.Remove(); + if(_beam != null && _beam.IsValid) + _beam?.Remove(); _beam = null; }