# Player Stats

{% hint style="danger" %}
⭐ This plugin is private! Can be purchased on our [Discord Marketplace](https://discord.com/invite/Tzmq98gwqF).
{% endhint %}

{% hint style="info" %}
It is used to display player statistics from any CSS or Metamod plugin that stores player stats in a MySQL database (Players do not need to be connected on the CS2 server). You can view these statistics on the Discord server using the Slash command or by clicking the button under [Server Status](https://docs.sourcefactory.eu/discord-utilities/modules/server-status) / [Server Status Plus](https://docs.sourcefactory.eu/discord-utilities/modules/server-status-plus) / [Reports](https://docs.sourcefactory.eu/discord-utilities/modules/report-calladmin). You can fetch statistics from all your servers, so if you have multiple servers with stats stored in different databases, you can choose which server's stats to display when using the Slash Command.<br>

> The plugin includes extensive configuration options where you can adjust and set which database tables to pull data from, which columns to store, search by player Names or SteamIDs, customize response messages, and much more.

\
⚠️<mark style="color:yellow;">You only need to have this plugin installed on one server! Do not upload this plugin to multiple servers if you use the same BOT on each server!</mark>
{% endhint %}

<details>

<summary>Config Preview</summary>

```
{
  "Discord Command Data": {
    "Command Name": "stats",
    "Command Description": "Display player statistics",
    "Server Option Name": "server",
    "Server Option Description": "Which server to take statistics from",
    "Search By Name Option": {
      "Enabled": true,
      "PlayerName Option Name": "name",
      "PlayerName Option Description": "Player\u0027s name"
    },
    "Search By SteamID Option": {
      "Enabled": true,
      "PlayerSteamID Option Name": "steamid",
      "PlayerSteamID Option Description": "Player\u0027s SteamID"
    },
    "Search By Discord User Option": {
      "Enabled": true,
      "DiscordUser Option Name": "user",
      "DiscordUser Option Description": "Player\u0027s Discord Name"
    }
  },
  "Servers List": {
    "Public": {
      "Database": {
        "Host": "",
        "Port": 3306,
        "User": "",
        "Database": "",
        "Password": ""
      },
      "Tables": {
        "zenith_player_storage": {
          "SteamIdColumn": "steam_id",
          "NameColumn": "name",
          "StoredData": [
            "steam_id",
            "name",
            "last_online"
          ],
          "StoredDataJSON": {
            "K4-Zenith-Ranks.storage": [
              "Rank",
              "Points"
            ],
            "K4-Zenith-Stats.storage": [
              "Kills",
              "Deaths",
              "Assists",
              "MVP",
              "Headshots",
              "Shoots",
              "HitsGiven",
              "HitsTaken",
              "HeadHits",
              "NeckHits",
              "ChestHits",
              "LeftArmHits",
              "LeftLegHits",
              "StomachHits",
              "RightArmHits",
              "RightLegHits"
            ]
          },
          "StoredDataMultipleLines": {}
        },
        "zenith_weapon_stats": {
          "SteamIdColumn": "steam_id",
          "NameColumn": "",
          "StoredData": [],
          "StoredDataJSON": {},
          "StoredDataMultipleLines": {
            "weapon": {
              "ak47": [
                "kills",
                "headshots",
                "shots"
              ],
              "awp": [
                "kills",
                "headshots",
                "shots"
              ],
              "deagle": [
                "kills",
                "headshots",
                "shots"
              ],
              "m4a1": [
                "kills",
                "headshots",
                "shots"
              ],
              "m4a1_silencer": [
                "kills",
                "headshots",
                "shots"
              ],
              "m4a1-s": [
                "kills",
                "headshots",
                "shots"
              ]
            }
          }
        }
      }
    },
    "Only Mirage": {
      "Database": {
        "Host": "",
        "Port": 3306,
        "User": "",
        "Database": "",
        "Password": ""
      },
      "Tables": {
        "zenith_player_storage": {
          "SteamIdColumn": "steam_id",
          "NameColumn": "name",
          "StoredData": [
            "steam_id",
            "name",
            "last_online"
          ],
          "StoredDataJSON": {
            "K4-Zenith-Ranks.storage": [
              "Rank",
              "Points"
            ],
            "K4-Zenith-Stats.storage": [
              "Kills",
              "Deaths",
              "Assists",
              "MVP",
              "Headshots",
              "Shoots",
              "HitsGiven",
              "HitsTaken",
              "HeadHits",
              "NeckHits",
              "ChestHits",
              "LeftArmHits",
              "LeftLegHits",
              "StomachHits",
              "RightArmHits",
              "RightLegHits"
            ]
          },
          "StoredDataMultipleLines": {}
        },
        "zenith_weapon_stats": {
          "SteamIdColumn": "steam_id",
          "NameColumn": "",
          "StoredData": [],
          "StoredDataJSON": {},
          "StoredDataMultipleLines": {
            "weapon": {
              "ak47": [
                "kills",
                "headshots",
                "shots"
              ],
              "awp": [
                "kills",
                "headshots",
                "shots"
              ],
              "deagle": [
                "kills",
                "headshots",
                "shots"
              ],
              "m4a1": [
                "kills",
                "headshots",
                "shots"
              ],
              "m4a1_silencer": [
                "kills",
                "headshots",
                "shots"
              ],
              "m4a1-s": [
                "kills",
                "headshots",
                "shots"
              ]
            }
          }
        }
      }
    }
  },
  "Response Embeds": {
    "Stats Found": {
      "Silent Response": true,
      "Content": "",
      "Title": "Statistics of player {name}",
      "Description": "\u003E \uD83C\uDF96\uFE0F Rank: \u0060{JSON_Rank}\u0060 (\u0060{JSON_Points}\u0060 Points)\n\u003E \uD83D\uDCC5 Last connection: \u0060{last_online}\u0060\n\n ",
      "Fields": "\u003E \uD83C\uDFAE Game Stats;-# Total Kills: \u0060{JSON_Kills}\u0060\n-# Total Deaths: \u0060{JSON_Deaths}\u0060\n-# Total Headshots: \u0060{JSON_Headshots}\u0060\n-# Total Assists: \u0060{JSON_Assists}\u0060\n-# Total Shoots: \u0060{JSON_Shoots}\u0060;true|\u003E \uD83D\uDD2B Weapon Stats;**AK47** - \u0060{ak47_kills}\u0060 Kills (\u0060{ak47_headshots}\u0060 HS)\n**M4A4** -\u0060{m4a1_kills}\u0060 Kills (\u0060{m4a1_headshots}\u0060 HS);true|\u003E \uD83C\uDFAF Hits (Given: {JSON_HitsGiven} / Taken: {JSON_HitsTaken});-# Head: \u0060{JSON_HeadHits}\u0060\n-# Neck: \u0060{JSON_NeckHits}\u0060\n-# Chest: \u0060{JSON_ChestHits}\u0060\n-# Stomach: \u0060{JSON_StomachHits}\u0060\n-# Left Arm: \u0060{JSON_LeftArmHits}\u0060\n-# Right Arm: \u0060{JSON_RightArmHits}\u0060\n-# Left Leg: \u0060{JSON_LeftLegHits}\u0060\n-# Right Leg: \u0060{JSON_RightLegHits}\u0060;false",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#00ccff",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Multiple Matches Found": {
      "Silent Response": true,
      "Content": "",
      "Title": "",
      "Description": "\u003E More results were found for \u0060{VALUE}\u0060 value on server \u0060{SERVER}\u0060!\n\n\u003E \u2B07\uFE0F Select a player from the list below \u2B07\uFE0F",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff9933",
      "Footer": "",
      "Footer Timestamp": false,
      "Stats Found": {
        "Select Menu Name": "Select a player",
        "Select Menu Format": "{name}",
        "Select Menu Description Format": "{steam_id}",
        "Select Menu Emoji": ""
      }
    },
    "Stats Not Found": {
      "Silent Response": true,
      "Content": "",
      "Title": "",
      "Description": "\u003E No results were found for the specified value \u0060{VALUE}\u0060!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff8000",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Invalid Search Format": {
      "Silent Response": true,
      "Content": "",
      "Title": "",
      "Description": "\u003E The entered value \u0060{VALUE}\u0060 is not in a valid format!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff3333",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Player Is Not Linked": {
      "Content": "",
      "Title": "",
      "Description": "\u003E User \u003C@{DiscordUser.ID}\u003E does not have an account linked to steam!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff6666",
      "Footer": "",
      "Footer Timestamp": false
    },
    "Invalid Format": {
      "Content": "",
      "Title": "",
      "Description": "\u003E Invalid Format! You must complete one of the options!",
      "Fields": "",
      "Thumbnail": "",
      "Image": "",
      "HEX Color": "#ff6666",
      "Footer": "",
      "Footer Timestamp": false
    }
  },
  "Search Player Modal": {
    "Modal Name": "Search Player Stats",
    "Value Label": "Insert player name",
    "Value Min Length": 3,
    "Value Max Length": 32
  },
  "ConfigVersion": 1
}
```

</details>

<div align="left"><figure><img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2F1410J5X7f0FcI8jNZRwb%2FPlayerStats_StatsFound.png?alt=media&#x26;token=9edb55a0-8f70-4ea3-8baf-5d1a5cb92578" alt="" width="368"><figcaption></figcaption></figure></div>

<div align="left"><figure><img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2FRzXdXZ5wDfdMO8UDTtda%2FPlayerStats_moreresults.png?alt=media&#x26;token=c5d57168-01cf-4095-9031-0d5a53e96fa9" alt="" width="362"><figcaption></figcaption></figure> <figure><img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2FyPLz4LyojDF5hqPD1t4Z%2FPlayerStats_NotFound.png?alt=media&#x26;token=b50b410b-a016-497e-9aaf-8bff19c3bd88" alt="" width="335"><figcaption></figcaption></figure></div>

### Configuration

{% hint style="danger" %}

> Since the setup is very complicated to explain, so if you want to edit or create a config for your stats create a ticket on our Discord server.
> {% endhint %}

{% hint style="success" %}
**To edit the embeds, follow the instructions:** [**Custom Embeds Format**](https://docs.sourcefactory.eu/discord-utilities/tutorials/custom-embeds-format)

> Available Variables for <mark style="color:red;">`Stats Found`</mark>

• Names of all columns in StoredData\
So for example, if you have stored name, kills, deaths in StoredData you can use <mark style="color:blue;">{name}</mark> , <mark style="color:blue;">{kills}</mark> and <mark style="color:blue;">{deaths}</mark> as variables.\
\&#xNAN;**•** <mark style="color:blue;">{VALUE}</mark> > The value that was searched for\
\&#xNAN;**•** <mark style="color:blue;">{SERVER}</mark> > The name of the selected server

> Available Variables for <mark style="color:red;">`Multiple Matches Found`</mark> / <mark style="color:red;">`Stats Not Found`</mark> and <mark style="color:red;">`Invalid Search Format`</mark>

**•** <mark style="color:blue;">{VALUE}</mark> > The value that was searched for\
\&#xNAN;**•** <mark style="color:blue;">{SERVER}</mark> > The name of the selected server
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sourcefactory.eu/discord-utilities/modules/player-stats.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
