Manage your Counter-Strike 2 server by simple commands :)
Find a file
Ravid-A 530f60366d Fix unban delay, admin loading, rename persistence; add css_history (1.9.0)
Fixes for issues reported by server owners, plus one new command.

Unbans took up to a minute to apply, and on SQLite never applied at all:
- css_unban only wrote to the database, but the connect check reads an
  in-memory cache that syncs on a 61s timer. BanManager.UnbanPlayer now
  marks the bans UNBANNED in CacheManager and rebuilds the indexes, and
  logs failures instead of swallowing them.
- SQLite has no ON UPDATE CURRENT_TIMESTAMP and the unban/expire queries
  never set updated_at, so the delta refresh never saw the change and
  the ban stayed active until a plugin reload. Both queries set it now.
- The delta query uses >= so a change written in the same second as the
  refresh snapshot is not skipped.
- css_unban issues removeid when UnlockedCommands is on, clearing the
  engine-level banid that css_ban adds.
- RebuildIndexes builds fresh dictionaries and swaps them under a lock,
  so the game thread cannot read a half-built index now that unbans can
  trigger a rebuild off the timer thread.

Admin permissions were intermittently missing after a restart:
- The startup reload fired at a fixed 3s, usually before ServerManager
  had resolved ServerId, so the admin query ran with a null server and
  returned only global admins, with nothing reloading afterwards.
  ServerManager now reloads admins once ServerId is set, and on both of
  its failure paths so global admins still load.
- Loading the plugin mid-map (css_plugins load) fires no map start, so
  server loading is kicked off after 5s if it has not happened.
- CreateAdminsJsonFile no longer strips permissions from inside the
  ToDictionary lambda, where it ran once per name group and seconds
  before the new data was loaded. It returns the new cache and
  PermissionManager.ApplyAdminCache applies it on the main thread
  immediately before AdminManager.LoadAdminData.
- Reloads are serialized with a semaphore and carry a generation, so
  overlapping ones cannot race on the JSON files or apply a stale
  snapshot after the hibernation cap.
- GetAllPlayersFlags and GetAllGroupsData rethrow instead of returning
  an empty list; ReloadAdmins catches, logs and aborts. A transient
  database error previously wrote an empty admins.json and stripped
  every admin on the server.

Permanent renames did not survive a restart:
- New sa_renames table (migration 017); css_prename upserts or deletes,
  and the table is loaded into memory once the server is ready.
- The rename is re-applied on connect before the DatabaseProvider /
  CacheManager early return, which previously skipped it whenever the
  DB or cache was not ready yet.
- New EventPlayerChangename handler, and both it and OnPlayerInfo
  re-check after a short delay instead of comparing names at event
  time; the engine may not have written the client's new name yet, and
  Rename itself takes 0.4s to settle.

Smaller fixes:
- css_say printed "ADMIN: <text>" with no name. The caller name is
  passed to the localizer and sa_adminsay_prefix carries {1} in all 13
  languages.
- css_penalties <player> with @css/kick reassigned only the local user
  id while every lookup kept using caller.SteamID, so an admin checking
  another player always saw their own penalties. It now uses the
  target's SteamID, and replies instead of throwing when that player's
  connect data has not finished loading.
- css_rename returned early for an admin in silent mode, which skipped
  the rename itself rather than just the announcement.

New: css_history <#userid|name|steamid64> [bans|gags|mutes|silences|warns]
(@css/kick) prints every ban, gag, mute, silence and warn with status,
duration, the admin who issued it, the reason and, for lifted bans and
mutes, who lifted it, when and why. A SteamID64 works for players who
are not online. Also available in the admin menu under Players >
History. The data was always there: unban, unmute and expiry only flip
the status column, rows are never deleted.

Build:
- The csproj listed all 32 migration files by hand, so a new migration
  silently never reached the output. Replaced with a glob.
- Commands missing from an existing Commands.json are registered under
  their default name, so new commands appear without deleting the file.
  An empty alias list still disables a command.
2026-10-03 02:33:10 +03:00
.github Update build.yml 2026-06-17 02:47:31 +02:00
CS2-SimpleAdmin Fix unban delay, admin loading, rename persistence; add css_history (1.9.0) 2026-10-03 02:33:10 +03:00
CS2-SimpleAdmin-docs Fix unban delay, admin loading, rename persistence; add css_history (1.9.0) 2026-10-03 02:33:10 +03:00
CS2-SimpleAdminApi .NET10, version bump 2026-06-17 02:21:51 +02:00
Modules .NET10, version bump 2026-06-17 02:21:51 +02:00
.gitattributes Initial commit 2023-12-02 19:22:01 +01:00
.gitignore Fix unban delay, admin loading, rename persistence; add css_history (1.9.0) 2026-10-03 02:33:10 +03:00
CS2-SimpleAdmin.sln 1.6.0a 2024-09-28 18:03:03 +02:00
LICENSE 1.6.0a 2024-09-28 18:03:03 +02:00
README.md Update README.md 2025-10-03 02:35:45 +02:00

Build and Publish GitHub Release Made with a lot of tea 🍵

Join the support Discord

CS2-SimpleAdmin


Manage your Counter-Strike 2 server with simple commands!
CS2-SimpleAdmin is a plugin designed to help you easily manage your Counter-Strike 2 server with user-friendly commands. Whether you're banning players, managing teams, or configuring server settings, CS2-SimpleAdmin has you covered.


🚀 Features

  • 🎮 Simple, Intuitive Commands: Manage players, teams, bans, and server settings using an easy command system.
  • 🗄 Full Database Integration: Reliable MySQL backend with optional experimental SQLite support for persistent data storage.
  • ⚡ Efficient and Lightweight: Designed to minimize server resource usage while maintaining robust functionality.
  • 🚨 Real-time Notifications: Instant in-game and Discord notifications to keep admins and players informed.
  • 🎛 User-Friendly Admin Interface: Plugin menus for quick and efficient management without complex commands.
  • 🔄 Multi-Server Compatibility: Manage and sync data across multiple servers seamlessly.
  • 🧩 Modular and Extensible: Tailor the plugin with API access to add custom commands and automation.
  • 📜 Complete Auditing Logs: Track all administrative actions rigorously for accountability.
  • 🌐 Discord Integration: Stream logs and alerts to your Discord channels for centralized monitoring.
  • 🤝 Community Driven: Open-source with ongoing contributions from a passionate community.

⚙️ Requirements

Ensure all the following dependencies are installed before proceeding


🚀 Getting Started

  1. Clone or Download the Repository:
    Download or clone the repository and publish to your addons/counterstrikesharp/plugins/ directory.

  2. First Launch Configuration:
    On the first launch, a configuration file will be generated at:

    addons/counterstrikesharp/configs/plugins/CS2-SimpleAdmin/CS2-SimpleAdmin.json
    

    Edit this file to customize the plugin settings according to your server needs.

  3. Enjoy Managing Your Server!
    Use the commands provided by the plugin to easily manage your server.


📁 Configuration

The configuration file (CS2-SimpleAdmin.json) will be auto-generated after the first launch. It contains settings for MySQL connections, command permissions, and other plugin-specific configurations.


📚 Documentation & Support

Access full documentation, guides, tutorials, and developer API references here:
CS2-SimpleAdmin Wiki


🛠️ Development

This project started as a base for other plugins but has grown into a standalone admin management tool. Contributions are welcome! If you'd like to help with development or have ideas for new features, feel free to submit a pull request or open an issue.


🤝 Contributing & Feedback

Help improve CS2-SimpleAdmin by:

  • Reporting bugs or requesting features on GitHub
  • Submitting pull requests with improvements
  • Participating in discussions and sharing ideas

💡 Credits

This project is inspired by the work of Hackmastr. Thanks for laying the groundwork!


☕ Support Development

If you find CS2-SimpleAdmin useful, consider supporting the ongoing development:
Buy me a coffee


📄 License

This project is licensed under the GPL-3.0 license - see the LICENSE file for details.