When you setup Counter-Strike server, by default the player ranks are saved on server and they are present even when the server is restarted. Unless you have done something terribly wrong with your server settings which is what happened in our case.
CS Ranks top15 rank Players
A few days back we had to reinstall our server from scratch. While installation, we missed something because of which the player ranks in server were not saving any more. When ever the server restarts, all the ranks where gone. As a result, the /top15 /me /rank /rankstats and other rank related commands were showing incorrect results.

Counter-Strike Server Player List Scores
The player scores during the game where showing properly but once the server is restarted or crashed, all the server ranks which are meant to be persistent are reset to zero. The plugin responsible for the ranks is statsx.amxx which was loaded and running without any issues. After hours of bug hunting we finally found the culprits and the ranks started to save properly.

How to fix:
Following are the possible issues that might prevent your server ranks to survive restarts and crashes:

  • Directory Permissions:
    This is the most common reason if you are using a Linux based server.
    However, this can also happen on a Windows server if you have messed up with folder permissions.
    Before anything else, make sure the cstrike/addons/amxmodx/data directory actually exists and if it doesn’t, create it.
    The ranks are saved in a file named csstats.dat in cstrike/addons/amxmodx/data directory.
    If using Linux server, make sure the user running HLDS has write permissions on data directory.
    To do this, logon to ssh, change directory to cstrike/addons/amxmodx and write this command: chown -R hluser:hluser data
    Replace hluser with the username that is running HLDS.

    CS Data Directory Permissions Windows Server
    If using Windows server, open properties of data directory, goto Security tab, click on Edit and make sure Write is ticked.

  • Plugin Missing:
    Make sure the plugin statsx.amxx is present in cstrike/addons/amxmodx/plugins folder and its entry is present in cstrike/addons/amxmodx/configs/plugins.ini file without the semi-colon ; in its start.
    CounterStrike StatsX Plugins Ini File

  • Module Missing:
    Make sure the csx module file is present in cstrike/addons/amxmodx/modules directory and its entry is present in cstrike/addons/amxmodx/configs/modules.ini file without the semi-colon ; in its start.
    In Linux server the module’s file name is csx_amxx_i386.so while in Windows server, the name is csx_amxx.dll

  • stats.ini File:
    Make sure the cstrike/addons/amxmodx/configs/stats.ini file has the following entries at least:
    ShowAttackers ;Show Attackers
    ShowVictims ;Show Victims
    ShowStats ;HUD-stats default
    SayRankStats ;Say /rankstats
    SayRank ;Say /rank
    SayTop15 ;Say /top15
    SayMe

Once you have made the required changes, let the server restart a few times and see if the ranks are being saved.

In case all of the above mentioned fixes fail, just write in comments and we will find a solution!