cs2-SimpleAdmin/CS2-SimpleAdmin-docs/docs/user/commands/basecommands.md
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

11 KiB

sidebar_position
3

Base Commands

Core admin commands for server management and admin system.

Player Information

Show Penalties

View your own active penalties.

css_penalties
css_mypenalties
css_comms

Permission: None (all players)

Shows:

  • Active bans
  • Active communication restrictions (gag, mute, silence)
  • Warning count
  • Duration remaining

Hide Penalty Notifications

Hide penalty notifications when you connect to the server.

css_hidecomms

Permission: @css/kick

Notes:

  • Toggle on/off
  • Admins won't see penalty notifications on join
  • Useful for admin privacy

Admin Menu

Open Admin Menu

Opens the main admin menu interface.

css_admin

Permission: @css/generic

Features:

  • Player management
  • Server management
  • Ban/kick/mute players via menu
  • Map changing
  • Custom server commands

Admin Help

Print the admin help file.

css_adminhelp

Permission: @css/generic

Shows:

  • Available commands for your permission level
  • Command syntax
  • Permission requirements

Admin Management

Add Admin

Add a new admin to the database.

css_addadmin <steamid> <name> <flags/groups> <immunity> <duration>

Permission: @css/root

Parameters:

  • steamid - Player's SteamID (any format)
  • name - Admin name (for identification)
  • flags/groups - Permission flags or group name
  • immunity - Immunity level (0-100, higher = more protection)
  • duration - Duration in minutes (0 = permanent)

Examples:

# Add permanent admin with root access
css_addadmin 76561198012345678 "AdminName" "@css/root" 99 0

# Add moderator for 30 days
css_addadmin STEAM_1:0:12345678 "ModName" "@css/kick,@css/ban" 50 43200

# Add admin using group
css_addadmin 76561198012345678 "AdminName" "#moderators" 60 0

# Add admin to all servers (-g flag)
css_addadmin 76561198012345678 "AdminName" "@css/root" 99 0 -g

Flags:

  • -g - Add to all servers (global admin)

Delete Admin

Remove an admin from the database.

css_deladmin <steamid>

Permission: @css/root

Examples:

# Remove admin from current server
css_deladmin 76561198012345678

# Remove admin from all servers (-g flag)
css_deladmin 76561198012345678 -g

Add Admin Group

Create a new admin group.

css_addgroup <group_name> <flags> <immunity>

Permission: @css/root

Parameters:

  • group_name - Name of the group (e.g., "#moderators")
  • flags - Permission flags for the group
  • immunity - Default immunity level for group members

Examples:

# Create moderator group
css_addgroup "#moderators" "@css/kick,@css/ban,@css/chat" 50

# Create VIP group
css_addgroup "#vip" "@css/vip" 10

# Create global group (-g flag)
css_addgroup "#owner" "@css/root" 99 -g

Flags:

  • -g - Create group on all servers

Delete Admin Group

Remove an admin group from the database.

css_delgroup <group_name>

Permission: @css/root

Examples:

# Delete group from current server
css_delgroup "#moderators"

# Delete group from all servers (-g flag)
css_delgroup "#moderators" -g

Reload Admins

Reload admin permissions from the database.

css_reloadadmins

Permission: @css/root

When to use:

  • After adding/removing admins via database
  • After modifying admin permissions
  • After group changes
  • Troubleshooting permission issues

Note: Admins are automatically reloaded periodically and on map change (if configured).


Player Information

Hide in Scoreboard

Toggle admin stealth mode (hide from scoreboard).

css_hide
css_stealth

Permission: @css/kick

Features:

  • Hides you from the scoreboard
  • Makes admin actions anonymous
  • Useful for undercover moderation

Who is This Player

Show detailed information about a player.

css_who <#userid or name>

Permission: @css/generic

Shows:

  • Player name and SteamID
  • IP address (if you have @css/showip permission)
  • Connection time
  • Active penalties
  • Warning count
  • Ban history

Examples:

css_who #123
css_who PlayerName
css_who @me

Show Disconnected Players

Show recently disconnected players.

css_disconnected
css_last
css_last10  # Show last 10 (config value)

Permission: @css/kick

Shows:

  • Player name
  • SteamID
  • Disconnect time
  • Disconnect reason

Configuration:

"DisconnectedPlayersHistoryCount": 10

Show Warns for Player

Open warn list for a specific player.

css_warns <#userid or name>

Permission: @css/kick

Shows:

  • All warnings for the player
  • Warning reasons
  • Admins who issued warnings
  • Warning timestamps
  • Total warning count

Examples:

css_warns #123
css_warns PlayerName

Show Penalty History

Print every past and current penalty for a player to your console.

css_history <#userid or name or steamid64> [bans|gags|mutes|silences|warns]

Permission: @css/kick

Shows:

  • Bans, gags, mutes, silences and warns, newest first
  • Status (active, expired, unbanned, unmuted), duration and reason
  • Admin who issued it
  • Who lifted it, when and why, for unbans and unmutes

Notes:

  • Accepts a SteamID64, so it works for players who are not online
  • The optional second argument narrows the list to one penalty type
  • Also available in the admin menu under Players > History

Examples:

css_history #123
css_history PlayerName bans
css_history 76561198012345678

Show Online Players

Show information about all online players.

css_players

Permission: @css/generic

Shows:

  • List of all connected players
  • UserIDs
  • Names
  • Teams
  • Connection status

Server Management

Kick Player

Kick a player from the server.

css_kick <#userid or name> [reason]

Permission: @css/kick

Examples:

css_kick #123 "AFK"
css_kick PlayerName "Rule violation"
css_kick @spec "Cleaning spectators"

Configuration:

"KickTime": 5

Delay in seconds before kicking (allows player to see the reason).


Change Map

Change to a different map.

css_map <mapname>
css_changemap <mapname>

Permission: @css/changemap

Examples:

css_map de_dust2
css_changemap de_mirage

Configuration:

"DefaultMaps": [
  "de_dust2",
  "de_mirage",
  "de_inferno"
]

Maps in this list appear in the map change menu.


Change Workshop Map

Change to a workshop map by ID or name.

css_wsmap <name or id>
css_changewsmap <name or id>
css_workshop <name or id>

Permission: @css/changemap

Examples:

css_wsmap 123456789
css_wsmap aim_map

Configuration:

"WorkshopMaps": {
  "aim_map": "123456789",
  "surf_map": "987654321"
}

Maps configured here can be changed by name instead of ID.


Change CVar

Change a server console variable.

css_cvar <cvar> <value>

Permission: @css/cvar

Examples:

css_cvar sv_cheats 1
css_cvar mp_roundtime 5
css_cvar mp_maxmoney 16000

Warning: This is a powerful command. Only grant to trusted admins.


Execute RCON Command

Execute any command as the server.

css_rcon <command>

Permission: @css/rcon

Examples:

css_rcon status
css_rcon changelevel de_dust2
css_rcon sv_cheats 1

Warning: Extremely powerful command. Only grant to server owners.

Configuration:

"DisableDangerousCommands": true

When enabled, prevents execution of dangerous commands via css_rcon.


Restart Game

Restart the current game/round.

css_rr
css_rg
css_restart
css_restartgame

Permission: @css/generic

Notes:

  • Restarts the current round
  • Score is reset
  • Players remain connected

Permission Flags

Common permission flags used in CS2-SimpleAdmin:

Flag Description Common Use
@css/generic Generic admin access Basic admin menu, info commands
@css/chat Chat management Gag, mute, silence
@css/kick Kick players Kick, warnings, player info
@css/ban Ban players Ban, banip, addban
@css/unban Unban players Remove bans
@css/permban Permanent bans Issue permanent bans
@css/changemap Change maps Map changing
@css/cvar Change cvars Server variable modification
@css/rcon Execute rcon Full server control
@css/root Root access All permissions, admin management
@css/slay Slay/respawn Player manipulation
@css/cheats Cheat commands God mode, noclip, give weapons
@css/showip View IPs See player IP addresses

Immunity System

Immunity prevents lower-level admins from targeting higher-level admins.

How it works:

  • Each admin has an immunity value (0-100)
  • Higher immunity = more protection
  • Admins can only target players with lower immunity

Example:

  • Admin A has immunity 50
  • Admin B has immunity 30
  • Admin A can ban Admin B
  • Admin B cannot ban Admin A

Best Practice:

  • Owner: 99
  • Senior admins: 80-90
  • Moderators: 50-70
  • Trial mods: 20-40
  • Regular players: 0

Configuration Options

Reload Admins on Map Change

"ReloadAdminsEveryMapChange": false

Options:

  • true - Reload admin permissions every map change
  • false - Only reload when explicitly requested (better performance)

Show Activity Type

"ShowActivityType": 2

Options:

  • 0 - Hide all admin activity
  • 1 - Show activity anonymously ("An admin banned PlayerName")
  • 2 - Show admin name ("AdminName banned PlayerName")

Best Practices

Admin Management

  1. Use groups - Easier to manage than individual permissions
  2. Set appropriate immunity - Prevent abuse
  3. Time-limited admin - For trial moderators
  4. Document changes - Keep track of who has what permissions

Permission Assignment

Recommended hierarchy:

Root (@css/root, immunity 99):
  - Server owners only

Senior Admin (@css/ban,@css/kick,@css/chat,@css/changemap, immunity 80):
  - Trusted long-term admins

Moderator (@css/kick,@css/chat, immunity 50):
  - Regular moderators

Trial Mod (@css/kick, immunity 20):
  - New moderators on probation

Security

  1. Limit @css/rcon - Only to server owner
  2. Limit @css/cvar - Only to senior admins
  3. Monitor admin actions - Review logs regularly
  4. Use time-limited admin - For temporary staff

Troubleshooting

Admin permissions not working

Check:

  1. Is admin correctly added with css_addadmin?
  2. Run css_reloadadmins
  3. Check database connection
  4. Verify SteamID format

Can't target another admin

Check:

  • Your immunity level vs target's immunity
  • You need equal or higher immunity to target

Commands not available

Check:

  • Your permission flags
  • Commands.json for disabled commands
  • Server console for errors