1
1
using CounterStrikeSharp . API ;
2
2
using CounterStrikeSharp . API . Core ;
3
3
using CounterStrikeSharp . API . Modules . Admin ;
4
+ using CounterStrikeSharp . API . Modules . Entities . Constants ;
4
5
using CustomCommands . Model ;
5
6
6
7
namespace CustomCommands ;
@@ -37,7 +38,7 @@ private void AddCommands(Commands com)
37
38
AddCommand ( aliases [ i ] , com . Description , ( player , info ) =>
38
39
{
39
40
if ( player == null ) return ;
40
- if ( ! RequiresPermissions ( player , com . Permissions ) )
41
+ if ( ! RequiresPermissions ( player , com . Permission ) )
41
42
return ;
42
43
43
44
TriggerMessage ( player , com ) ;
@@ -46,23 +47,23 @@ private void AddCommands(Commands com)
46
47
}
47
48
}
48
49
49
- private bool RequiresPermissions ( CCSPlayerController player , PermissionsElement permissions )
50
+ private bool RequiresPermissions ( CCSPlayerController player , Permission permissions )
50
51
{
51
- if ( permissions . ReguiresAllPermissions )
52
+ if ( ! permissions . ReguiresAllPermissions )
52
53
{
53
54
foreach ( var permission in permissions . PermissionList )
54
55
{
55
56
if ( AdminManager . PlayerHasPermissions ( player , new string [ ] { permission } ) )
56
57
return true ;
57
58
}
58
- PrintToChat ( Receiver . Client , player , "You don't have the required permissions to execute this command1 " ) ;
59
+ PrintToChat ( Receiver . Client , player , "You don't have the required permissions to execute this command " ) ;
59
60
return false ;
60
61
}
61
62
else
62
63
{
63
64
if ( ! AdminManager . PlayerHasPermissions ( player , permissions . PermissionList . ToArray ( ) ) )
64
65
{
65
- PrintToChat ( Receiver . Client , player , "You don't have the required permissions to execute this command2 " ) ;
66
+ PrintToChat ( Receiver . Client , player , "You don't have the required permissions to execute this command " ) ;
66
67
return false ;
67
68
}
68
69
return true ;
0 commit comments