View Single Post
Author Message
DarthNinja
SourceMod Plugin Approver
Join Date: Mar 2009
Location: PreThinkHook()
Old 11-12-2009 , 04:38   [TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
Reply With Quote #1

[TF2] Ranking and Item Logger
Plugin Version 9.1.0
See next post for update info.
Based on code from This Ranking Plugin.
All credit for original plugin goes to it's
original authors.





IMPORTANT NOTE: I am currently not supporting this plugin as it is in dire need of a full rewrite.
Others have released updated versions near the end of this thread, use at your own risk.

!SEE NEXT POST FOR SITE UPDATE INFO!
Description:
This is a TF2 ranking plugin with support for a web interface mysql, and multiple servers.
It can operate in one of two modes:
"Simple" which requires very little setup work.
"Web" which requires more work but is well worth it. Supports multiple servers and a web interface if so desired.

Requirements:
  • 'Simple' mode:
    • One server (you can run more then one server like this but they will not share stats)
  • Multi-server / web interface mode
    • One or more servers.
    • Web server with MySQL and php support.
    • Ability to allow remote access to MySQL databases. (see below).
Need Help? Use IRC!
You can join #tf2stats @ irc.gamesurge.net if you want to talk to me about updates, bugs, etc.
If you don't have an irc client, you can join by clicking here.
Please note: I'm not going to walk you through setting up the plugin, there is documentation for that.

Join the TF2 Stats Plugin Steam Group!
Update notices and whatnot will be posted here, plus it shows your support!
http://steamcommunity.com/groups/TF2StatsPlugin


Chat Commands:
"rank" to display your rank to the server.
"top10" to view the top 10 ranked players.
"players" to view a list of ingame players.
"webrank" to get your webrank
"webtop" to get the webtop
"session" to get information about your session
"hidepoints" to hide the points you get
"unhidepoints" to show the points you get

Admin Commands:
sm_rankadmin - opens the rank admin menu
rank_givepoints <client> <value> - give points client(s)
rank_removepoints <client> <value> - remove points from client(s)
rank_setpoints <client> <value> - sets the client's points to <value>
Cvars:
sm_tf2_stats_version - shows the plugin version
See tf2-stats.cfg for complete list
Install Instructions:
  • Simple:
    1. Upload the .smx file to your /sourcemod/plugins/ folder
    2. Set point settings in tf2-stats.cfg and upload to your /tf/cfg/ folder.
  • Advanced + Web Interface:
    1. Edit your game server's database.cfg file located in /addons/sourcemod/configs and add the values shown below.
    2. Install plugin as above.
    3. Restart your game server.
    4. Edit settings.php (in the "inc" folder).
    5. Run the SQL files located in the website zip in your destination database.
    6. Upload web interface to desired location.

Click here for Detailed instructions!

(Thanks eraserhead!!)



Database.cfg:
Code:
"tf2stats"
{
    "driver"            "mysql"
    "host"                "127.0.0.1"
    "database"            "tf2_stats"
    "user"                "tf2st_usr"
    "pass"                "dbpassword"
    //"timeout"            "0"
    "port"            "3306"
}
Note:
The server needs to be restarted for the database.cfg to be reloaded


Notes:
Make sure to allow your gameserver's IP to access your mysql database.

ToDo:
~

Credits:
Plugin, and original web interface to their respective authors.
Me, for general updates, bug fixes and improvements to the web interface and any future updates.
I accept no credit whatsoever for the work done by R_Hehl (aka R5053), Smokestormx, or anyone else.

Web Version History:
  • Pre V6.0.0
  • V6.0.0
    • Added item support for hats (including spiffy icons!)
    • Fixed player names with non-standard characters displaying incorrectly.
    • Fixed various layout/graphical bugs/inconsistencies.
    • Added code to display "last played" time in 12 hour format instead of 24 hour.
    • Added the ability to set a dynamic website title.
  • V6.0.1
    • Fixed minor bug with nonexistent include file.
  • V6.5.1
    • Added steam community calculation and various related links.
  • V6.5.2
    • Hopefully fixed bug with php header (awaiting feedback)
  • V6.5.5
    • Fixed a SQL injection exploit. (Thanks to michaelh).
    • Fixed steam community id calculations for some people that were having bugs (Thanks Sobuno).
  • V6.6.0
    • Added support for new weapon kill statistics.
    • Better, more accurate naming of items.
  • V6.7.0
    • Remade all kill icons
    • Added new founditem icons for new weapons/hats, etc
    • Updated founditems list
  • V7.0.0
    • Complete rewrite by galadril!
    • Added missing items and weapons
  • V7.0.1 (Galadril)
    • Top10 Page: Top 10 maps are now ordered by points and playtime.
    • Top10 Page: Changed the playtime column.
    • Changed the player page to show the top 3 classes per player.
    • Changed headshot calculation so headshot percents are calculated from kills with weapons that can headshot, not all weapons.
  • V7.0.2 (DarthNinja)
    • Changed map, map_ranking, & top10 pages to show times in am/pm.
    • Replaced periods in dates with slashes on all pages, eg: (03.09.2010 -> 03/09/2010).
    • Added new offset setting in settings.php to fix servers with un-synced clocks
    • "Last Connect" now shows on 2 lines: Date / Time.
Plugin Version History:
  • V5.0
    • Same as posted here (No changes)
  • V6.0
    • Added new weapons from the soldier/demo update:
      rocketlauncher_directhit, pickaxe, taunt_soldier, sticky_resistance, sword, demoshield, taunt_demoman.
    • Added excluded weapons:
      deflect_flare, telefrag.
    • Fixed headshot tracking. (Thanks Sobuno)
  • V6.1
    • Hopefully fixed sqlite errors with the new weapons. (Thanks Sobuno)
  • V6.3
    • Added rank_ignorebots cvar to allow for blocking/unblocking bots from getting points
    • Changed plugin file name from n1g-tf2-stats.smx to TF2_Stats.smx
  • V6.4
    • Fixed bots getting points for killing buildings and capping points (rank_ignorebots).
    • Added kill tracking for "tribalkukri" (Tribalman's shiv).
    • Added kill tracking for "battleaxe" (Scotsman's skullcutter).
    • Added kill tracking for "ball" (Sandman baseball).
    • Added kill tracking for "paintrain" (Pain Train).
    • Added kill tracking for "sledgehammer" (Homewrecker).
    • Added kill tracking for "unique_pickaxe" (The Equalizer when player has less then 25 health).
    • Added kill tracking for "tf_pumpkin_bomb" (Pumpkin Bombs).
    • Added check to prevent running an old version alongside a new version (file check).
  • V6.5
    • Not released: Changes rolled into V6.6.
  • V6.6
    • Added kill tracking for:
      • Goomba Stomp (Mod)
      • The Lugermorph
      • The Big Kill
      • The Frontier Justice
      • The Wrangler
      • The Gunslinger
      • The Southern Hospitality
      • The Blender Taunt (Gunslinger Taunt)
      • The Guitar Taunt (Frontier Justice Taunt)
    • Fixed bots getting points for killing buildings (hopefully)
    • Now logs players' last used IPs
    • Changed all cvar descriptions (ingame) for easier reading
    • Reorganized handles and cvars in code (nothing you will notice).
    • Added some more mysql/php/html filters to player names.
    • Fixed incorrect building IDs
  • V6.6.1
    • Fixed kills with sentries not being tracked (bug introduced V6.5).
    • Now the plugin tracks kills per sentry level, as well as total sentry kills.
  • V6.6.2
    • Fixed issue an caused by a query buffer being too small and preventing players from being added to sqlite databases. Thanks InflatableSoulmate|BoC !!
  • V6.6.3
    • Added missing reflect_flare cvar
    • Fixed an apparent issue with mysql and UTF8 (Special-char names are now stored correctly).
  • V6.6.4
    • Corrected typo with reflect_flare cvar [Now: rank_deflect_flarepoints].
    • Tweaked the kill code related to bots.
    • Slightly changed the connect text. (Now "[Rank X out of X]" vs "[Rank X of X]" before).
  • V6.6.5
    • Pushed properly indented source code
    • Updated webrank and webtop chat commands to work with new website
    • Made the chat output look nicer, and give better info! See <this post> for more info!
    • Added full list of cvars with notes to the cfg!
    • Added new cvar: rank_connectcountry
  • V6.7.0
    • Added support for the following polycount weapons:
      • The ShortStop
      • The Holy Mackerel
      • The PowerJack
      • The Degreaser
      • The Vita-Saw
      • The Eternal Reward
      • The L'Etranger
    • Latest copy of GeoIP.dat is now included with the zip.
  • **V7.0.0**
    • Added the rest of the polycount weapons:
      • The Black Box
      • The Sydney Sleeper
      • The Bushwacka
      • The Gloves of Running Urgently
    • Added the Frying Pan
    • Added the Engi's Mech-Hand Combo-kill
    • Custom sounds can now be used for the connect sound.
    • Added a second connect sound that plays when a player on the Top10 list joins the server (see cvars).
    • Kills and deaths are now tracked on a per-class basis as well as total.
    • Medic healing is now tracked, the value is updated when the medic dies.
  • V7.0.1
    • Prevents top10 sound from being added to the downloads table if disabled.
    • Top10 sound is now disabled by default until I can figure out why it plays at random
  • V7.1.2
    • Added Horseless Headless Horsemann's HeadTaker Axe
    • Fixed the top10 connection sound playing for random people.
  • V7.4.7 - Adds 1,271 lines of code
    • Added tracking for iron_curtain
    • Major fixes for SQLite databases
      (This update will repair any previous "NULL" field issues)
    • Changes to roundend actions to prevent chat spam (See next post)
    • New chat triggers!
      • kdeath/kdr - Shows players overall kill/death ratio
      • kd<class> - shows KDR for that class
      • lifetimeheals - shows total HP healed
      • More chat triggers
    • VIP System (see next post)
    • Revamped rank_admin menu with options to give/remove points
    • Commands to add/remove/set players' points
  • V7.4.8
    • Fixed a minor bug related to maxplayers
    • Fixed a longstanding error related to AskPluginLoad
  • V7.5.0 - Adds 352 lines of code
    • Adds support for the 12 new Christmas Update weapons:
      • Candy Cane
      • Boston Basher
      • Back Scratcher
      • Ullapool Caber
      • Loch-n-Load
      • Claidheamh Mòr
      • Brass Beast
      • Warrior's Spirit
      • Fists of Steel
      • The Jag
      • The Amputator
      • Crusader's Crossbow
    • Changed rank_admin command to sm_rankadmin
    • Improved Sandvich-steal tracking code
    • Fixed rank_showranktoall being ignored (Thanks Lob)
    • Added Sandman stun tracking code (Thanks heffebaycay)
  • V7.6.2 - Adds 170 lines of code
    • Fixes tracking for the following weapons: BlackBox, Sydney Sleeper, Brass Beast, Bushwhacka, Claidheamh Mòr, Crusaders Crossbow, Warrior's Spirit, Gloves of Running Urgently, and the Loch 'n Load.
    • Adds tracking for Mini Sentries and Ullapool Explosions
    • KDR commands now respect the rank_showranktoall cvar
    • Fixed a crash that could happen if someone set the sound file to "" for the connect sound
    • Added rank_ignoreteamkills to prevent tracking of team-kills
    • Stun cvars are now included in the config file.
  • V7.6.5 - Adds 56 lines of code
    • Adds tracking for the soldier's grenade taunt when he has the worms hat equipped (aka taunt_soldier_lumbricus).
    • Fixed a minor bug where the plugin would try to get the team of client 0 (console)
    • Fixed a typo in the cfg (Hi xomp!)
    • Note: plugin version will show 7.6.4, not 7.6.5 (oops!)
  • V7.6.8 - Adds 72 lines
    • Add the rift promo items (Sun-on-a-Stick and Sharpened Volcano Fragment)
    • Added bonus points for headshots
  • V7.6.10
    • Fixed crappy code related to chat hooks
    • Plugin will now respond to triggers in public and team chat
    • Plugin will no longer respond to gagged players
  • V7.7.0 - Adds 102 Lines - さむらい
    • Added support for the weapons added in the Samurai Update:
      • Half-Zatoichi Katana (demokatana)
      • Fan O'War (warfan)
      • Conniver's Kunai (kunai)
    • Increased the Spy's point cvar values slightly
    • Latest version of GeoIP.dat (March 1st) included in the zip.
  • V7.8.0
    • Added support for the Witcher and Red Faction: Armageddon promo items:
      • The Three-Rune Blade
      • The Maul
  • V7.8.1
    • Quick database version fix, was not updated in version 7.8.0.
  • 8.0.1 - The Über Update - Adds 368 lines
    • Fixed a sql query issue reported by SonicSNES.
    • Plugin now checks /cfg/ and /cfg/sourcemod/ for its config file.
    • Added tracking for the weapons from the Über Update:
      • The Soda Popper
      • The Winger
      • The Atomizer
      • The Liberty Launcher
      • The Reserve Shooter
      • The Disciplinary Action
      • The Market Gardener
      • The Mantreads
      • The Detonator
      • The Persian Persuader
      • Splendid Screen Shield Charge
      • The Tomislav
      • The Family Business
      • The Eviction Notice
      • The Overdose
      • The Solemn Vow
      • The Bazaar Bargain
      • The Shahanshah
      • The Enforcer
      • The Big Earner
    • The June 2011 version of GeoIP.dat is included with this update.
  • V8.1.2 - Adds 104 lines
    • Added the Summer Update weapons:
      • The Postal Pummeler
      • Nessie's Nine Iron
    • Cvar rank_show has been renamed to rank_show_on_connect to more accurately reflect what it does.
    • Fixed an extra case where messages were still shown on connect.
    • You can now set rank_connectcountry to 0 to disable the printing of players' countries
    • New cvar rank_show_player_count_notice added to enable/disable printing of "Ranking enabled/disabled" player-count messages.
    • Bots will now show their country as "Localhost" rather then "Unknown".
  • V8.1.4
    • Fixes VIP kill text being printed to all players
    • Fixes a SQL error SQLite users would get when a new player joins and would prevent that player's record from being created.
  • V8.3.1 - "Star Wars" Update
    • Added tracking for the Victory Pack (aka "Star Wars") weapons:
      • The Cow Mangler
      • The Righteous Bison
    • Fixed points not being printed if the points were 0, but a bonus was added
    • Added a time offset cvar to the plugin to allow tweaking "last seen" times at the server level.
    • IPAddress database field has been bumped from 17 to 50 characters in length to support IPv6
    • Updated descriptions for CP/CTF cvars
    • CTF Tracking Changes:
      • Plugin can now give points to the capping player instead of/in addition to the whole team (cvar added).
      • Plugin now counts intel captures only for the capping player, not the entire team.
      • Added admin command to reset all "number of times capped" records (rank_debug_resetallctfcaps)
    • CP Tracking Changes:
      • Plugin can now give points to the capping player(s) instead of/in addition to the entire team (cvar added).
      • Plugin now counts captures only for the capping player(s), not the entire team.
      • Added an admin command to reset all "number of points capped" records (rank_debug_resetallcpcaps)
      • Added pl_ and plr_ maps to the list of game types that have control points.
      • Fixed a bug preventing the correct tracking of blocked CP captures.
    • Minor grammatical fixes for ctf/cp cap notices
    • Added a cvar to disable the round start/end messages
  • V8.4.2 - QuakeLive Update
    • Added tracking for weapons from the QuakeLive Update:
      • The Original
    • Added a check in RankPanel(); to prevent an error related to clients who are not ingame
    • Fixed an error in FlagEvent(); related to clients who are not ingame.
    • Added tracking for the number of players that have used a player's teleporter.
    • Added points for teleporting players.
  • V8.5.3 - Deus Ex
    • Added missing cvars to the cvar file
    • Added tracking for reflected Mangler projectiles.
    • Added tracking for the Deus Ex promo items:
      • The Widowmaker
      • The Short Circuit
      • The Machina
      • The Machina (Double Kill)
      • The Diamondback
    • Plugin will now log an error and enter a fail state if it cannot connect to a database.
    • Global KDR command now counts assists as 1/2 a kill.
    • Default teleporter-use points dropped from 2 to 1.
    • Healing is now updated for every death, not just medic deaths.
  • V8.6.0
    • Fixes item tracking with the new event data.
    • Plugin now logs extra data from the found item event:
      • Item Index (Replaces item name)
      • Quality (vintage, genuine, etc)
      • Method (found, crafted, etc)
    • Adds an index to the Players table for the Points column.
  • V8.7.0 - Halloween 2011
    • Tracking added for the following weapons:
      • The Conscientious Objector
      • The Scottish Handshake
      • The Unarmed Combat
      • The Wanga Prick
      • The Saxxy
    • Added tracking for Monoculus stuns!
    • Added tracking for Monoculus kills!
    • Plugin now prints to the error log file when disabling a very old version of itself using on old filename.
    • Added support for using exclamation marks in front of chat commands.
    • Fixed a problem relating to point captures where the plugin would ignore the value of rank_pointmsg and always print points earned.
    • Plugin will now ignore fake item_found events fired by the [TF2] Fake Item Messages plugin.
    • Pushed the November 1st update of GeoIP.dat.
  • V8.9.0 - Christmas 2011
    • Added tracking for the following weapons:
      • The Phlogistinator
      • The Manmelter
      • The Third Degree
      • The Holiday Punch
      • The Pomson 6000
      • The Eureka Effect
      • The Sharp Dresser
      • The Spy-cicle
    • Change default point values for:
      • Deflected Cow Mangler (3 -> 8)
      • Knife (3 -> 4)
    • Pushed the December 6th update of GeoIP.dat.
  • V8.10.1
    • Fixed tracking of found items (for reals this time)
  • V8.10.2
    • Fixed founditems table not being created in some cases.
  • V8.14.2
    • Connection code rewritten to establish a threaded SQL connection.
    • OnMapStart code has a timer added retry if a database connection has not yet been established.
    • Plugin now uses SQL_ConnectCustom for SQLite connections (Fixes deprecated function warning).
    • Set rank_removeoldplayersdays and rank_removeoldplayers to default to 0 to prevent accidental database pruning if the config file is not read.
    • GeoIP.dat updated to February 7th version
    • Fixed incorrect version numbers in update query checks
    • Added Tracking for:
      • The Black Rose
      • The Wrap Assassin
      • The Apocofists
  • V8.15.0
    • Bumped up version numbers to account for people who's dbversion was too high.
  • V8.15.1
    • Fixed tables not getting created/updated for people using SQLite.
  • V8.15.2
    • Removed a query that SQLite does not support.
  • V8.18.0
    • Added delay timer to rank queries so players cant spam the command (default delay of 5 minutes).
      (This is to prevent overloading large databases when doing COUNT)
    • Bots will no longer be tracked for Sandman stun events or Sandviches stolen.
    • Bots will no longer get points for teleporting players.
    • The connecting player message will no longer be shown when bots join.
    • Player extinguished function completely rewritten.
    • The plugin will now try to reconnect to the database after 15 minutes if the connection is lost.
  • V8.18.1
    • Incorrect if statement ordering
  • V9.0.0
    • Greatly improved !rank command delay.
    • Added tracking for new Meet The Pyro items
  • V9.1.0
    • Added tracking for the Sleeping Dogs items

See next post for update instructions (major updates only).



Total lines of code: 8,465
Total downloads: 7,720

Author Note: I will not help you set up and configure your database user permissions.
Only you can allow your gameserver access to your database.
Only you can prevent forest fires.


Attached Files
File Type: zip [TF2] Ranking and Item Logger v9.1.0.zip (819.5 KB, 11436 views)
__________________

Last edited by DarthNinja; 03-31-2019 at 10:43.
DarthNinja is offline