Just an update: I no longer run servers, therefore I do not have an environment to continue updating my plugins. If you would like to take over development of one of my plugins, feel free to do so.
Bug fix: 3.4.1 has been released. Updated plugin to handle longer Steam IDs. You may wish to reset your database; anyone who had a longer Steam ID will end up being stored as a new entry in the DB.
This plugin should be compiled using SM 1.7 as well.
What does this plugin do?
It handles tracking of player scores and ranks in a lightweight easy to configure manner.
Who is it for?
People who want a straight up ranking system that handles scores and people who want a system that works out of the box.
What does it record?
It stores the most up to date player name, steam id, score, last seen time, kills, deaths, headshots, backstabs, feigned deaths, points captured, points defended, flags captured, flags defended, dominations given, dominations received and boss kills. Calculates the kill/death ratio.
How does scoring work?
Spoiler
Player-kills reward 1.00 points.
Bot-kills reward 0.80 points.
Assist-kills work via a multiplier. 0.75 rewards 75% of whatever score the killer gets.
Headshots, backstabs and deflections work via a multiplier of 1.33, which means 33% more reward.
Teleporting a player rewards 0.10 points.
Capturing a point rewards 2.00 points.
Capturing a flag rewards 2.50 points
Defending a point rewards 1.25 points.
Capturing a flag rewards 2.50 points
Staying for the whole round rewards 2.00 points. Building destruction rewards scale at 33%, 66% and 100% depending on building level.
Sentry-destructions reward 3.00 points. At level 3.
Dispenser-destructions reward 0.80 points. At level 3.
Teleporter-destructions reward 1.20 points. At level 3.
Admin-kills reward 1.33 points.
Key Features
Spoiler
Round bonuses - All players on the server will receive a message saying that they are eligible to receive the round bonus if they stay the entire round. They'll receive it at the end. This event also fires at the end and notifies all late clients (before the gates open) of the round bonus, telling them that they were almost late.
Cleaner system - Players that join the server and leave will not leave a record behind in the database tracking their 0.00 point score. You can set the point-threshold to only track players that intend to play on the server. Automatically purges old clients, no third party software needed. On a multi-server setup, only one server should run the cleanup on an interval.
Logical saving - Saving is done when a player disconnects from the server, or when the top ten menu updates, this interval can be modified via a single CVAR.
Bot handling - Bots are tracked by the ranking system, but are never saved. You can still view their point amount while they are in the game and their names will be prefixed with (Bot) in the ranking menu. The Replay bot will never show up in the ranking menu.
Message handling - Join, team and player leave messages can be handled by this plugin giving the server a much more user-friendly appearance. Bot messages can be completely suppressed.
Accurate Scoring - Player thresholds can be set to disable scoring for servers with few players as a preventative measure for point farming. A minimum point requirement for round bonus can be set to avoid idling for points.
Simple Installation - Works out of the box with no setup needed for SQLite. Uses MySQL only if a MySQL connection is specified in databases.cfg. Plugin requires absolutely no additional setup for the web interface. Web interface is also easy to install.
Automatic Updates - This plugin will keep itself up to date if the Updaterplugin is loaded, completely optional with no extra configuration required.
In-game Search - Search any player by typing !rank <name> or !rank <steam id>.
Chat commands:
Spoiler
!rank or !ranks - Shows a menu with a list of current players and a top ten submenu, if you select a player it will tell you their ranking number, round point amount, and total point count. !rank <name> or <steam id>
!rankme - Displays your current standing vs other players on the server.
!top - Displays only the top twenty-five players on the server.
Commands:
Spoiler
pr_reward - Rewards the selected target or targets the specified amount of points. BAN flag pr_revoke - Does the opposite of the above command.BAN flag pr_dumpinfo - Shows all connected client info, this is a debug command that you shouldn't need.BAN flag pr_forcesave - Saves all connected client scores, this is a debug command that you shouldn't need.BAN flag pr_forcecleanup - Forces the plugin to clean old records from the system.BAN flag
CVARS:
Spoiler
pr_allowBotStats - If 1, bots are counted in kills, deaths, assists, backstabs, headshots, and feigns. Default: 1 pr_cleanupinterval - Amount of minutes before the expiration cleaner runs a cleanup on the server. Default: 60 pr_cleanupmode - 0: Disables cleanup. 1: Run cleanup only on map start. 2: Run cleanup on an interval and on every map start. Default: 1 pr_enhancedmessages - If 1, when a player joins, leaves, or switches teams, this plugin will display better messages. Default: 1(REMOVED as of 3.1) pr_expiretime - Amount of unplayed days before a user record is removed from the ranking system. Default: 130 pr_hidebotmsg - If 1, bot messages are completely suppressed. Default: 1 pr_playerminimum - Amount of players required to be online for ranking to enable. Default: 0 pr_rankingversion - Displays the current version number, this variable is read-only. pr_rewardassist - Point reward multiplier for assisting a bot/player kill. At 0.75, this would give 75% of the reward to the assister. Default: 0.75 pr_rewardbackstab - Point reward multiplier for backstabbing a bot/player. Default: 1.33 pr_rewardbot - Point reward for killing a bot. Default: 0.8 pr_rewardcap - Point reward for capturing a point. Default: 4 pr_rewarddispenser - Point reward for destroying a dispenser. Default: 0.8 pr_rewardheadshot - Point reward multiplier for killing a bot/player via a headshot. Default: 1.33 pr_rewardlevel1mult - Point reward multiplier for destroying a level 1 building. Default: 0.33 pr_rewardlevel2mult - Point reward multiplier for destroying a level 2 building. Default: 0.66 pr_rewardlevel3mult - Point reward multiplier for destroying a level 3 building. Default: 1.00 pr_rewardminisentry - Point reward for destroying a mini sentry. Default: 0.60 pr_rewardplayertele - Point reward for teleporting a player. Default: 0.1 pr_rewardplayer - Point reward for killing a player. Default: 1 pr_rewardrbmin - Point reward requirement for player to receive round bonus. Default: 5.00 pr_rewardroundbonus - Point reward for being in the game for an entire round. Default: 10 pr_rewardsentry - Point reward for destroying a sentry. Default: 3 pr_rewardteleporter - Point reward for destroying a teleporter. Default: 1.2 pr_showcmds - If 1, when a player types a chat command such as !rank, it will be shown in chat. Default: 1 pr_suppressrankmsg - If 1, this plugin will not display any rank on player connect. Default: 0 pr_threshold - Amount of points required to be saved to the ranking system. Default: 10 pr_updateinterval - Amount of time (in seconds) to autosave and update the top ten menu. Default: 30
Added to 2.0
pr_announcemode - 0: No location announced. 1: 2 letter abbreviation, 2: 3 letter abbreviation. 3: Full country name. Default: 3 (REMOVED as of 3.1) pr_autoupdate - If set to 1, this plugin will check for and update itself. Default: 1 pr_menudisablerank - If 1, !rank command will cease to function. Default: 0 pr_menufilterbots - If 1, bots will be hidden from the menu. Default: 0 pr_rewardadminflag - Flag that the plugin will use to give admin rewards. Default: b pr_rewardadmin - Point reward for killing an admin. Default: 1.33 pr_rewardbossdmgmin - Amount of damage required for a player to receive the boss reward. Default: 250 pr_rewardflagCap - Amount of points a player should receive for capturing a flag. Default: 2.0 pr_rewardflagDefend - Amount of points a player should receive for defending a flag capture. Default: 1.25 pr_rewardhhhkill - Base point amount for killing Horseless Headless Horsemann. Default: 5.00 pr_rewardmerasmuskill - Base point amount for killing Merasmus. Default: 5.00 pr_rewardmerasmusmult - Base point amount per level for killing Merasmus. Default: 0.04 pr_rewardmonoculuskill - Base point amount for killing Monoculus. Default: 5.00 pr_rewardmonoculusmult - Base point amount per level for killing the eye boss. Default: 0.04 pr_rewardmultbase - The level scale multiplier for killing a boss. Default: 0.09
Added to 3.0
pr_notifications - Notifies the user when they receive points, 0 = No notifications, 3 = Maximum. Values 0-3 are accepted. 1 = Objectives, 2 = Objectives & Kills, 3 = Objectives, Kills & Teleports. Default: 3 pr_rewardadmin - Point reward for killing an admin. Default: 1.33 | Default Flag: ROOT (z). You can override this by adding "pr_killadminreward" to your overrides file. pr_rewardflagCap - Amount of points a player should receive for capturing a point. Default: 2.0 pr_rewardflagDefend - Amount of points a player should receive for defending a point capture. Default: 1.25 pr_useHUD - If 1, the score text will be drawn when a client earns points. Default: 1 pr_useHUDDeath - If 1, the HUD will be shown when a player dies. Default: 1 pr_maxSearchResults - Limits how many search results can be displayed with !rank, set to 0 to disable searching. Default: 25
Added to 3.1
pr_resetMode - Automatic resetting CVAR, 0 = Disabled (No resetting), 1 = Monthly reset, 2 = Yearly reset. Default: 1.33 pr_rewarddeflect - Point reward multiplier for killing a player/bot via a deflected projectile. Default: 1.33 pr_rewarddefendcooldown - Cooldown (in seconds) before player can get another defend counted on his record; this is to stop capture point defense spamming. Default: 15 pr_pointLossMode - If 0, plugin behaves normally. If 1, 1 point is lost on death. If 2, equal points given to the killer are stolen from the victim. Default: 0
Removed as of 3.1
pr_enhancedmessages - Removed all enhanced messages (join/team/leave). I felt that I was bundling something unrelated to the plugin itself. If requested I can release a separate plugin that does all of this. pr_announcemode - Same reason as above.
Added to 3.2 pr_rewardkillstreak - Point reward bonus for each killstreak the player has. Default: 0.1 pr_rewardkillstreakmax - Point reward maximum that the killstreak bonus is allowed to offer. Default: 1.5
Plugin Version Info:
Spoiler
Version 1.0 - Initial Release
Version 1.1 - Fixed an extremely rare bug where the client's score would fail to save (the plugin would unload itself)
Player rank number is now updated correctly with top ten and autosave timer.
Version 1.2 - Automatic tag added.
Created a version number CVAR that reflects the internal defined version number.
Version 1.3 - Removed sm_rankingenabled CVAR.
Removed a small redundant check where the say command was grabbing the second word, which I originally intended to use.
Added a new chat command "!topten".
Added a CVAR to suppress chat if said chat is a ranking command for this plugin.
Added headshot and backstab detections and multipliers. Disabled if game isn't TF2.
Changed the command access flags to something more sensible, BAN flags required. Sourcemod has built-in functionality to override command requirements if needed.
Version 1.3.1 - Threaded the score saving queries, strings are now escaped.
Version 1.4 - This plugin is now level aware of buildings, and detects mini-sentries.
Fixed typo that resulted in headshots and backstabs not being detected at all.
Version 1.5 - Now supports MySQL! Multi-server friendly.
Added a maintenance system that purges old records from the database. No need for CRON. (Optional CVAR)
Can now override the game's default join message with our own. (Optional CVAR)
Will create its own config file in your sourcemod directory for easier setup.
Join, team, and leave messages have been very much improved. (Optional CVAR)
Bot messages can be completely suppressed for a very non-spammy server. (Optional CVAR)
Version 1.6.1 - OnPlayerDisconnect now gets steam id and and name from the event rather than asking SourceMod to pull it from a table.
OnPlayerTeam now checks if the client id is 0.
Player disconnect messages aren't sent to the server console any more, they are now sent to everyone's chat. This was an unintended debug change, fixed.
Version 1.6.2 - OnPlayerDisconnect checks if client id is 0.
Version 1.7 - Now tracks kills, deaths, backstabs, headshots, feigned deaths.
Tracks kill-death ratio.
Top 10 is now the top 25.
Choosing a player in the top 25 now shows details about said member, even if they're offline.
Database now uses a version system, existing databases will autoupdate!! No need to change anything in your existing database.
Version 1.7.1 - Multiple stability checks added.
Added a small check to prevent clients from seeing a rank of #0 on themselves instead of the prettier word "unranked".
The welcome message " has joined the game and is ranked .. out of .." is now optional. Cvar: pr_suppressRankMsg
Added system to combat players lingering in spectate mode. Cvar: pr_rewardrbmin
Version 1.7.2 - Friendlier to other plugins trying to access the same events, plugin no longer returns Plugin_Handled to block only the broadcasted message.
The total player count for ranking is now accurate and is updated regularly with the top player interval.
CVARs now have a min/max value set to better convey the type of value they should receive.
Version 1.7.3 - Menu client checks are fixed, if you have 1.7.2 update as soon as possible.
Version 1.8 - Revamped saving system, some people had duplicate records in their database, this can no longer happen with 1.8. Bug eliminated.
Any existing duplicates will be cleaned, no action necessary just load the plugin and it will update your existing database.
Version 1.8.1 - Changed the system to UTF-8 to better support multiple languages, accents and non-ascii characters.
Improved update messages, and less "debuggy" information printed to console.
Version 1.8.2 - Detects SQL driver, SQLite uses UTF-8 by default.
Fixed the previous error that broke SQLite support in 1.8.1.
Version 1.9 - Auto-update fully implemented using the wonderful Updater by GoD-Tony.
Bots can optionally be blocked from counting towards a player's kill, death, headshot, backstab, and feign death stats (bots are very stupid).Cvar: pr_allowBotStats
Blocks kill, death, headshot, backstab and feign ranking unless there aren't enough players on the server as defined by pr_playerminimum. This was allowed to increment previously, which was unintended.
Version 1.9.1 - Fixed the round bonus logic, previously causing clients that didn't earn enough points to actually get the round bonus, and all clients who did get enough points did not get the round bonus.
Version 2.0 - Join messages now show country via SourceMod's GeoIP.
Bots can be filtered completely from the ranking menu rather than being shown with (Bot) in their name.
The !rank command can now be disabled, leaving only !top and !rankme.
Admin kills now give a point bonus.
Yet more stability checks have been added!
Autoupdate can be forced off.
!rankme now appears before the rank info was sent, this change was purely aesthetic.
Database will do a cleanup on any databases with any invalid entries when you first run it. The database is updating to version 4 to support new tracking features.
Sends a notify when an update is downloading and completed. Reloads when the update is done.
Translation system implemented! All non-debug strings have both an English and French translation. Thanks to Krispx (Steam)
The gamemode rewards for CTF have been implemented.
Boss rewards implemented. Players are notified with how many points they will get when a boss spawns.
Merasmus, Monoculus, and Headless Horsemann kill counts are tracked, as well as highest level killed. Point rewards are scaled by difficulty level via your CVARs.
Total hours played is now counted in your records.
Reloading now prints "[Player Ranks] Reloaded successfully!" rather than showing all the clients that have connected.
Fixed memory leak.
Version 2.0.1 - Top player menu appropriately checks/returns for client id 0.
Version 2.0.2 - Fixed the round bonus improperly rewarding the people who didn't earn it.
Version 2.0.3 - Colorized the rankme messages. Should've been done already.
Added natives to make the plugin more flexible.
Version 3.0 - Ranks are now searchable via !rank <name>
Current round points are now drawn in the HUD.
Capture point defends and captures are now tracked.
Dominations received and times dominated are now tracked.
New notifications! Users receive messages when they gain points.
Admin kills can give bonus points!
Menus no longer automatically close.
Version 3.0.1 - Small optimization on map start.
Fixed a very rare but possible memory leak.
Version 3.1.1 - Added deflection bonuses and tracking.
Point rounding issue relating to rank 0 message fixed.
Full support added for the !rank <name> search command for SQLite users.
Highest kill streak is now tracked.
Automatic monthly and yearly resets options have been added. By default this option is DISABLED, no unexpected resets will be done.
Exemption command added; with this, your score will not be effected while you're playing and anyone who kills you will also not receive any credit from you.
Enhanced messages (join/disconnect/team) messages have been removed from this plugin. This change was because I felt like I was bundling something unrelated with a ranking plugin. This functionality belongs in a separate plugin; if you miss the enhanced messages I will upload a new separate plugin which does just that.
Point loss mode added for people who do not like seeing large score numbers.
Version 3.1.2 - Corrected player counting code.
Fixed an extremely rare occurrence where a client could lose their rank due to their steam ID not being loaded before save.
Version 3.1.3 - Version is cross-compatible with Steam2 and Steam3 systems.
Version 3.1.4 - Removed debug message logged each time a client connects.
Version 3.2 - Added killstreak bonus rewards. New CVARS: pr_rewardkillstreak and pr_rewardkillstreakmax.
Messages are now disabled if point reward for said action is 0.
Fixed pr_allowBotStats CVAR. Previously had the minimum value to set to 1.0 instead of 0.0.
Version 3.3 - Reset code correction that was causing resets to not take place or causing new installations to loop.
Player Ranks now honors pr_rewardadmin, if set to 0, admin kill will not be announced.
Fixed broken autoupdate URL (thanks to the subdomain hoster for breaking it).
Version 3.4 - Removed about four unneeded lines in the phrases file.
Fixed a rare bug where assist kills would sometimes display the wrong language response (would use the attacker's language instead).
Compiled for SourceMod 1.7.3.
Version 3.4.1 - Updated plugin to handle longer Steam IDs. You may wish to reset your database; anyone who had a longer Steam ID will end up being stored as a new entry in the DB.
Webpage Version Info:
Spoiler
Make sure your Player Ranks version is 2.0+ before running web stats!
11/2/2013 - Initial update.
11/4/2013 -Kill and death columns have been swapped around.
Added a rank column, player's rank is displayed in the rank column.
Player names are now clickable and when clicked it will send the viewer to said player's Steam profile.
List items in the table have been checkered to make the list more readable.
11/15/2013 - Supports version 2.0 of PR.
Clickable names in the main rank page go to a subpage with details. This page doesn't look pretty but it sure beats SQL errors.
11/16/2013 - Added avatar and steam status in the showstats.php file.
Version 2.0 - Added UTF-8 as the charset in the <head> tag of stats.php, names should now be displayed correctly.
Wrote version number for website in both PHP files, as well as a link to get back here for easier updating.
Version 3.0 - Web interface has received an UI overhaul.
Support for Player Ranks updated so that it can read 3.0.
Version 3.1 - Updated to support Player Ranks 3.1.
Version 3.1.1 - Added support for legacy Steam2 and the new Steam3 system.
Installation Instructions:
Spoiler
Download playerranks.smx, and playerranks.phrases.txt below. Do not download playerranks.sp unless you are a developer or you want to compile the plugin yourself.
Move playerranks.smx to your sourcemod/pluginsfolder.
Move playerranks.phrases.txt to your sourcemod/translationsfolder.
If your server is not running, start the server and the plugin will be loaded.
If your server is already running you can load the plugin by running the command: smpluginsloadplayerranks
Developers: This plugin requires More Colors and Updaterin order to compile successfully.
Additional instructions for MySQL users ONLY:
5. Go to your sourcemod\configs\database.cfg file and add the following lines anywhere inside the "databases" key:
Quote:
"playerranks"
{
"driver" "mysql" // If you planned on using SQLite, then you don't need to do any of this step. Configuration not required for SQLite.
"host" "127.0.0.1" // Leave it as is if you're running on the same server as the game server, else put in your MySQL server's IP.
"database" "playerranks" // Your database name.
"user" "root" // Put in your username between the quotes.
"pass" "" // Put in your password between the quotes.
"port" "3306" // If your port differs, fill this in.
}
6. Run the MySQL query below to create the database and table:
Quote:
CREATE DATABASE IF NOT EXISTS playerranks;USE playerranks;CREATE TABLE IF NOT EXISTS `players` (`steamid` TEXT, `nickname` TEXT, `points` FLOAT DEFAULT 0.00, `seen` INTEGER DEFAULT 0);
Webpage Installation:
Quote:
Download pr_web.zip below.
Move everything in the zip file to your web root, open stats.php and showstats.php with notepad and change the SQL_* variables to your database information.
The files will work as they are, but I recommend you change ui.css and the two previously mentioned files to match the style of your site. The fonts and background image can be deleted as well. I didn't intend for anyone to keep these styles.
Register for a web api key here http://steamcommunity.com/dev/apikey , open showstats.php and fill in STEAM_WEBKEY with your web api key.
Extra notes:
Quote:
You may want to adjust pr_cleanupmode based on how you run your server(s).
If you run multiple servers you may want to set this to 0 on all but one server (unless you have installed CRON to your web-server/want to do it manually).
If you run on a vanilla server or use a map rotation set this to 1.
If you run a deathmatch, 24/7 map, or don't change maps very often, then you should set this to 2. If you don't understand what this CVAR does, refer to the CVAR list above. If you need further assistance feel free to post below or send me a PM.
Yeah, I was trying to get a WORKING rank plugin, but DarthNinja does not care about his plugin anymore and others are either not for tf2 or outdated/not working. I don't need big-ass plugin like hlx stats which is usually slow or you need special hosting for it. GameME is the same pretty much -_- I wont pay 5€/month for stupid simple rank system for 2 servers geez... Dont know why doesn't sourcemod have a simple rank system for tf2 -_-
Yeah, I was trying to get a WORKING rank plugin, but DarthNinja does not care about his plugin anymore and others are either not for tf2 or outdated/not working. I don't need big-ass plugin like hlx stats which is usually slow or you need special hosting for it. GameME is the same pretty much -_- I wont pay 5€/month for stupid simple rank system for 2 servers geez... Dont know why doesn't sourcemod have a simple rank system for tf2 -_-
Primarily the reason I developed this plugin. The plugin (you/I) mentioned in the comments worked fine for me besides being outdated and not having all the weapons. I guess it also tracked more than I wanted.. so I rolled my own.
L 10/13/2013 - 09:49:01: [SM] Native "PrintToChat" reported: Client 3 is not in game
L 10/13/2013 - 09:49:01: [SM] Displaying call stack trace for plugin "playerranks.smx":
L 10/13/2013 - 09:49:01: [SM] [0] Line 581, /home/groups/alliedmodders/forums/files/1/5/7/8/4/5/126734.attach::OnRoundStarted()
L 10/13/2013 - 09:49:01: [SM] Native "PrintToChat" reported: Client 3 is not in game
L 10/13/2013 - 09:49:01: [SM] Displaying call stack trace for plugin "playerranks.smx":
L 10/13/2013 - 09:49:01: [SM] [0] Line 581, /home/groups/alliedmodders/forums/files/1/5/7/8/4/5/126734.attach::OnRoundStarted()
Thanks for pointing it out. Just uploaded it (fixed). Please let me know how it goes.