View Single Post
Author Message
msleeper
Veteran Member
Join Date: May 2008
Location: Atlanta, Jawjuh
Old 10-01-2009 , 19:01   Very Basic Player Tracker (Updated 7/15/10)
Reply With Quote #1

Very Basic Player Tracker

This plugin is a simple player tracker that logs player information into a MySQL database. It uses the "default" database from your databases.cfg file for storage. It logs the player name, SteamID, player's IP address, server game type (using GetGameFolderName()) and server IP address, and the GeoIP country code for the player's location. It logs this information X seconds after being connected, which is controlled with a cvar. This is useful if you only want to keep track of players who are connected for a minimum amount of time, the default is 90 seconds. If a duplicate player is found, it updates their information

I am not providing any web interface at this time, though I may in the future. This is really just a base for anyone who may want to develop it further, or use it for a more specific purpose. For those of you in need of a web interface, I highly recommend using the Sourcemod Webadmin which has built in support for this plugin!

Feel free to use this code for any other plugins, however please give credit back to me.

Installation
Installation is incredibly easy, install the plugin in your /addons/sourcemod/plugins/ directory and refresh your plugin list, or change map.

Configuration
A config file will automatically be generated in /cfg/sourcemod/ when the plugin is first ran.

sm_tracker_addtime - Add/update players in the database after this many seconds
sm_tracker_geoiptype - Add player's GeoIP country to the database. 0 = Disabled, 1 = 2 letter Country Code, 2 = 3 letter Country Code, 3 = full Country Name.

Use this SQL to create your table.

PHP Code:
CREATE TABLE `player_tracker` (
  `
idint(11NOT NULL auto_increment,
  `
steamidvarchar(255NOT NULL,
  `
playernamevarchar(255NOT NULL,
  `
playeripvarchar(255NOT NULL,
  `
servertypevarchar(255NOT NULL,
  `
serveripvarchar(255NOT NULL,
  `
serverportvarchar(255NOT NULL,
  `
geoipcountryvarchar(255NOT NULL,
  `
statusvarchar(255NOT NULL,
  
PRIMARY KEY  (`id`),
  
UNIQUE KEY `steamid` (`steamid`),
  
KEY `playername` (`playername`),
  
KEY `playerip` (`playerip`),
  
KEY `servertype` (`servertype`),
  
KEY `serverip` (`serverip`),
  
KEY `status` (`status`)
); 
Attached Files
File Type: sp Get Plugin or Get Source (tracker.sp - 3611 views - 6.4 KB)
__________________

Last edited by msleeper; 07-15-2010 at 16:56. Reason: Updated to 1.5
msleeper is offline