Skip to content

Commit ced03b4

Browse files
feat: a permission is now required to use admin commands
1 parent c21b963 commit ced03b4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Allow players to automatically try and unlock locked code locks with their code.
1111

1212
- `autocode.use` - Allows use of this plugin.
1313
- `autocode.try` - Allows auto-trying of user code on locked code locks.
14+
- `autocode.admin` - Allows use of admin commands.
1415

1516
## Chat Commands
1617

@@ -27,7 +28,7 @@ The same commands are also avalibale in a guest code version:
2728

2829
## Console Commands
2930

30-
Only admins can use these.
31+
Requires `autocode.admin` to use.
3132

3233
- `autocode.resetlockout *` - Removes all lock outs for all players.
3334
- `autocode.resetlockout playerSteamId_or_playerDisplayName` - Removes lock out for the specified player.

src/AutoCode.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ private static class Permissions
713713
// Permissions.
714714
public const string Use = "autocode.use";
715715
public const string Try = "autocode.try";
716+
public const string Admin = "autocode.admin";
716717

717718
/// <summary>
718719
/// Register the permissions.
@@ -721,6 +722,7 @@ public static void Register(AutoCode plugin)
721722
{
722723
plugin.permission.RegisterPermission(Use, plugin);
723724
plugin.permission.RegisterPermission(Try, plugin);
725+
plugin.permission.RegisterPermission(Admin, plugin);
724726
}
725727
}
726728

@@ -771,7 +773,7 @@ private bool HandleResetLockOut(ConsoleSystem.Arg arg)
771773
BasePlayer player = arg.Player();
772774

773775
// Not admin?
774-
if (!arg.IsAdmin)
776+
if (!plugin.permission.UserHasPermission(player.UserIDString, Permissions.Admin))
775777
{
776778
if (plugin.config.Options.DisplayPermissionErrors)
777779
{

0 commit comments

Comments
 (0)