Moved custom commands to its specific menu

This commit is contained in:
Valentin Barat 2024-03-13 11:43:33 +01:00
parent cce265c6b7
commit ac940259f7
3 changed files with 53 additions and 14 deletions

View file

@ -1,4 +1,3 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Menu;
@ -35,19 +34,6 @@ namespace CS2_SimpleAdmin.Menus
options.Add(new ChatMenuOptionData("Restart Game", () => CS2_SimpleAdmin.RestartGame(admin)));
List<CustomServerCommandData> customCommands = CS2_SimpleAdmin.Instance.Config.CustomServerCommands;
foreach (CustomServerCommandData customCommand in customCommands)
{
if (string.IsNullOrEmpty(customCommand.DisplayName) || string.IsNullOrEmpty(customCommand.Command))
continue;
bool hasRights = AdminManager.PlayerHasPermissions(admin, customCommand.Flag);
if (!hasRights)
continue;
options.Add(new ChatMenuOptionData(customCommand.DisplayName, () => Server.ExecuteCommand(customCommand.Command)));
}
foreach (ChatMenuOptionData menuOptionData in options)
{
string menuName = menuOptionData.name;