How to Become Admin on Your CounterStrikeSharp Server
Admin commands in CounterStrikeSharp plugins, such as kick, ban or changing the map, only work for players who have the right permission flag. Those permissions live in a few JSON files on your server. Once you understand the three files, giving yourself or a friend admin rights takes about two minutes.
Find the configs folder
Go to addons/counterstrikesharp/configs on your server. Three files matter here: admins.json lists the people and what they may do, admin_groups.json defines reusable groups of permissions, and admin_overrides.json changes which permission a specific command needs.
Get your SteamID64
The admin list identifies you by your Steam account. The easiest format is the SteamID64, a 17 digit number that starts with 7656119. You can find yours by pasting your Steam profile link into any SteamID lookup site. The older STEAM_0:X:Y format is also accepted.
Add yourself with full rights
Open admins.json and add an entry with your name, your SteamID and the flags you want. The flag @css/root gives access to everything, so use it only for yourself and people you fully trust.
{
"MyName": {
"identity": "76561198000000001",
"flags": ["@css/root"]
}
}
Flags must start with @
Every flag has to be written with the @ in front, exactly like @css/kick. A flag without it is not recognised, and the player simply gets no rights, with no obvious error. The most common ones are @css/generic for basic admin commands, @css/kick, @css/ban, @css/changemap, @css/vip and @css/root.
Use groups for more than one admin
If you have several admins with the same rights, define the permissions once in admin_groups.json and point to the group from admins.json. Group names start with #. Changing the group later updates every admin that uses it.
{
"#css/simple-admin": {
"flags": ["@css/generic", "@css/kick", "@css/ban"]
}
}
{
"MyName": {
"identity": "76561198000000001",
"groups": ["#css/simple-admin"]
}
}
Fine tune with overrides
admin_overrides.json lets you change the flag a command requires without touching the plugin. For example, you can decide that a command which normally needs @css/ban should be usable by anyone with @css/kick. It is optional, and most servers never need it.
If it does not work
Restart the server after editing the files and check the console on startup for JSON errors. Then join the server and try a command that needs the flag. The usual causes are a wrong SteamID, a flag written without @, a JSON syntax error, or editing a copy of the file in the wrong folder.
For plugin developers: protect your own commands
If you write plugins, you do not have to check flags by hand. Add the RequiresPermissions attribute above a command handler and CounterStrikeSharp refuses the command for anyone who does not have the flag.
[RequiresPermissions("@css/kick")]
public void OnKickCommand(CCSPlayerController? player, CommandInfo commandInfo)
{
// ...
}
Was this tutorial useful?
Barlap for the community.