This guide shows you how to set up automatic tracking of player statistics like kills, deaths, assists, headshots, and win/loss ratios on your own Counter-Strike 2 server. You’ll learn how to install a stats plugin, configure it to record data, and view the results through a simple web interface. Before starting, you’ll need a CS2 server you can manage (either rented or self-hosted), access to the server’s file system, and basic comfort with editing text files and running commands.
What You’ll Need
- A CS2 dedicated server (Windows or Linux) with admin access
- SourceMod and MetaMod installed (the standard plugin framework for CS2)
- A stats plugin like CS2Stats or SourceMod’s built-in rank/stats system (we’ll use a popular free option)
- FTP or file manager access to the server’s
csgodirectory - A web server (optional) to host the stats output page
Step-by-Step
- Install MetaMod and SourceMod – Download the latest stable builds for CS2 from their official sites. Extract the files into your server’s
csgofolder. For a typical install, you’ll haveaddons/metamodandaddons/sourcemodinside thecsgodirectory. Restart the server and check that both load by typingmeta versionandsm versionin the server console. - Download a stats plugin – Choose a plugin that records player data. A widely used one is CS2Stats (find it on the SourceMod forums or AlliedMods). Download the compiled
.smxfile and place it incsgo/addons/sourcemod/plugins/. - Load the plugin – Restart the server or type
sm plugins load cs2statsin the console. Verify it loaded withsm plugins list. If it’s a plugin that requires a database, you’ll see a config file created inaddons/sourcemod/configs/. - Configure the plugin – Open the plugin’s config file (often
cs2stats.cfgincfg/sourcemod/). Set options like whether to use SQLite or MySQL, how often to write stats, and which events to track (kills, deaths, headshots, etc.). For a small server, SQLite is easiest – no separate database setup needed. - Set up the database (if using MySQL) – If you choose MySQL, create a database and user on your hosting. Edit
addons/sourcemod/configs/databases.cfgto add the connection details under a new entry like"cs2stats". - Start recording – Once the plugin is loaded and configured, it will automatically start recording stats for every player who joins. No further action is needed during gameplay. The plugin writes data to the database in real-time or at intervals depending on your config.
- View the stats – Most stats plugins include a web panel. For CS2Stats, you’ll typically access it via
http://your-server-ip:port/statsor by copying the generated HTML files to your web server. Alternatively, use in-game commands like!rankor!statsto display a player’s stats in chat. - Customize the display – Edit the plugin’s web template files (often in
addons/sourcemod/web/) to change the look, add your server logo, or adjust which columns appear. - Reset or manage stats – Use admin commands (usually
sm_resetstatsorsm_wipe) to clear all data. You can also set permissions inaddons/sourcemod/configs/admin_overrides.cfgto control who can reset.
Common Mistakes
- Forgetting to install MetaMod before SourceMod – SourceMod requires MetaMod to run. If you skip it, the plugin won’t load.
- Placing plugin files in the wrong folder – The
.smxmust go inplugins/, notconfigs/or the root ofaddons. - Not restarting the server after adding files – Some plugins won’t be picked up until a full restart, not just a map change.
- Using a MySQL config without a database – If you set MySQL but don’t create the DB, the plugin will fail silently. Use SQLite for simplicity unless you have a reason not to.
- Ignoring the plugin’s log output – Check
addons/sourcemod/logs/for errors. Most issues appear there immediately.
Tips
- Back up your database regularly – If using SQLite, copy the
.dbfile (usually incsgo/addons/sourcemod/data/) to a safe location. - Use a dedicated web server for the stats page – If your game server is also the web server, it may lag under load. Host the HTML/JS on a cheap static host and point it to your database via an API.
- Test with a few bots – Before going live, add bots (
bot_add) and play a few rounds to confirm stats are being recorded. - Set up admin permissions – Only let trusted admins reset stats. Use SourceMod’s admin system to assign the
sm_resetstatsflag. - Keep the plugin updated – CS2 updates often break plugins. Check for updates after major game patches.
Troubleshooting
Plugin doesn’t load – Check the console for errors. Common causes: missing MetaMod, wrong file permissions (on Linux, ensure files are readable), or a plugin that’s incompatible with your server’s OS. Try sm plugins load and read the error message.
Stats not recording – Verify the database file exists. For SQLite, look in data/ for a .db file. For MySQL, check the connection in the logs. Also ensure the plugin’s config has enabled 1.
Web panel shows blank page – The web files might not be in the right place. Copy the web folder to your web server root, or if using the built-in HTTP server, ensure the port is open in your firewall.
Stats reset after restart – If you’re using SQLite and the file is in a temporary folder, the server may be wiping it. Move the database to a persistent location and set the path in the config.
In-game commands don’t work – Make sure the plugin’s chat triggers are enabled. Check the config for sm_stats_enable 1 and that players have the correct permissions (usually everyone can view, only admins can reset).
Frequently Asked Questions
Q: Do I need a MySQL database for stats tracking?
A: No, most plugins work with SQLite by default, which stores data in a single file on your server. MySQL is only needed for large communities with multiple servers sharing stats.
Q: Can I track stats per map or per weapon?
A: Yes, many plugins offer breakdowns by map and weapon. Check the plugin’s documentation for commands like !weaponstats or config options to enable detailed tracking.
Q: Will the plugin slow down my server?
A: Minimal impact. The plugin writes small amounts of data per event. If you notice lag, reduce the frequency of database writes in the config (e.g., batch writes every 60 seconds instead of every kill).
Q: How do I show a player’s rank in the scoreboard?
A: Some plugins integrate with the scoreboard via a custom HUD or chat message. For a persistent rank display, you may need a separate plugin like Simple Chat Processor or RankMe that works alongside your stats plugin.
Q: Can I import stats from CS:GO?
A: No, CS2 uses a different data format. You’ll start fresh, but you can manually add historical data if you have it in a compatible format.
Q: Is it possible to track stats without a plugin?
A: Yes, you can use the game’s built-in logaddress to send logs to an external parser, but that’s much more complex. A plugin is the recommended method.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Backup Not Enough Space? Fix It Now200.00 GB
- Approximate Match Lookup: Conditional Formatting
- GST on Delivery Charges in India: E-Commerce Rules
- NFC Reader on Your Phone: 9 Things You’re Not Doing
- Smart TV DNS Settings: Why They Change & How to Fix
- RabbitMQ Hosting for Startups: Managed vs Self-Hosted