Player Info Database
Saves certain information of each player that joins your server in a SQL database.
- Name
- Steam ID
- IP Address
- Country Code
- First join
- Last seen
- Number of connections
- Time played
Only tested in Counter-Strike: Global Offensive servers with a MySQL server.
Installation
- Create a MySQL database.
- Add the database information in "playerinfo" into your configuration file (addons/sourcemod/configs/databases.cfg).
- Upload playerinfo.smx into your server.
- Load the plugin or restart the server.
Query Examples
- Get the number of unique Steam ID's
Code:
SELECT COUNT(DISTINCT steamid) FROM data;
- Get the number of unique IP addresses
Code:
SELECT COUNT(DISTINCT address) FROM data;
- Get the players that have joined in the last hour
Code:
SELECT * FROM data WHERE last_seen > NOW() - INTERVAL 1 HOUR;
- Get the player who first joined the server
Code:
SELECT * FROM data ORDER BY first_join ASC LIMIT 1;
- Get the latest player who left the server
Code:
SELECT * FROM data ORDER BY last_seen DESC LIMIT 1;
- Get the player who has connected the most times
Code:
SELECT * FROM data ORDER BY connections DESC LIMIT 1;
- Get the number of players per each country
Code:
SELECT COUNT(DISTINCT steamid), country FROM data GROUP BY country ORDER BY COUNT(DISTINCT steamid) DESC;
- Get the player who has been on the server the longest
Code:
SELECT * FROM data ORDER BY time DESC LIMIT 1;
Links
GitHub
Steam
Discord: akz#1553