using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Modules.Menu; namespace Porning; class Info { private string message = ""; private BasePlugin plugin = null!; private CenterHtmlMenu? menu = null; private Action? callback = null; public Info(BasePlugin plugin, string message) { this.plugin = plugin; this.message = $"Porning
{message}"; } public void Show(CCSPlayerController? player=null) { menu = new CenterHtmlMenu(message, plugin) { ExitButton = false }; if (player !=null) { MenuManager.OpenCenterHtmlMenu(plugin, player, menu); } else { foreach (CCSPlayerController p in Utilities.GetPlayers()) { MenuManager.OpenCenterHtmlMenu(plugin, p, menu); } } plugin.AddTimer(5.0f, Close); } public void Close() { foreach (CCSPlayerController player in Utilities.GetPlayers()) { MenuManager.CloseActiveMenu(player); } callback?.Invoke(); } public void OnClose(Action callback) { this.callback = callback; } }