Thread: CSstatsX SQL
View Single Post
Plugin Info:     Modification:          Category:         
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 02-23-2016 , 11:25   CSstatsX SQL
Reply With Quote #1

CSstatsX SQL

Description
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 ]

Requirements
Installation
  • 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:
    Code:
    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.
Cvars
  • 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.
Commands

  • 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:
Code:
#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, 2334 views)
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 10-14-2018 at 06:32. Reason: update 0.7.4+1
GordonFreeman (RU) is offline