mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 10:43:23 +00:00
Added ExecuteOnClient option on custom commands
This commit is contained in:
@@ -22,6 +22,9 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
[JsonPropertyName("Command")]
|
[JsonPropertyName("Command")]
|
||||||
public string Command { get; set; } = "";
|
public string Command { get; set; } = "";
|
||||||
|
|
||||||
|
[JsonPropertyName("ExecuteOnClient")]
|
||||||
|
public bool ExecuteOnClient { get; set; } = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CS2_SimpleAdminConfig : BasePluginConfig
|
public class CS2_SimpleAdminConfig : BasePluginConfig
|
||||||
|
|||||||
@@ -31,8 +31,14 @@ namespace CS2_SimpleAdmin.Menus
|
|||||||
bool hasRights = AdminManager.PlayerHasPermissions(admin, customCommand.Flag);
|
bool hasRights = AdminManager.PlayerHasPermissions(admin, customCommand.Flag);
|
||||||
if (!hasRights)
|
if (!hasRights)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
options.Add(new ChatMenuOptionData(customCommand.DisplayName, () => Server.ExecuteCommand(customCommand.Command)));
|
options.Add(new ChatMenuOptionData(customCommand.DisplayName, () =>
|
||||||
|
{
|
||||||
|
if (customCommand.ExecuteOnClient)
|
||||||
|
admin.ExecuteClientCommand(customCommand.Command);
|
||||||
|
else
|
||||||
|
Server.ExecuteCommand(customCommand.Command);
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (ChatMenuOptionData menuOptionData in options)
|
foreach (ChatMenuOptionData menuOptionData in options)
|
||||||
|
|||||||
Reference in New Issue
Block a user