diff --git a/WASDMenuAPI - SRC Files/Classes/WasdManager.cs b/WASDMenuAPI - SRC Files/Classes/WasdManager.cs index 697a892..760bf48 100644 --- a/WASDMenuAPI - SRC Files/Classes/WasdManager.cs +++ b/WASDMenuAPI - SRC Files/Classes/WasdManager.cs @@ -60,6 +60,16 @@ public class WasdManager : IWasdMenuManager menuPlayer?.UpdateActiveMenu(list); } + public bool SetMenuPaused(CCSPlayerController? player, bool pause) + { + if (TryGetPlayer(player, out var menuPlayer) && menuPlayer != null) + { + menuPlayer.Paused = pause; + return true; + } + return false; + } + private static bool TryGetPlayer(CCSPlayerController? player, out WasdMenuPlayer? menuPlayer) { menuPlayer = null!; diff --git a/WASDMenuAPI - SRC Files/Classes/WasdMenuPlayer.cs b/WASDMenuAPI - SRC Files/Classes/WasdMenuPlayer.cs index 5c1b265..35d8a87 100644 --- a/WASDMenuAPI - SRC Files/Classes/WasdMenuPlayer.cs +++ b/WASDMenuAPI - SRC Files/Classes/WasdMenuPlayer.cs @@ -15,6 +15,7 @@ public class WasdMenuPlayer public string CenterHtml = ""; public int VisibleOptions = 3; public PlayerButtons Buttons { get; set; } + public bool Paused = false; public int scrollIndex = 0; public int maxLength = 21; @@ -128,6 +129,8 @@ public class WasdMenuPlayer string endControl = ""; LinkedListNode? option = MenuStart; + builder.AppendLine(""); + if (!string.IsNullOrEmpty(option?.Value?.Parent?.Title)) builder.AppendLine(option.Value.Parent?.Title ?? ""); diff --git a/WASDMenuAPI - SRC Files/Interfaces/IWasdMenuManager.cs b/WASDMenuAPI - SRC Files/Interfaces/IWasdMenuManager.cs index 911a9a4..ab8121b 100644 --- a/WASDMenuAPI - SRC Files/Interfaces/IWasdMenuManager.cs +++ b/WASDMenuAPI - SRC Files/Interfaces/IWasdMenuManager.cs @@ -18,4 +18,5 @@ public interface IWasdMenuManager public IWasdMenu CreateMenu(string title, string itemText, string itemHoverText, string ControlText); public bool HasMenu(CCSPlayerController? player); public void UpdateActiveMenu(CCSPlayerController? player, Dictionary> list); + public bool SetMenuPaused(CCSPlayerController? player, bool pause); } \ No newline at end of file diff --git a/WASDMenuAPI - SRC Files/WASDMenuAPI.cs b/WASDMenuAPI - SRC Files/WASDMenuAPI.cs index 96b8735..0448001 100644 --- a/WASDMenuAPI - SRC Files/WASDMenuAPI.cs +++ b/WASDMenuAPI - SRC Files/WASDMenuAPI.cs @@ -47,18 +47,15 @@ public class WASDMenuAPI { foreach (var player in Players.Values.Where(p => p.MainMenu != null && p.Player?.IsValid == true)) { + if (player.Paused) + return; + if ((player.Buttons & PlayerButtons.Forward) == 0 && (player.Player.Buttons & PlayerButtons.Forward) != 0) - { player.ScrollUp(); - } else if((player.Buttons & PlayerButtons.Back) == 0 && (player.Player.Buttons & PlayerButtons.Back) != 0) - { player.ScrollDown(); - } else if((player.Buttons & PlayerButtons.Use) == 0 && (player.Player.Buttons & PlayerButtons.Use) != 0) - { player.Choose(); - } player.Buttons = player.Player.Buttons; if (!string.IsNullOrEmpty(player.CenterHtml)) diff --git a/jRandomSkills - SRC Files/src/command/Command.cs b/jRandomSkills - SRC Files/src/command/Command.cs index 9969e7f..128987b 100644 --- a/jRandomSkills - SRC Files/src/command/Command.cs +++ b/jRandomSkills - SRC Files/src/command/Command.cs @@ -2,7 +2,6 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; -using CounterStrikeSharp.API.Modules.Entities; using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Utils; using src.menu; @@ -444,7 +443,7 @@ namespace src.command bool isDisplayHUD = playerInfo.HideHUD < tickCount; playerInfo.HideHUD = isDisplayHUD ? int.MaxValue : int.MinValue; - SkillUtils.CloseMenu(player); + SkillUtils.SetMenuPaused(player, isDisplayHUD); player.PrintToChat($" {(!isDisplayHUD ? ChatColors.Green : ChatColors.Red)}{player.GetTranslation(!isDisplayHUD ? "hud_on" : "hud_off")}"); } diff --git a/jRandomSkills - SRC Files/src/player/PlayerEvents.cs b/jRandomSkills - SRC Files/src/player/PlayerEvents.cs index 3a67b9d..2830add 100644 --- a/jRandomSkills - SRC Files/src/player/PlayerEvents.cs +++ b/jRandomSkills - SRC Files/src/player/PlayerEvents.cs @@ -241,7 +241,7 @@ namespace src.player if (isOtherPlugin && playerInfo.HideHUD != int.MaxValue) { playerInfo.HideHUD = tickCount + 15; - SkillUtils.CloseMenu(player); + SkillUtils.SetMenuPaused(player, true); } } diff --git a/jRandomSkills - SRC Files/src/player/PlayerOnTick.cs b/jRandomSkills - SRC Files/src/player/PlayerOnTick.cs index 1c2f354..e855d0d 100644 --- a/jRandomSkills - SRC Files/src/player/PlayerOnTick.cs +++ b/jRandomSkills - SRC Files/src/player/PlayerOnTick.cs @@ -86,7 +86,11 @@ namespace src.player if (player.PawnIsAlive && skillPlayer.SkillHudExpired < now && string.IsNullOrEmpty(skillPlayer.PrintHTML)) return; - if (SkillUtils.HasMenu(player)) return; + if (SkillUtils.HasMenu(player)) + { + SkillUtils.SetMenuPaused(player, false); + return; + } string infoLine = string.Empty; string skillLine = string.Empty; diff --git a/jRandomSkills - SRC Files/src/utils/SkillUtils.cs b/jRandomSkills - SRC Files/src/utils/SkillUtils.cs index ff1bead..0a6e7fd 100644 --- a/jRandomSkills - SRC Files/src/utils/SkillUtils.cs +++ b/jRandomSkills - SRC Files/src/utils/SkillUtils.cs @@ -786,6 +786,13 @@ namespace src.utils return manager.HasMenu(player); } + public static bool SetMenuPaused(CCSPlayerController? player, bool pause) + { + var manager = GetMenuManager(); + if (manager == null) return false; + return manager.SetMenuPaused(player, pause); + } + private static string GetInvisibleSignature(string id) { if (string.IsNullOrEmpty(id)) return ""; diff --git a/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll b/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll index b3d253f..c805238 100644 Binary files a/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll and b/jRandomSkills - Server Files/plugins/jRandomSkills/WASDMenuAPI.dll differ diff --git a/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll b/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll index 0501876..9a41e0f 100644 Binary files a/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll and b/jRandomSkills - Server Files/plugins/jRandomSkills/jRandomSkills.dll differ