Raised This Month: $90 Target: $400

CSstatsX SQL

Post New Thread Reply   
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Statistical       
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-23-2016 , 12:25   CSstatsX SQL
Reply With Quote #1

CSstatsX SQL

This plugin can replace your CSX module. You need do some changes to your statistics plugins (statsx, miscstats etc.) to make them use this plugin, see how-to below. If you can't or you dont want use MySQL, this plugin will also work with local SQLite database. New features: player played time count and ranking by skill with ELO method.

Version: 0.7.4+1 from 31.08.2018 [ GIT ]

  • Compile this plugin.
    • For utf8 support you need compile and use it with AMXX 1.8.3.
  • Uncomment wanted SQL module in addons/amxmodx/configs/modules.ini file.
  • Set db connection details in following cvars: csstats_sql_host, csstats_sql_user, csstats_sql_pass, csstats_sql_db, csstats_sql_type.
  • Read instruction bellow to add support for your stats plugins.
  • For update from 0.4 import csstats_04_to_05.sql.
  • For update from 0.5 dev import csstats_05dev_to_05.sql.
  • For update from 0.6 import csstats_06_to_07.sql.
  • For update from 0.7 import csstats_07_to_072.sql.
    • For map stats import csstats_07_to_072_maps.sql.
    • Recompile all your plugins with new csstatsx_sql.inc.
  • For enabled player session stats you need import csstats_maps.sql. Please check table name.
    • csstats_maps_sqlite.sql for sqlite.
How to replace CSX module
  • Shutdown your server.
  • Copy dummy_csx_amxx file from archive to addons/amxmodx/modules folder on your server.
  • Rename it to csx_amxx.
  • Set csstats_sql_forwards cvar to 1.
How to add support for your plugins

Perform this instructions for ALL your stats plugins
  • Open plugin source code.
  • Add following on top:
    native get_statsnum_sql()
    native get_user_stats_sql(index, stats[8], bodyhits[8])
    native get_stats_sql(index, stats[8], bodyhits[8], name[], len, authid[] = "", authidlen = 0)
  • Replace all get_statsnum for get_statsnum_sql.
  • Replace all get_user_stats for get_user_stats_sql.
  • Replace all get_stats for get_stats_sql.
  • Compile plugin.
  • csstats_sql_host "localhost" - MySQL host.
  • csstats_sql_user "root" - MySQL user
  • csstats_sql_pass "" - MySQL user password
  • csstats_sql_db "amxx" - DB name
  • csstats_sql_table "csstats" - table name
  • csstats_sql_type "mysql" - database type.
    • mysql - MySQL
    • sqlite - SQLite
  • csstats_sql_create_db "1" - auto create table.
    • 0 - dont query table create
    • 1 - query table create on map load
  • csstats_sql_update "-2" - how to update player stats in db
    • -2 - on death and disconnect
    • -1 - on round end and disconnect
    • 0 - on disconnect
    • higher than 0 - every n seconds and disconnect
  • csstats_sql_forwards "0" - enable own forwards for client_death, client_damage
    • 0 - disable
    • 1 - enable, required if you want replace csx module
  • csstats_sql_rankformula "0" - how to rank player
    • 0 - kills- deaths - tk
    • 1 - kills
    • 2 - kills + hs
    • 3 - skill
    • 4 - played time.
  • csstats_sql_skillformula "0" - skill formula
  • csstats_sql_weapons "0" - enable weapon stats
    • 0 - disable
    • 1 - enable
      • This will create new table csstats_weapons in your database.
        NOTE: table will created only if you set cvar csstats_sql_create_db to 1
  • csstats_sql_maps "0" - enable player session stats
    • 0 - disable
    • 1 - enable
      • NOTE: you need to import csstats_maps.sql.
        Check install instructions.
  • csstats_sql_autoclear "0" - number of inactive days after which player's stats will be retested. (prune function)
  • csstats_sql_autoclear_day "0" - full stats reset in specified day of month.
  • csstats_sql_cachetime "-1" - cache option
    • -1 - enabled
    • 0 - disabled
    • doesn't work with csstats_sql_update -2 or 0
  • csstats_sql_assisthp "50" - minimum damage to count assist. 0 - disable this feature.

  • csstats_sql_reset - full stats reset. This command should executed in server console or via RCON.
Lags on player top 15 motd

For top15 motd non-thread queries are used, this can make your server lag while displaying motd. I added support for threaded queries for top15 from version 0.4, but to add this support for your stats plugins you need to be a somekind of scripter. Send me your stats plugins source code or use plugins with threaded support bellow.
csxmysql_amxx_statsx.zip (22.2 KiB)
AES: StatsX CStrike

CSXSQL: Onlinetime Awards

TOPx By GameTime alternative plugin for CSstatsX SQL. This plugin will give access flags for top players by online time. Compile options:
#define TOP         3                // top number
#define IGNORE_FLAGS    (ADMIN_MENU|ADMIN_LEVEL_H)    // ignore players with those flags
#define GIVE_FLAGS    ADMIN_LEVEL_H            // grant access flags
Other thanks for

Thanks to Lev from aghl.ru forum for dummy_csx module.

Download from GitHub
Attached Files
File Type: zip csstatsx-sql-074.zip (76.1 KB, 876 views)
The functional way is the right way

Last edited by GordonFreeman (RU); 10-14-2018 at 07:32. Reason: update 0.7.4+1
GordonFreeman (RU) is offline
Senior Member
Join Date: May 2015
Location: Pakistan
Old 02-23-2016 , 14:40   Re: CSstatsX SQL
Reply With Quote #2


AssasinSniperNightmare ModArmageddon ModApolacyps Mod
Kakarot47 is offline
Send a message via Skype™ to Kakarot47
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 02-23-2016 , 18:36   Re: CSstatsX SQL
Reply With Quote #3

n1ce plugin i will try to implement skill method at pug plugin.

thanks bro

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar,get_pcvar_num(pCvar) ? 1); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Junior Member
Join Date: Nov 2015
Old 02-24-2016 , 13:55   Re: CSstatsX SQL
Reply With Quote #4

Nice plugin.
Nyte is BACK

Last edited by NyTe; 02-24-2016 at 13:56.
NyTe is offline
Join Date: Jul 2015
Old 02-24-2016 , 15:59   Re: CSstatsX SQL
Reply With Quote #5

Croxeye is offline
Senior Member
Join Date: Mar 2015
Location: Poland
Old 03-09-2016 , 05:40   Re: CSstatsX SQL
Reply With Quote #6

Great job!

I am using this on one of the server as a test version.

Just a suggestion - you could add two more natives in your next version -
1) get user played time based on id (for clcmd)
2) get played time based on rank (for top15, i would like to modify the top15 function in order to show total online time for all each player)

If you want to, I could also provide the web part for this plugin. I am coding it at the moment!
Kowalsky is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 05-04-2016 , 05:20   Re: CSstatsX SQL
Reply With Quote #7

  • Improved queries usage. Now its takes 3-4 queries instead of 32 during mapchange or server shutdown.
  • Updated API.
  • Added csstatsx_sql.inc file.
  • New natives: get_user_gametime, get_stats_gametime, get_user_stats_id, get_stats_id, update_stats_cache.
  • Added rank by played time feature.
  • Added example plugin for api usage.
The functional way is the right way
GordonFreeman (RU) is offline
AlliedModders Donor
Join Date: Nov 2014
Location: India
Old 05-04-2016 , 08:01   Re: CSstatsX SQL
Reply With Quote #8

Nice , .. the comments are in some russain change it to english .
tousif is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 05-10-2016 , 00:55   Re: CSstatsX SQL
Reply With Quote #9

0.7 Dev 1
- Added weapon stats.

You need set csstats_sql_weapons cvar to 1. Plugin will write players weapons stats to csstats_weapons table.

I'm planning to make complete stats plugin like HLXCE or GameME.

Also there is WEB for this plugin, but on russian only for now.
Attached Files
File Type: sma Get Plugin or Get Source (csstatsx_sql.sma - 341 views - 80.8 KB)
The functional way is the right way

Last edited by GordonFreeman (RU); 05-10-2016 at 00:58.
GordonFreeman (RU) is offline
Veteran Member
Join Date: Jul 2010
Old 05-13-2016 , 13:48   Re: CSstatsX SQL
Reply With Quote #10

crazy russians, make rocket of cs 1.6 plugin
Artifact is offline

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 18:28.

Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode