Skip to content

Modules

A module is an ordinary CounterStrikeSharp plugin that talks to CS2-SimpleAdmin through its public API (shared/CS2-SimpleAdminApi/). Modules add commands, put their own categories into the admin menu, react to bans and mutes, or issue penalties themselves, without touching the plugin. Each module is installed, configured and reloaded on its own, in its own plugins/<ModuleName>/ folder.

The release zip contains the ones marked in the release zip; the others are kept in Modules/ as source, to build yourself. Generated from the Modules/ folder at build time.

CS2-SimpleAdmin Fun Commands

in the release zipv1.0.0

Noclip, god mode, freeze, respawn, give and strip weapons, HP, speed, gravity, money and resize, as commands and as a Fun category in the admin menu. The reference module for writing your own.

Modules/CS2-SimpleAdmin_FunCommands · README

API: AddMenuOption AddSubMenu CreateMenuWithBack CreateMenuWithPlayers GetPlayerInfo GetTarget GetValidPlayers IsAdminSilent LogCommand OnSimpleAdminReady RegisterCommand RegisterMenu RegisterMenuCategory ShowAdminActivity ShowAdminActivityLocalized UnRegisterCommand UnregisterMenu

Default config configs/plugins/CS2-SimpleAdmin_FunCommands/CS2-SimpleAdmin_FunCommands.json
{
  "Version": 1,
  "NoclipCommands": [
    "css_noclip"
  ],
  "GodCommands": [
    "css_god"
  ],
  "FreezeCommands": [
    "css_freeze"
  ],
  "UnfreezeCommands": [
    "css_unfreeze"
  ],
  "RespawnCommands": [
    "css_respawn"
  ],
  "GiveCommands": [
    "css_give"
  ],
  "StripCommands": [
    "css_strip"
  ],
  "HpCommands": [
    "css_hp"
  ],
  "SpeedCommands": [
    "css_speed"
  ],
  "GravityCommands": [
    "css_gravity"
  ],
  "MoneyCommands": [
    "css_money"
  ],
  "ResizeCommands": [
    "css_resize"
  ]
}

[CS2-SimpleAdmin] Stealth Module

in the release zipv1.0.3

Hides admins who use css_hide from other players (CheckTransmit) and can hide them on join and block the status command for silent admins.

Modules/CS2-SimpleAdmin_StealthModule · by daffyy

API: IsAdminSilent ListSilentAdminsSlots OnAdminToggleSilent

Default config configs/plugins/CS2-SimpleAdmin_StealthModule/CS2-SimpleAdmin_StealthModule.json
{
  "Version": 1,
  "Permissions": [
    "@css/ban"
  ],
  "BlockStatusCommand": true,
  "HideAdminsOnJoin": true
}

AntiDLL [CS2-SimpleAdmin Module]

source onlyv1.0.1

Bans players that the AntiDLL plugin detects, through SimpleAdmin (needs AntiDLL).

Modules/AntiDLL-CS2-SimpleAdmin · by daffyy

API: IssuePenalty

Default config configs/plugins/AntiDLL-CS2-SimpleAdmin/AntiDLL-CS2-SimpleAdmin.json
{
  "ConfigVersion": 1,
  "Reason": "Invalid event detected!",
  "Duration": 0,
  "CommandToExecute": "css_addban {steamid64} {duration} {reason}",
  "BanType": "auto"
}

[CS2-SimpleAdmin] Example Module

source onlyv1.1.0

Example of the API: events, commands and menus. Not meant for a live server.

Modules/CS2-SimpleAdmin_ExampleModule · by daffyy & Example Contributors

API: AddMenuOption AddSubMenu CreateMenuWithBack CreateMenuWithPlayers GetConnectionString GetPlayerInfo GetServerAddress GetServerId GetValidPlayers IsAdminSilent IssuePenalty OnPlayerPenaltied OnPlayerPenaltiedAdded OnSimpleAdminReady RegisterMenu RegisterMenuCategory UnregisterMenu

Commands: css_kickme css_serveraddress css_getmyinfo css_testaddban

[CS2-SimpleAdmin] Redis Inform

source onlyv1.0.0

Shares admin activity messages (bans, gags, mutes, silences) between servers through Redis: each server publishes its own and shows the others.

Modules/CS2-SimpleAdmin_RedisInform · by daffyy

API: OnAdminShowActivity ShowAdminActivity

Default config configs/plugins/CS2-SimpleAdmin_RedisInform/CS2-SimpleAdmin_RedisInform.json
{
  "ConfigVersion": 1,
  "RedisConnectionString": "172.18.0.1",
  "RedisPassword": ""
}

To leave a shipped module out, delete its folder under addons/counterstrikesharp/plugins/. How to use the two shipped modules is in Fun commands and stealth.

The Fun Commands module is the reference: commands from config, menu categories, per-player translations and clean unloading. The longer guide is Modules/MODULE_DEVELOPMENT.md.

Reference CS2-SimpleAdminApi.dll (from the release zip’s shared/CS2-SimpleAdminApi/ or a build of CS2-SimpleAdminApi/) as a compile-time reference, the way the modules in the repository do:

<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.369" />
<Reference Include="CS2-SimpleAdminApi">
<HintPath>CS2-SimpleAdminApi.dll</HintPath>
</Reference>
</ItemGroup>

Do not copy the DLL into your module’s folder: the API types must come from shared/CS2-SimpleAdminApi/, where the release installs them.

The API is a CounterStrikeSharp plugin capability named simpleadmin:api:

using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Modules.Admin;
using CS2_SimpleAdminApi;
using Microsoft.Extensions.Logging;
public class MyModule : BasePlugin
{
public override string ModuleName => "My SimpleAdmin module";
public override string ModuleVersion => "1.0.0";
private ICS2_SimpleAdminApi? _api;
private readonly PluginCapability<ICS2_SimpleAdminApi> _capability = new("simpleadmin:api");
public override void OnAllPluginsLoaded(bool hotReload)
{
_api = _capability.Get();
if (_api == null)
{
Logger.LogError("CS2-SimpleAdmin API not found");
return;
}
_api.OnPlayerPenaltied += OnPlayerPenaltied;
_api.OnSimpleAdminReady += RegisterMenus; // after SimpleAdmin has loaded its data
RegisterMenus(); // and right away, for hot reloads
}
private void OnPlayerPenaltied(PlayerInfo player, PlayerInfo? admin, PenaltyType type,
string reason, int duration, int? penaltyId, int? serverId)
{
if (type == PenaltyType.Ban)
Logger.LogInformation($"{player.Name} was banned for {duration} min: {reason}");
}
private void RegisterMenus() { /* see below */ }
public override void Unload(bool hotReload)
{
if (_api == null) return;
_api.OnPlayerPenaltied -= OnPlayerPenaltied;
_api.OnSimpleAdminReady -= RegisterMenus;
}
}

Register commands through the API, as the Fun Commands module does, and unregister them in Unload. Permissions come from the usual CounterStrikeSharp attributes on the handler:

[CommandHelper(1, "<#userid or name>")]
[RequiresPermissions("@css/slay")]
private void OnSlapAllCommand(CCSPlayerController? caller, CommandInfo command)
{
var targets = _api!.GetTarget(command); // SimpleAdmin's target parsing and messages
if (targets == null) return;
// ...
_api.LogCommand(caller, command); // admin log and Discord log
}
// in OnAllPluginsLoaded: _api.RegisterCommand("css_slapall", "Slap players", OnSlapAllCommand);
// in Unload: _api.UnRegisterCommand("css_slapall");

Add a category to the admin menu and menus inside it. The MenuContext overloads pass the title and category to your factory, so the back button works without repeating them:

private void RegisterMenus()
{
_api!.RegisterMenuCategory("mymodule", "My module", "@css/generic");
_api.RegisterMenu("mymodule", "slap", "Slap a player", CreateSlapMenu, "@css/slay");
}
private object CreateSlapMenu(CCSPlayerController admin, MenuContext context) =>
_api!.CreateMenuWithPlayers(context, admin,
player => player.IsValid && AdminManager.CanPlayerTarget(admin, player),
(adminPlayer, target) => { /* act on target */ });
// in Unload: _api.UnregisterMenu("mymodule", "slap");

For translated menu and activity texts, pass your module’s Localizer to the overloads that take moduleLocalizer; each player then sees your strings in their own language (Module translations shows the full pattern).

Every member, with its signature and documentation, is in the API reference.