AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   CSstatsX SQL (https://forums.alliedmods.net/showthread.php?t=279483)

GordonFreeman (RU) 02-23-2016 11:25

CSstatsX SQL
 
1 Attachment(s)
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

Kakarot47 02-23-2016 13:40

Re: CSstatsX SQL
 
kharasho :D

^SmileY 02-23-2016 17:36

Re: CSstatsX SQL
 
n1ce plugin i will try to implement skill method at pug plugin.

thanks bro

NyTe 02-24-2016 12:55

Re: CSstatsX SQL
 
Nice plugin.

Croxeye 02-24-2016 14:59

Re: CSstatsX SQL
 
Gj :)

Kowalsky 03-09-2016 04:40

Re: CSstatsX SQL
 
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!

GordonFreeman (RU) 05-04-2016 04:20

Re: CSstatsX SQL
 
Updated.
  • 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.

tousif 05-04-2016 07:01

Re: CSstatsX SQL
 
Nice , :) .. the comments are in some russain change it to english .

GordonFreeman (RU) 05-09-2016 23:55

Re: CSstatsX SQL
 
1 Attachment(s)
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.

Artifact 05-13-2016 12:48

Re: CSstatsX SQL
 
crazy russians, make rocket of cs 1.6 plugin


All times are GMT -4. The time now is 20:16.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.