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")]
|
[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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue