About MyStatistics
MyStatistics – an advanced and modern statistics system for players, offering detailed tracking, leaderboards and wipe-based rewards.
Functions:
1. Advanced Player Statistics Tracking
- Player kills (PvP)
- Deaths (players / suicide)
- K/D ratio calculation
- Shots fired
- Accuracy tracking
- Playtime tracking
- Custom stat categories
- Automatic real-time stat updates
- Per-player detailed statistics view
Track everything that matters and give players a reason to compete.
2. Leaderboards
- Top players by any statistic
- Dynamic category-based ranking
- Automatic top calculation
- Configurable reward places (Top 1 / Top 3 / Top 5 etc.)
- Flexible category keys
3. Wipe Detection & Rewards
- Automatic wipe detection
- Auto-reset statistics (configurable)
- Reward distribution after wipe
- Top category awards
- Per-category reward settings
4. MySQL Integration
- Full MySQL support
- Safe data handling
- Optimized queries
- Persistent storage between restarts
Designed for serious projects using external databases.
5. User Interface
- Clean CUI interface
- Category navigation
- Player statistics panel
- Leaderboards display
- Time formatting support
- Configurable stat formatting
Player Commands:
- /stats - Opens the statistics menu
Configuration:
Quote{ "Settings: General": { "Notification type (1 - chat | 2 - toast | 3 - both)": 3, "Clear statistics on wipe": true, "Allow negative points values": true, "Count team kills in statistics": false, "KD calculation formula": "kills.players/deaths.players", "Item icon URL (by shortname)": "https://rustlabs.com/img/items180/%shortname%.png", "SteamIDs excluded from leaderboards": [ 1, 2 ], "Chat Commands": { "Commands to open statistics interface": [ "stats", "st" ] } }, "Settings: Points": { "Points for kills": { "Player kill": 0.4, "Animal kill": { "Default points value": 0.15, "Custom points list": { "bear": 0.25, "panther": 0.3, "tiger": 0.3 } }, "NPC kill": { "Default points value": 0.2, "Custom points list": { "tunnel_dwelling_g": 0.25, "tunnel_dwelling_h": 0.25 } } }, "Points for deaths": { "Suicide": -0.05, "Killed by player": -0.2, "Killed by animal": { "Default points value": -0.1, "Custom points list": { "boar": -0.1, "chicken": -0.2 } }, "Killed by NPC": { "Default points value": -0.05, "Custom points list": { "tunnel_dwelling_g": -0.1, "tunnel_dwelling_h": -0.1 } } }, "Points for crafting": { "Default points value": 0.05, "Custom points list": { "explosive.timed": 0.15, "explosives": 0.1 } }, "Points for gathering": { "Default points value": 0.05, "Custom points list": { "potato": 0.07, "sulfur.ore": 0.1 } }, "Points for destroying barrels": { "Default points value": 0.01, "Custom points list": { "loot-barrel-1": 0.01, "loot-barrel-2": 0.02 } }, "Points for looting crates": { "Default points value": 0.01, "Custom points list": { "crate_elite": 0.1, "crate_fuel": 0.02 } } }, "Settings: Interface": { "Leaderboard categories": [ { "Statistic key": "points", "Title": { "en": "POINTS", "ru": "ОЧКИ" }, "Sort order (ASC / DESC)": "DESC", "Value format": "{0:0.00}", "Offset min": "-56 0", "Offset max": "-8 0" }, { "Statistic key": "playtime", "Title": { "en": "PLAY TIME", "ru": "ИГРОВОЕ ВРЕМЯ" }, "Sort order (ASC / DESC)": "DESC", "Value format": "dd\\:hh\\:mm", "Offset min": "-128 0", "Offset max": "-64 0" }, { "Statistic key": "kd", "Title": { "en": "K/D", "ru": "K/D" }, "Sort order (ASC / DESC)": "DESC", "Value format": "{0:0.00}", "Offset min": "-160 0", "Offset max": "-136 0" }, { "Statistic key": "deaths.players", "Title": { "en": "DEATHS", "ru": "СМЕРТИ" }, "Sort order (ASC / DESC)": "ASC", "Value format": "{0}", "Offset min": "-216 0", "Offset max": "-168 0" }, { "Statistic key": "kills.players", "Title": { "en": "MURDERS", "ru": "УБИЙСТВА" }, "Sort order (ASC / DESC)": "DESC", "Value format": "{0}", "Offset min": "-272 0", "Offset max": "-224 0" } ], "Profile header statistics": [ { "Statistic key": "kills.players", "Title": { "en": "Murders", "ru": "Убийств" }, "Value format": "{0}", "Offset min": "0 0", "Offset max": "-375 0" }, { "Statistic key": "deaths.players", "Title": { "en": "Deaths", "ru": "Смертей" }, "Value format": "{0}", "Offset min": "75 0", "Offset max": "-300 0" }, { "Statistic key": "kd", "Title": { "en": "K/D", "ru": "K/D" }, "Value format": "{0:0.00}", "Offset min": "150 0", "Offset max": "-225 0" }, { "Statistic key": "accuracy", "Title": { "en": "Accuracy", "ru": "Точность" }, "Value format": "{0:0}%", "Offset min": "225 0", "Offset max": "-150 0" }, { "Statistic key": "hs", "Title": { "en": "HS", "ru": "HS" }, "Value format": "{0:0}%", "Offset min": "300 0", "Offset max": "-75 0" }, { "Statistic key": "points", "Title": { "en": "Points", "ru": "Очков" }, "Value format": "{0:0.00}", "Offset min": "375 0", "Offset max": "0 0" } ] }, "Settings: Rewards for leaderboard places": { "0": { "1": { "Reward commands": [ "command %userID% #1", "command %userID% #2" ], "Leaderboard customization": { "Icon": "MS_STAR", "Color": "#BBC47E" } } }, "4": { "1": { "Reward commands": [ "command %userID% #1", "command %userID% #2" ], "Leaderboard customization": { "Icon": "MS_STAR", "Color": "#BBC47E" } }, "2": { "Reward commands": [ "command %userID% #1", "command %userID% #2" ], "Leaderboard customization": { "Icon": "MS_STAR", "Color": "#84B4DD" } }, "3": { "Reward commands": [ "command %userID% #1", "command %userID% #2" ], "Leaderboard customization": { "Icon": "MS_STAR", "Color": "#BC84DD" } } } }, "Settings: Database": { "Use MySQL database": false, "Host": "127.0.0.1", "Port": 3306, "Database name": "rust_stats", "Username": "root", "Password": "password" } }
API:
QuoteList<ulong> API_GetTop(int categoryID); // Returns a list of player IDs sorted by the specified statistic category. PlayerData API_GetStatistics(ulong userID); // Returns full statistics data for the specified player. int API_GetPlaceByID(ulong userID, int categoryID); // Returns the player's position in the leaderboard for the specified category. // (0 = first place, -1 if not found) class PlayerData { public Statistics main = new Statistics(); public List<Record> kills = new List<Record>(64); public List<Record> deaths = new List<Record>(64); } class Statistics { public bool isPublic = true; public Kills kills = new Kills(); public class Kills { public int players; public Dictionary<string, int> animals = new Dictionary<string, int>(); public Dictionary<string, int> npcs = new Dictionary<string, int>(); public int total => players + animals.Values.Sum() + npcs.Values.Sum(); } public Deaths deaths = new Deaths(); public class Deaths { public int players; public int suicide; public Dictionary<string, int> animals = new Dictionary<string, int>(); public Dictionary<string, int> npcs = new Dictionary<string, int>(); public int total => players + suicide + animals.Values.Sum() + npcs.Values.Sum(); } public Combat combat = new Combat(); public class Combat { public int hits; public int shots; public int headShots; } public double playTime; public float points; public Dictionary<string, int> crafted = new Dictionary<string, int>(); public Dictionary<string, int> gathered = new Dictionary<string, int>(); public float accuracy => combat.shots == 0 ? 0f : ((float)combat.hits / combat.shots) * 100f; public float hs => combat.hits == 0 ? 0f : (float)combat.headShots / combat.hits * 100f; } class Record { public string target; public string weapon; public float distance; public bool hs; public DateTime time; }
