mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-09-27 20:17:04 +02:00
Added ExecuteOnClient option on custom commands
This commit is contained in:
parent
ac940259f7
commit
60c76562f9
2 changed files with 11 additions and 2 deletions
|
|
@ -22,6 +22,9 @@ namespace CS2_SimpleAdmin
|
|||
|
||||
[JsonPropertyName("Command")]
|
||||
public string Command { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("ExecuteOnClient")]
|
||||
public bool ExecuteOnClient { get; set; } = false;
|
||||
}
|
||||
|
||||
public class CS2_SimpleAdminConfig : BasePluginConfig
|
||||
|
|
|
|||
|
|
@ -32,7 +32,13 @@ namespace CS2_SimpleAdmin.Menus
|
|||
if (!hasRights)
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue