AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [TF2 Stats] With Web Ranking and Item Logger [v9.1.0] (https://forums.alliedmods.net/showthread.php?t=109006)

DarthNinja 11-12-2009 04:38

[TF2 Stats] With Web Ranking and Item Logger [v9.1.0]
 
1 Attachment(s)
[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.



DarthNinja 11-12-2009 04:38

Re: TF2 Stats With Web Ranking and Item Logger
 
When Updating:
  1. Back up your database (optional but recommended)
  2. Upload new .smx
  3. Configure your cfg with the new cvars as desired
  4. Restart server or reload the plugin.
  5. Run rank_debug_resetallcpcaps and rank_debug_resetallctfcaps commands to reset all CTF and CP cap records in the database.
    This is to clean out old tracking data that really wasn't correct at all.
    Note: These commands will not change any other stored values (eg, point totals).
-------------------------------------------------------------------------

To edit the database:
  1. Open your database in phpMyAdmin (Or with This App if you use SQLite) (Example).
  2. Browse to the "Players" table for player ranking data.
  3. Find the record you're looking for and edit it.
Note: The server will have to be stopped to re-upload the edited sqlite file. MySQL edits can be done live.
If deleting a player record, that player's record will not be recreated until they connect again.


FAQ:

I'm going to start a FAQ here for questions that get asked far too often.
These are mostly going to be for MySQL setups since SQLite is more or less foolproof.
Please read before posting!

Always make sure you are running the latest versions before reporting problems.
They may have already been fixed!

  • Q: I'm getting "mysql_fetch_array():" errors and my site doesn't work!
    A: Some of your database tables are missing. Most likely your Players table.

  • Q: I seem to be missing my "Players" database table, help!
    A: The plugin creates the players table the first time it is run. Install and run the plugin to create the table.

  • Q: Other database tables are missing!
    A: Run the SQL scripts included with the site version you happen to be using.

  • Q: How do I run the scripts?
    A: Using phpMyAdmin or another tool like it.

  • Q: I installed and ran the plugin, but it's not creating the "Players" table.
    A: Your databases.cfg file isn't configured correctly and the plugin has fallen back to using SQLite.

  • Q: I configured my databases.cfg file, but the plugin won't work.
    A: Ether your file is misconfigured, has incorrect information, or your MySQL server isn't allowing your MySQL user to connect from your gameserver's ip.

  • Q:How can I allow my gameserver to access my database?
    A: When you create a database user you will most likely be able to set access restrictions based on IP. You'll need to allow your gameserver's IP access. For more help, contact your web host.

  • Q:I gave my gameserver's IP access, but it's still being blocked.
    A: You have to use your gameserver box's physical IP, not the IP that srcds listens on. The correct IP should be provided in the error TF2Stats will generate.

Moving to MySQL from SQLite:
I do not support doing this any more, but you are welcome to try on your own.
  1. Grab your SQLite DB file located at /sourcemod/data/sqlite/tf2stats.sq3
  2. Use this program to open the file export the data from it.
  3. Setup the TF2 stats plugin with MySQL and let it create the table structures.
  4. Import the data *only the data* from the SQLite database.
If you directly copy the SQLite database to MySQL you will be missing a few columns which will cause plugin errors.

Note: Due to structure differences in the SQLite and MySQL database versions, you will have to do an INSERT INTO VALUES statement. You may be able to generate the required SQL by first importing in to intermediary database, exporting, and re-importing.

Ghost Killer 11-12-2009 12:43

Re: TF2 Stats With Web Ranking and Item Logger
 
The only thing you changed was the item found on webpage right? The database was already getting the hats? I thought in doing this same thing, since it would be very easy, but someone posted a ver better stats page and plugin (in beta phase), and I'd rather waiting for that...

Evil-Dragon 11-13-2009 16:31

Re: TF2 Stats With Web Ranking and Item Logger
 
Only problem i have is
Code:

Warning:  include(inc/names.inc.php) [function.include]: failed to open stream: No such file or directory in /home/fhlinux209/e/evil-dragon.co.uk/user/htdocs/tf2server/top10.php on line 3

Warning:  include(inc/names.inc.php) [function.include]: failed to open stream: No such file or directory in /home/fhlinux209/e/evil-dragon.co.uk/user/htdocs/tf2server/top10.php on line 3

Warning:  include() [function.include]: Failed opening 'inc/names.inc.php' for inclusion (include_path='.:/usr/share/pear/') in /home/fhlinux209/e/evil-dragon.co.uk/user/htdocs/tf2server/top10.php on line 3


DarthNinja 11-13-2009 16:46

Re: TF2 Stats With Web Ranking and Item Logger
 
@Evil-Dragon
Thanks for catching that, I fixed it in V6.0.1
You can also create a blank text file in /inc/ called "names.inc.php" that will fix it.

Evil-Dragon 11-13-2009 16:46

Re: TF2 Stats With Web Ranking and Item Logger
 
Thanks, i figured it out to add a blank file in the end. :)

Suggestion: Also add a tf2items backpack link to the userpage under Steam Community?

Format is http://www.tf2items.com/profiles/xxxxxxxxxxxxxx (where xxxxxxx is the steam userid)

DarthNinja 11-13-2009 16:52

Re: TF2 Stats With Web Ranking and Item Logger
 
Yea I'm planning to add that once I figure out how to calculate profile ids from steam ids.
-Added to todo list

Evil-Dragon 11-13-2009 16:57

Re: TF2 Stats With Web Ranking and Item Logger
 
Will this help?

Code:

<?php function steam2friend($steam_id){
    $steam_id=strtolower($steam_id);
    if (substr($steam_id,0,7)=='steam_0') {
        $tmp=explode(':',$steam_id);
        if ((count($tmp)==3) && is_numeric($tmp[1]) && is_numeric($tmp[2])){
            return bcadd((($tmp[2]*2)+$tmp[1]),'76561197960265728');
        }else return false;
        }else{
            return false;
        }
    } 
?>

I used that in a bit of backend coding i found to translate steam_id's to community id's. You can see it in use here: http://www.evil-dragon.co.uk/itemlog/

It took me a while to get it working with my limited knowledge of php. :D

Also there appears to be a problem with the statistic "Intel Captured" it is recording one for every player on red/blu whenever someone else captures the intel.

Ginxeng 11-16-2009 19:02

Re: TF2 Stats With Web Ranking and Item Logger
 
I starting using this last night and it seems to works, it logs the stats and everything but the only thing I'm having problems with is that I get this at the top of the page.

Code:

Warning: include(inc/names.inc.php) [function.include]: failed to open stream: No such file or directory in /home/assas651/public_html/TF2 Ranking/index.php on line 3
 
Warning: include() [function.include]: Failed opening 'inc/names.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/assas651/public_html/TF2 Ranking/index.php on line 3

Here is the page if you want to look at it.http://www.assassinsunknown.com/TF2%20Ranking/

DarthNinja 11-16-2009 22:14

Re: TF2 Stats With Web Ranking and Item Logger
 
Quote:

Originally Posted by Ginxeng (Post 991723)
I starting using this last night and it seems to works, it logs the stats and everything but the only thing I'm having problems with is that I get this at the top of the page.

Thanks, I'd fixed that but stupid 7-Zip (more my fault, but I'd rather blame the program) didn't replace the files when I updated them.

It's fixed now, grab a new copy :)

cybersquare420 11-18-2009 08:49

Re: TF2 Stats With Web Ranking and Item Logger
 
great to see someone pick this up... r-rehl has started chasing women and lost interest in development... i asked him about it a while back...
i have one request... I run a bot server, and the bots all score to one account, so in 1 day they will amass over 100000 points, and take fiorst place unless i delete the account every day...
I was wondering if u could put a fake client check into the code to stop the database from recording points for the bots. I still want the players to get kill points for killing the bots, just no score for bots killing/capping etc.
also, on that note, it would be cool if there was a cvar for adjusting the points awarded for a bot kill... sm_bot_point_ratio 1.0 or something similar... the bots are less of a challenge than a real player, so i would like to give 1/2 points for killing a bot...
As always i am willing to guinee-pig any development u may do before release (i did this for r_rehl as well) pm me if u are interested in a windows dedicated server for testing, i have several.

thanx in advance

DarthNinja 11-18-2009 16:26

Re: TF2 Stats With Web Ranking and Item Logger
 
Well at the moment I'm trying to avoid updating the plugin, although I'm keeping a list of changes that need to be done.

If you want, I can add a check to the php web form so that bots don't show up on the rankings...
I could have that done in a day or two, let me know :wink:

cybersquare420 11-18-2009 20:46

Re: TF2 Stats With Web Ranking and Item Logger
 
thanx... but im afraid that wont do it... i need to block their score from being written to the database...

but i do appreciate you answering me so fast...
thanx anyway... guess i can go back to pestering the author... lol... he said he would do it for me someday... but someday has yet to come... lol

DarthNinja 11-19-2009 01:54

Re: TF2 Stats With Web Ranking and Item Logger
 
Alright, I'll see about editing the plugin shouldn't be to hard... hopefully.
I'll see if I can do it this weekend.

cybersquare420 11-19-2009 08:41

Re: TF2 Stats With Web Ranking and Item Logger
 
u rock, man!! + Karma!!

hope i not being a pest.. was not my intention :)

Evil-Dragon 11-20-2009 11:49

Re: TF2 Stats With Web Ranking and Item Logger
 
Did that code help with translating the steam ids into community id's?

Btw, i've had this working for a while now at: http://www.evil-dragon.co.uk/tf2server/index.php

Works nicely.

DarthNinja 11-20-2009 14:07

Re: TF2 Stats With Web Ranking and Item Logger
 
To be honest I haven't tried it yet, L4D2 kinda ate up all my free time for the last week :nono:

I'd like to get the steamID calculation and bot check added to the site/plugin this weekend hopefully

The JCS 11-23-2009 17:34

Re: TF2 Stats With Web Ranking and Item Logger
 
Could you add support to translations on the plugin?

I've made a custom webinterface in portuguese, but I don't want hard code the plugin translation

DarthNinja 11-23-2009 17:49

Re: TF2 Stats With Web Ranking and Item Logger
 
Quote:

Originally Posted by The JCS (Post 997383)
Could you add support to translations on the plugin?

I've made a custom webinterface in portuguese, but I don't want hard code the plugin translation

Could you elaborate more on what you want? (I'm not 100% sure what you're asking)
If you're asking for a setting in a config file what would let you toggle language settings, I could do that fairly easily. However I would rather have multi-language support so people can click a flag at the top of the page to change the language (or something like that).
I'll see about adding that soon-ish...

Coming soon-er-ish (hopefully tonight) will be a bunch of client profile controls:
  • View Profile
  • View Backpack
  • View Achievements (stock TF2 ones)
  • View custom achievements (if server is running this plugin)
  • Add as friend
  • Send a steam message (if added as a friend)
  • Invite to group (if logged into steam)
I have to wait a little while before I can install the custom achievements plugin and test that out... :grrr:

The JCS 11-23-2009 18:41

Re: TF2 Stats With Web Ranking and Item Logger
 
I just want the translation support on the PLUGIN...

DarthNinja 11-23-2009 20:19

Re: TF2 Stats With Web Ranking and Item Logger
 
Quote:

Originally Posted by The JCS (Post 997457)
I just want the translation support on the PLUGIN...

Gotcha, added to the todo list

DarthNinja 11-25-2009 19:56

Re: TF2 Stats With Web Ranking and Item Logger
 
Rewrote some php to calculate Steam Community IDs without requiring php extensions.

Translation:
Steam community links will work anywhere the web interface does.
Should have a new version tonight.

cybersquare420 11-25-2009 20:44

Re: TF2 Stats With Web Ranking and Item Logger
 
u r a god among men!!

DarthNinja 11-25-2009 22:20

Re: TF2 Stats With Web Ranking and Item Logger
 
Got all the stuff I wanted working:


http://content.screencast.com/users/...11-25_2209.png


Not sure I like the button styles though, going to see about changing them possibly.
Also I'm going to add some configuration settings for the Custom Achievements button to enable/disable it, and set the file path.

Custom achievements plugin if you weren't aware of it:
http://forums.alliedmods.net/showthread.php?t=109397

Gonna take a break, then finish this up and post it :o

~edit:
If you want to see the page, take a look at the demo link on the first page :up:

DarthNinja 11-26-2009 05:07

Re: TF2 Stats With Web Ranking and Item Logger
 
Bumpity, updated to include steam links etc. :up:

A preview of the new buttons is viewable on the first page (I changed the style from the ones above).
I included the red and black buttons too if anyone wants to use them. :wink:

Ghost Killer 11-26-2009 19:21

Re: TF2 Stats With Web Ranking and Item Logger
 
What about best of each class, like this concept: http://forums.alliedmods.net/showthread.php?t=71196

Also, he has a nice and sexy concept of design to the webpage...

It seens he abandoned the project... =(

MjrNuT 11-29-2009 19:30

Re: TF2 Stats With Web Ranking and Item Logger
 
Hey DarthNinja,

I'm giving your stats plugin a go in lieu of HLStatsX. :D

Question, I run w/ S-TV on. A chance this might make things wonkey?

Maybe ignore bots in stats, but still list it on the Player List for Online Players?

Thanks


Edit: I keep getting on the Main Page: DB query failed.

I have triple checked everything, but I'll just lay it out just in case.

Gameserver is @ IP1:27015

1. databases.cfg

Quote:

"flashstats"
{
"driver" "mysql"
"host" "IP2"
"database" "_flashstats"
"user" "_stats"
"pass" "pass"
//"timeout" "0"
"port" "3306"
}
2. Confirmed with GSP no restrictions on incoming IPs to the gameserver.


TF2 stats host is @ IP2

1. I've created the db, user, password, provided full access to the db.

2. The Gamerserver IP1 has been allowed and my host checked that connection the db was successful.


3. Settings.php

Quote:

$mysql_server = "localhost";
$mysql_user = "_stats";
$mysql_password = "pass";
$mysql_database = "_flashstats";
No error_log files are being generated.

MjrNuT 11-29-2009 20:50

Re: TF2 Stats With Web Ranking and Item Logger
 
Quote:

Originally Posted by DarthNinja (Post 987696)
Database.cfg:
Quote:

"tf2stats"
{
"driver" "mysql"
"host" "127.0.0.1"
"database" "tf2_stats"
"user" "tf2st_usr"
"pass" "dbpassword"
//"timeout" "0"
"port" "3306"
}

Ok, I didn't realise that what I have underlined above was explicit. Thought this could be changed.

Thanks!

No issues whatsoever at all.

SCE_Ghost 12-01-2009 01:31

Re: TF2 Stats With Web Ranking and Item Logger
 
So I want to host the webstats on my website server, I setup an db for the stats. Im still getting an sql error. I notice in tf2-stats.cfg there is a place for webinterface settings, do I add the correct settings? if so which file do I direct it to?

SOrry for the noob questions just trying to clarify.

DarthNinja 12-01-2009 04:11

Re: TF2 Stats With Web Ranking and Item Logger
 
Quote:

Originally Posted by MjrNuT (Post 1002641)
Ok, I didn't realise that what I have underlined above was explicit. Thought this could be changed.

Thanks!

No issues whatsoever at all.

Yea, the "tf2stats" is what the plugin uses to find its settings.

Quote:

Originally Posted by SCE_Ghost (Post 1003732)
So I want to host the webstats on my website server, I setup an db for the stats. Im still getting an sql error. I notice in tf2-stats.cfg there is a place for webinterface settings, do I add the correct settings? if so which file do I direct it to?

SOrry for the noob questions just trying to clarify.

I'm not sure what you're asking exactly.

What you need to do is:
  • Create a database on your webserver
  • Create a user/password for that database and give it full access. (make sure to allow access from your gameserver's IP)
  • Edit your sourcemod databases cfg file with the IP, database name, username and password for the database.
  • Restart your gameserver and load the ranking plugin.
Once thats done correctly, the plugin will populate the database with the correct tables/fields.
If the web interface can't connect to the database, it could be because the db settings are incorrect in the settings.php include, or because the correct tables don't exist in the database (make sure the plugin is working).

SCE_Ghost 12-01-2009 12:08

Re: TF2 Stats With Web Ranking and Item Logger
 
Thank you for the reply

Here is what I'm seeing missing and causing all the confusion.

1.The database.cfg - use the settings shown if adding to the same server as TF2 is running on, other wise you will need to add your web sql info if hosted elsewhere. i.ee I host at hostmonster.com. you will also need to add i.e. gameservers ip your remote sql list (found in cpanel)
*Please correct me if I am miss informed.

2. The web interface/inc/settings.php - I assume since I am hosting with hostmonster I add my sql db info in there as well - so same info for both database.cfg and settings.php?

3. tf2-stats.cfg - besides changing the points there is a setting for enabling webinterface:
// :: Webrank Configuration
rank_webrank "0"
rank_webrankurl ""

*does this get edited as well??

Also I noticed that the .smx does not show in my loaded plugins listing -
sm plugins list (yes I stopped and restarted the server)

Any help would be grateful.

DarthNinja 12-01-2009 14:22

Re: TF2 Stats With Web Ranking and Item Logger
 
Ignore tf2-stats.cfg.

Here is an example of a correct config using mysql:
"tf2stats"
{
"driver" "mysql"
"host" "123.456.789" -your webserver's ip
"database" "_tf2stats" -your db name
"user" "_stats" -your username
"pass" "11122fgt" -above user's password
//"timeout" "0" -ignore
"port" "3306" -also ignore
}

You would use the same settings for the settings.php file, except you would use localhost rather then the server IP. (Assuming you have the database and the website on the same server).

If the plugin is not running you have to fix that first.
Refresh your server's plugins, if it's not loaded, check for errors.
If it says something like "IP1 is denied access to database on IP2" then you need to unblock "IP1" and allow it to edit the database.

If you refresh the plugins and there are no errors and the plugin still isnt loaded, then you probably installed it wrong.

SCE_Ghost 12-01-2009 17:17

Re: TF2 Stats With Web Ranking and Item Logger
 
Ok I have it setup as you stated. I'm still not getting the pluggin loaded so I'm guessing thats more the issue. However the when you say error I assume you looking in the tf2 logs?

Also with cpanel remote sql option you cannot add a port # only the ip could that be causing any issues?

Also can you install the .smx file wrong lol? I just placed it were it said to go addons/sm/plugins/....

here is my site link
Code:

http://www.shadowcompanyelite.com/tf/tf2stats/
Also just got this on the gameserver error logs
Failed to connect: [2003]: Can't connect to MySQL server on '74.220.*.*' (110)- (I edited the ip on here only)
L 12/01/2009 - 14:18:34: [SM] Native "SQL_TQuery" reported: Invalid database Handle 0 (error: 4)
L 12/01/2009 - 14:18:34: [SM] Displaying call stack trace for plugin "n1g-tf2-stats.smx":
L 12/01/2009 - 14:18:34: [SM] [0] Line 2797, G:\Users\Raphael\Desktop\Neuer Ordner (4)\TF2-Stats-V5.0\plugin\tf\addons\sourcemod\scripting\n1g-tf2-stats.sp::createdbtables()
L 12/01/2009 - 14:18:34: [SM] [1] Line 179, G:\Users\Raphael\Desktop\Neuer Ordner (4)\TF2-Stats-V5.0\plugin\tf\addons\sourcemod\scripting\n1g-tf2-stats.sp::OnPluginStart()

MjrNuT 12-01-2009 18:25

Re: TF2 Stats With Web Ranking and Item Logger
 
Ghost and DarthNinja,

Going to try and help here after I've read what is going on. I may have some redundant steps, but I hope it is just step-by-step for you to follow.

Main thing is whether Hostmonster allows outside conncections to the mysql. afaik, the gameserver is wide open b/c anyone can join it to play. :D

So here goes...

Let me see if I can lend some assistance here.


You are hosted on hostmonster.com, so assuming they allow an IP to access your mysql, these would be your basic steps from Cpanel


1. Create a new mysql database -- ghoststats

2. Create a user for the database -- username: ghostuser password: pass

3. Add ghostuser access to ghoststats database, grant ALL privs

4. Click on phpmyadmin to confirm the mysql exists

5. Click on Remote Mysql icon from Cpanel -- enter the IP address of your game server. You might have to enter "%"


Website setup, using your link = .../tfstats/

1. You would have uploaded the all the contents of the zip file (TF2 Ranking Web Interface v6.5.1.zip) to /tfstats/ folder.

2. Only file to edit is /tf2stats/inc/setting.php

Using the same info I provided above

Code:

$mysql_server = "localhost";
$mysql_user = "ghostuser";
$mysql_password = "pass";
$mysql_database = "ghoststats";

Note, you might be using Localhost, but check and see when you go to phpmyadmin. Or the server name will be the same one that you use for your website.


On the gameserver, assuming you have SM installed correctly and working:

1. All you need is the *.smx file be placed in
Code:

..addons/sourcemod/plugins/n1g-tf2-stats.smx
2. All you need is the .cfg file be placed in

Code:

..tf/cfg/tf2-stats.cfg
You can edit that file later


Editing the databases.cfg file located in

Code:

/addons/sourcemod/configs/databases.cfg
per DarthNinja, but I'm using again my example inputs

Code:

"tf2stats"
{
"driver" "mysql"
"host" "123.456.789" -your webserver's ip
"database" "ghoststats" -your db name
"user" "ghostuser" -your username
"pass" "pass" -above user's password
//"timeout" "0" -ignore
"port" "3306" -also ignore
}

It might be possible that you have a different port number. Again, if your website is on hostmonster, then check the configs for that regarding the mysql as I would suspect you'd be using the same host and port number settings for the stats.


Log files are located

Code:

addons/sourcemod/logs
YOu want to look for error_*.log files and others. I'd suggest you look there now with FTP and delete any existing.

Then do a full stop on the game server, then a Start. Sometimes a restart doesn't trigger things.

DarthNinja 12-01-2009 19:09

Re: TF2 Stats With Web Ranking and Item Logger
 
Remember that when unblocking the game server's IP, the IP you need to unblock may not be the same as the one you connect to.
eg:
My server IP is 216.6.235.204
However the IP I have to unblock is 216.6.235.2

If you have that problem, the db server should return "access denied for IP blah blah blah".
The 'denied' IP is the one you need to unblock.

Right now your problem is that the game server cant connect to the web server, reading the setup instructions again, or what MjrNuT posted above would be a good place to start.

SCE_Ghost 12-01-2009 22:26

Re: TF2 Stats With Web Ranking and Item Logger
 
well all my settings match watch should be correct.

Quote:

5. Click on Remote Mysql icon from Cpanel -- enter the IP address of your game server. You might have to enter "%"
This I tried and tried I cannot add a % =wildcard i.e. 8.23.237.% but it says invalid format:(

So this leaves me with 2 issues.

1. my remote sql connect thru cpanel(hostmonster) isnt unlocking the ip for gameservers. Im wondering since gameservers assigns a :port# if that will mess with things since the remote sql can only add an ip address without port

2. the smx isnt loading as a plugin, I assume it would be called n1g-stats something on my running plugin list, the only other reason I can think of is due to not being able to connect to the db before loading.

* I was reading with hostmonster and other hosting companies they are on a shared ip address, it still should be considered static but another thought..

Thanks for all the help so far:)

DarthNinja 12-01-2009 22:38

Re: TF2 Stats With Web Ranking and Item Logger
 
If the plugin is loaded it will show up using "sm plugins list" as ""TF2 Stats" (5.0) by R-Hehl".
If it is not loaded, you should see a startup error at the bottom of the list, and hopefully a reason for the error, such as 'access denied'.

You can try using * as a wildcard also, but the plugin should tell you the response from the mysql server which would have the IP the game server is using.

If you still can't get it unblocked I would recommend talking with your hosting company's tech support...

SCE_Ghost 12-01-2009 22:39

Re: TF2 Stats With Web Ranking and Item Logger
 
OK for furture questions remote sql to get the % must be added as a sub c so i.e. 8.23.237.0/24 will give you 8.23.237.% which will cover the ip range.

SCE_Ghost 12-01-2009 22:51

Re: TF2 Stats With Web Ranking and Item Logger
 
Well that fixed it 99% I would recommend for the adding that to the instructions if your web interface is hosted elsewhere.
MrjNut that was a great write up!!

Here is the last problem:
Warning: Cannot modify header information - headers already sent by (output started at /home1/shadowc1/public_html/tf/tf2stats/inc/footer.inc.php:7) in /home1/shadowc1/public_html/tf/tf2stats/index.php on line 9

DarthNinja 12-01-2009 23:10

Re: TF2 Stats With Web Ranking and Item Logger
 
1 Attachment(s)
Quote:

Originally Posted by SCE_Ghost (Post 1004650)
Here is the last problem:
Warning: Cannot modify header information - headers already sent by (output started at /home1/shadowc1/public_html/tf/tf2stats/inc/footer.inc.php:7) in /home1/shadowc1/public_html/tf/tf2stats/index.php on line 9

Thats odd, try this and see if the error is gone:


All times are GMT -4. The time now is 07:22.

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