First commit
This commit is contained in:
53
utils/info.cs
Normal file
53
utils/info.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
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 = $"<font color=\"red\">Porning</font><br>{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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user