SQLStats

SQLStats 1.0.7

Required Dependencies
MySQL server (version: 5.7.x) (accessible from wherever RustDedicated is hosted)
Optional Dependencies
https://www.chaoscode.io/resources/sqlstatistics.116/
https://www.chaoscode.io/resources/sqlranks.115/
To have less fustration setting up MySQL, please use MySQL version no higher than `5.7.x` (can use `5.7.41` for example.)
If for some reason you are using MySQL 8 and above, using Legacy Authentication Method (
manual here). This limitation comes from Oxide, not from the plugin itself.

Data plugin records is:
  1. Players who connects/disconnects to the server and their last ip and how much time they have spent on a server (this wipe and overall)
  2. Animals players has killed (Animal name, date and time of kill, distance and weapon used to kill).
  3. [1] Items players has crafted (Item name, date, amount of crafted items)
  4. Players deaths (Cause, date and time, position x, y and grid location)
  5. Players destroyed buildings (Building name, date and time, building tier, weapon used, grid location)
  6. Players destroyed containers (Container name, date and time, weapon used, position x, y and grid location)
  7. Players destroyed doors/gates/fences (Building name, date and time, weapon, x, y and grid location)
  8. [1] Players bullets shot (Bullet name, weapon used, date, count)
  9. [1] Players resources gathered (Resource name, count, date)
  10. [1] Players kill (Killer, victim, link to combat log, weapon used, last bodypart hit, date and time, distance and points[2])
  11. [3] Combat log (same data as provided in console when you type combatlog) from both perspectives (killer and victim)
  12. [1] Players placed buildings (Building name, date, count)
  13. [1] Players placed deployables (Deployable name, date, count)
[1] - Aggregated per day
[2] - Points are calculated depending on victim's gear, the more geared he is, more points are given for a kill, perfect solution for leaderboards without causing killing on sights to be number one in leaderboard.
[3] - Combat log generates lots of data on PvP intense servers, so enable with caution
ALL DATA EXCEPT PLAYER STATS (1.) IS WIPED ON MAP CHANGE, THIS CAN BE EASILY CHANGED IN A FUTURE, IF SOMEONE WOULD LIKE TO HAVE SUCH FEATURE.

Default config:
Code:
{
  "Config": {
    "SaveCombatLog": "0",
    "WipeStatsOnMapChange": "1",
    "PreservePlayersTable": "1",
  },
  "MySQL": {
    "Database": "rust",
    "Host": "127.0.0.1",
    "Password": "password",
    "Port": 3306,
    "Username": "username"
  }
}
* - SaveCombatLog might be resource intense, but having it enabled will save every combat log to database on PvP Kill so you could find hackers easier!

The following script will drop database named rust if it exists and then creates it from scratch with all required empty tables:
Code:
-- --------------------------------------------------------
-- Server version:               5.7.16-log - MySQL Community Server (GPL)
-- Server OS:                    Win64
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;


-- Dumping database structure for rust
DROP DATABASE IF EXISTS `rust`;
CREATE DATABASE IF NOT EXISTS `rust` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
USE `rust`;

-- Dumping structure for table rust.stats_player
DROP TABLE IF EXISTS `stats_player`;
CREATE TABLE IF NOT EXISTS `stats_player` (
  `id` bigint(20) NOT NULL,
  `name` text NOT NULL,
  `online_seconds` bigint(20) DEFAULT '0',
  `ip` varchar(50) NOT NULL,
  `online` bit(1) NOT NULL DEFAULT b'0',
  `lastconnection` datetime DEFAULT CURRENT_TIMESTAMP,
  `online_seconds_lastwipe` bigint(20) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_animal_kill
DROP TABLE IF EXISTS `stats_player_animal_kill`;
CREATE TABLE IF NOT EXISTS `stats_player_animal_kill` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `animal` varchar(32) NOT NULL,
  `date` datetime NOT NULL,
  `distance` int(11) DEFAULT NULL,
  `weapon` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_craft_item
DROP TABLE IF EXISTS `stats_player_craft_item`;
CREATE TABLE IF NOT EXISTS `stats_player_craft_item` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `item` varchar(32) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerItemDate` (`player`,`item`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_death
DROP TABLE IF EXISTS `stats_player_death`;
CREATE TABLE IF NOT EXISTS `stats_player_death` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `cause` varchar(32) NOT NULL,
  `date` datetime NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  `x` int(11) DEFAULT NULL,
  `z` int(11) DEFAULT NULL,
  `grid` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerCauseDate` (`player`,`cause`,`date`,`x`,`z`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_destroy_building
DROP TABLE IF EXISTS `stats_player_destroy_building`;
CREATE TABLE IF NOT EXISTS `stats_player_destroy_building` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `owner` bigint(20) DEFAULT NULL,
  `building` varchar(128) NOT NULL,
  `date` datetime NOT NULL,
  `tier` varchar(20) DEFAULT NULL,
  `weapon` varchar(128) DEFAULT NULL,
  `grid` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_destroy_container
DROP TABLE IF EXISTS `stats_player_destroy_container`;
CREATE TABLE IF NOT EXISTS `stats_player_destroy_container` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `owner` bigint(20) DEFAULT NULL,
  `title` varchar(128) NOT NULL,
  `date` datetime NOT NULL,
  `weapon` varchar(128) DEFAULT NULL,
  `x` int(11) DEFAULT NULL,
  `z` int(11) DEFAULT NULL,
  `grid` varchar(5) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_fire_bullet
DROP TABLE IF EXISTS `stats_player_fire_bullet`;
CREATE TABLE IF NOT EXISTS `stats_player_fire_bullet` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `bullet` varchar(32) NOT NULL,
  `weapon` varchar(128) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerBulletWeaponDate` (`player`,`bullet`,`weapon`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_gather_resource
DROP TABLE IF EXISTS `stats_player_gather_resource`;
CREATE TABLE IF NOT EXISTS `stats_player_gather_resource` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `resource` varchar(32) NOT NULL,
  `count` bigint(20) NOT NULL,
  `date` date NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerResourceCountDate` (`player`,`resource`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_kill
DROP TABLE IF EXISTS `stats_player_kill`;
CREATE TABLE IF NOT EXISTS `stats_player_kill` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `killid` char(36) NOT NULL DEFAULT '0',
  `killer` bigint(20) NOT NULL,
  `victim` bigint(20) NOT NULL,
  `weapon` varchar(128) NOT NULL,
  `bodypart` varchar(2000) NOT NULL DEFAULT '',
  `date` datetime NOT NULL,
  `distance` int(11) DEFAULT NULL,
  `points` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_kill_combatlog
DROP TABLE IF EXISTS `stats_player_kill_combatlog`;
CREATE TABLE IF NOT EXISTS `stats_player_kill_combatlog` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `killid` char(36) NOT NULL DEFAULT '0',
  `time` char(64) NOT NULL DEFAULT '0',
  `attacker` char(128) NOT NULL DEFAULT '0',
  `attacker_id` int(11) NOT NULL DEFAULT '0',
  `target` char(128) NOT NULL DEFAULT '0',
  `target_id` int(11) NOT NULL DEFAULT '0',
  `weapon` char(128) NOT NULL DEFAULT '0',
  `ammo` char(128) NOT NULL DEFAULT '0',
  `area` char(64) NOT NULL DEFAULT '0',
  `distance` char(32) NOT NULL DEFAULT '0',
  `old_hp` decimal(10,2) NOT NULL DEFAULT '0.00',
  `new_hp` decimal(10,2) NOT NULL DEFAULT '0.00',
  `info` char(128) NOT NULL DEFAULT '0',
  `dataFrom` char(32) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_place_building
DROP TABLE IF EXISTS `stats_player_place_building`;
CREATE TABLE IF NOT EXISTS `stats_player_place_building` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `building` varchar(128) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerBuildingDate` (`player`,`building`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_place_deployable
DROP TABLE IF EXISTS `stats_player_place_deployable`;
CREATE TABLE IF NOT EXISTS `stats_player_place_deployable` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `player` bigint(20) NOT NULL,
  `deployable` varchar(128) NOT NULL,
  `date` date NOT NULL,
  `count` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `PlayerDeployableDate` (`player`,`deployable`,`date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
-- Dumping structure for table rust.stats_player_destroy_door
DROP TABLE IF EXISTS `stats_player_destroy_door`;
CREATE TABLE IF NOT EXISTS `stats_player_destroy_door` (
   `id` bigint(20) NOT NULL AUTO_INCREMENT,
   `player` bigint(20) NOT NULL,
   `owner` bigint(20) DEFAULT NULL,
   `title` varchar(128) NOT NULL,
   `date` datetime NOT NULL,
   `weapon` varchar(128) DEFAULT NULL,
   `x` int(11) DEFAULT NULL,
   `z` int(11) DEFAULT NULL,
   `grid` varchar(5) DEFAULT NULL,
   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Data exporting was unselected.
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

Information

Author
Visagalis
First release
Last update
Rating
5.00 star(s) 11 ratings

Latest Release v1.0.7

Released
Apr 8, 2024 at 11:28 PM
Rating
0.00 star(s) 0 ratings


More resources from Visagalis

  • ProximitySystem
    ProximitySystem
    Announce to Discord/Slack if more than X players are teaming up!
  • SQLRanks
    SQLRanks
    Leaderboards for SQLStats (PvE, PvE, Gather, Clans leaderboards and more!)
  • ProxyCheck
    ProxyCheck
    Kicks or warns on slack about player using VPN/Proxy.
  • DiscordWin
    DiscordWin
    Rewards players with ServerRewards or Economics for being in your discord server.
  • SQLStatistics
    SQLStatistics
    Announces various interesting stats collected with SQLStats.

SQLStats by Visagalis
© chaoscode.io May 10, 2018

Latest reviews

Works as expected!
Great plugin.

Another example: https://rustralis.com/stats/

... I only wish it had NPC kills!
I mean, the plugin does EXACTLY what it says it does and does it extremely well and without lag as far as I can see after weeks of having my servers up. The developer replies very fast as far as I can see as far as helping you fix a problem/issue. The other plugins he/she has are a must (SQLRanks) at least. I like the idea of the other one, just don't want too much stuff in chat but that's just me. Seriously awesome plugin and I am looking into doing what these others are with the online stats pages. It's an extremely versatile plugin and can do alot, although it's a little scary to set up at first, don't worry. Just remember to hit the REFRESH button on the page after running the script he gives you in the overview, as I thought they were errors being thrown and not actually being created in MySQL. Much love for the plugin and hope to see the option to wipe Player Stats on player map change!
Fantastic plugin made by a helpful developer!
Very Nice for any serious Rust Community. Here is one of our stat pages for one server: http://anonymouscity-stats.com
Great plugin. Have made the following site from this :)
https://ausveda.com/stats/
Amazing developer! Using the plugin for
https://fury.gg/highscores-trio
Absolutely amazing plugin! This plugin will take sometime to setup depending on your skills but it is defiantly worth it and is a must for a PVP server. It is great for finding hackers and players love being able to check their stats!

Here is another example of what can be done with this plugin.
https://urusty.com/stats.html
This plugin definitely takes some time to get to work. More than worth it however. If you have knowledge of datatables, mysql and php you'll be able to get there. I've been able to weed out hackers just by looking at the info as well! Players are reassured and like being able to look at the stats.
Great plugin, perfect for creating an external web page containing player statistics.

Also extremely useful for admins to checkup on player hit, kill and damage history. Opens up the doors to many developments to improve a lot of backend features.

A page I have made with this plugin: https://rustoria.co/leaderboards