View Single Post
Mister_Magotchi
SourceMod Donor
Join Date: Dec 2006
Location: Nampa, Idaho
Old 07-16-2011 , 21:04   Re: CS:S Team Balance
Reply With Quote #494

I have made a tweak to this plugin, based on version 2.2.4 by GrO.

This version makes use of (and requires) the HLstatsX:CE SQL API for Sourcemod.

In the original plugin, as each player connects, their kills, deaths, KDR (for some reason), and timestamp from their previous session are grabbed from the database. When the player disconnects, that same data (updated based on the current session) is written back to the database.

Looking at sm_tbstats, other admins and I noticed some inconsistencies in the data. Some players had accurate stats (several thousand kills for a few), but some players, including one that had played every day for the last week (and had over 1000 kills for the week) had only about 60 kills in sm_tbstats.

Rather than spend lots of time troubleshooting the reason behind this issue, I decided to change the plugin to use HLstatsX:CE data instead.

In this version, when a player connects to the server (or when the map changes), their kills and deaths are loaded via the HLstatsX:CE SQL API. If either their stats can't be loaded or have not been loaded (like if the the plugin is reloaded while a game is running), the balancer will just calculate based on their current session kills and deaths that it normally collects. [Edit: This can be fixed using the API, but I was apparently just lazy, and who cares.] Additionally, the plugin still continues to augment the initial kill/death data with data it collects from the current session, although it of course reloads all that data on map change, which is no problem, since HLstatsX:CE was keeping track of the same data anyway.

This plugin is read-only with respect to HLstatsX:CE data.

I haven't tested it extensively, but so far it isn't throwing any errors in my logs, the proper data is showing up in sm_tbstats (the plugin's internal stats it's using for the session), and people are getting balanced around. Time will tell whether it actually does a great job of balancing.

For those unsure how to get the HLX:CE API working after installing it, you have to add an "hlxce" entry to addons/sourcemod/configs/databases.cfg with the information for your HLstatsX:CE MySQL database. I've also attached a compiled version of HLX:CE API 0.4 alpha (the latest as of now) for those who aren't sure how to compile with includes.

Short version:
CS:S Team Balance with HLstatsX:CE API support:
Attached Files
File Type: zip css-teambalance-hlstatsx-api.zip (34.7 KB, 241 views)
File Type: zip hlxce-sm-api-0.4-alpha.zip (11.7 KB, 279 views)

Last edited by Mister_Magotchi; 07-17-2011 at 19:26.
Mister_Magotchi is offline