# Leaderboard

{% 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 a leaderboard of the top players. You can use any Statistics plugin (CSS or Metamod) that stores data in the database. Multiple leaderboards are also supported, meaning that for each server you can have multiple leaderboards (e.g. players with the most kills, points, etc..) \
It works by selecting players from a specified database based on a value you determine. For example, you can list the top players with the most kills, points, etc.. There are several options for displaying the leaderboard:\
1\.  Automatic update message that refreshes at each map start\
2\. Specified Slash Command \
3\. or Button in the Server Status

> The plugin includes extensive configuration options where you can set the tables from which statistics will be drawn, configure the automatic update message, set a custom Slash Command, and much more. The documentation contains an example for the default config.

\
⚠️<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": {
    "Allow Command": true,
    "Command Name": "leaderboard",
    "Command Description": "View server leaderboard",
    "Server Option Name": "server",
    "Server Option Description": "Which server to take leaderboard from",
    "Top List Option Name": "leaderboard",
    "Top List Option Description": "Which type of leadboard do you want to get?"
  },
  "Servers List": {
    "Public": {
      "TopList": {
        "TOP Players by Points": {
          "Table": "zenith_player_storage",
          "TopSize": 10,
          "SteamIdColumn": "steam_id",
          "NameColumn": "name",
          "StoredData": [
            "name",
            "steam_id"
          ],
          "StoredDataJSON": {
            "K4-Zenith-Ranks.storage": [
              "Rank",
              "Points"
            ],
            "K4-Zenith-Stats.storage": [
              "Kills",
              "Deaths"
            ]
          },
          "SortedValue": "Points",
          "IsSortedValueJSON": true,
          "AutoLeaderboardUpdate": {
            "Enabled": false,
            "ChannelID": "",
            "MessageID": ""
          },
          "Embed": {
            "SilentReponse": true,
            "Content": "",
            "Title": "\uD83C\uDFC6 Public Server Leaderboard (TOP 10) (Most Points)",
            "Description": "This is the leaderboard for the public server.",
            "Thumbnail": "",
            "Image": "",
            "HEXColor": "#3399ff",
            "Footer": "Last update",
            "FooterTimestamp": true,
            "PlayersListFormat": {
              "NameFormat": "{PLACE_EMOJI} \u0060{PLACE}.\u0060 **{name}** (Points: {points})\nKills: {kills} | Deaths: {deaths}\n",
              "PlaceEmotes": {
                "FirstPlace": ":first_place:",
                "SecondPlace": ":second_place:",
                "ThirdPlace": ":third_place:",
                "FourthPlace": ":military_medal:",
                "FifthPlace": ":military_medal:",
                "SixthPlace": ":military_medal:",
                "SeventhPlace": ":military_medal:",
                "EighthPlace": ":military_medal:",
                "NinthPlace": ":military_medal:",
                "TenthPlace": ":military_medal:",
                "EleventhPlace": ":military_medal:",
                "TwelfthPlace": ":military_medal:",
                "ThirteenthPlace": ":military_medal:",
                "FourteenthPlace": ":military_medal:",
                "FifteenthPlace": ":military_medal:"
              }
            },
            "SearchButton": {
              "Enabled": false,
              "ServerName": "Public",
              "Text": "Search Player Stats (Public)",
              "Color": 3,
              "Emoji": ":mag:"
            }
          },
          "Database": {
            "Host": "",
            "Port": 3306,
            "User": "",
            "Database": "",
            "Password": ""
          }
        },
        "TOP Players by Kills": {
          "Table": "zenith_player_storage",
          "TopSize": 10,
          "SteamIdColumn": "steam_id",
          "NameColumn": "name",
          "StoredData": [
            "name",
            "steam_id"
          ],
          "StoredDataJSON": {
            "K4-Zenith-Ranks.storage": [
              "Rank",
              "Points"
            ],
            "K4-Zenith-Stats.storage": [
              "Kills",
              "Deaths"
            ]
          },
          "SortedValue": "Kills",
          "IsSortedValueJSON": true,
          "AutoLeaderboardUpdate": {
            "Enabled": false,
            "ChannelID": "",
            "MessageID": ""
          },
          "Embed": {
            "SilentReponse": true,
            "Content": "",
            "Title": "\uD83C\uDFC6 Public Server Leaderboard (TOP 10) (Most Kills)",
            "Description": "This is the leaderboard for the public server.",
            "Thumbnail": "",
            "Image": "",
            "HEXColor": "#3399ff",
            "Footer": "Last update",
            "FooterTimestamp": true,
            "PlayersListFormat": {
              "NameFormat": "{PLACE_EMOJI} \u0060{PLACE}.\u0060 **{name}** (Points: {points})\nKills: {kills} | Deaths: {deaths}\n",
              "PlaceEmotes": {
                "FirstPlace": ":first_place:",
                "SecondPlace": ":second_place:",
                "ThirdPlace": ":third_place:",
                "FourthPlace": ":military_medal:",
                "FifthPlace": ":military_medal:",
                "SixthPlace": ":military_medal:",
                "SeventhPlace": ":military_medal:",
                "EighthPlace": ":military_medal:",
                "NinthPlace": ":military_medal:",
                "TenthPlace": ":military_medal:",
                "EleventhPlace": ":military_medal:",
                "TwelfthPlace": ":military_medal:",
                "ThirteenthPlace": ":military_medal:",
                "FourteenthPlace": ":military_medal:",
                "FifteenthPlace": ":military_medal:"
              }
            },
            "SearchButton": {
              "Enabled": false,
              "ServerName": "Public",
              "Text": "Search Player Stats (Public)",
              "Color": 3,
              "Emoji": ":mag:"
            }
          },
          "Database": {
            "Host": "",
            "Port": 3306,
            "User": "",
            "Database": "",
            "Password": ""
          }
        }
      }
    },
    "Only Mirage": {
      "TopList": {
        "TOP Players by Points": {
          "Table": "zenith_player_storage",
          "TopSize": 10,
          "SteamIdColumn": "steam_id",
          "NameColumn": "name",
          "StoredData": [
            "name",
            "steam_id"
          ],
          "StoredDataJSON": {
            "K4-Zenith-Ranks.storage": [
              "Rank",
              "Points"
            ],
            "K4-Zenith-Stats.storage": [
              "Kills",
              "Deaths"
            ]
          },
          "SortedValue": "Points",
          "IsSortedValueJSON": true,
          "AutoLeaderboardUpdate": {
            "Enabled": false,
            "ChannelID": "",
            "MessageID": ""
          },
          "Embed": {
            "SilentReponse": true,
            "Content": "",
            "Title": "\uD83C\uDFC6 Only Mirage Server Leaderboard (TOP 10) (Most Points)",
            "Description": "This is the leaderboard for the Only Mirage server.",
            "Thumbnail": "",
            "Image": "",
            "HEXColor": "#3399ff",
            "Footer": "Last update",
            "FooterTimestamp": true,
            "PlayersListFormat": {
              "NameFormat": "{PLACE_EMOJI} \u0060{PLACE}.\u0060 **{name}** (Points: {points})\nKills: {kills} | Deaths: {deaths}\n",
              "PlaceEmotes": {
                "FirstPlace": ":first_place:",
                "SecondPlace": ":second_place:",
                "ThirdPlace": ":third_place:",
                "FourthPlace": ":military_medal:",
                "FifthPlace": ":military_medal:",
                "SixthPlace": ":military_medal:",
                "SeventhPlace": ":military_medal:",
                "EighthPlace": ":military_medal:",
                "NinthPlace": ":military_medal:",
                "TenthPlace": ":military_medal:",
                "EleventhPlace": ":military_medal:",
                "TwelfthPlace": ":military_medal:",
                "ThirteenthPlace": ":military_medal:",
                "FourteenthPlace": ":military_medal:",
                "FifteenthPlace": ":military_medal:"
              }
            },
            "SearchButton": {
              "Enabled": false,
              "ServerName": "Only Mirage",
              "Text": "Search Player Stats (Only Mirage)",
              "Color": 3,
              "Emoji": ":mag:"
            }
          },
          "Database": {
            "Host": "",
            "Port": 3306,
            "User": "",
            "Database": "",
            "Password": ""
          }
        },
        "TOP Players by Kills": {
          "Table": "zenith_player_storage",
          "TopSize": 10,
          "SteamIdColumn": "steam_id",
          "NameColumn": "name",
          "StoredData": [
            "name",
            "steam_id"
          ],
          "StoredDataJSON": {
            "K4-Zenith-Ranks.storage": [
              "Rank",
              "Points"
            ],
            "K4-Zenith-Stats.storage": [
              "Kills",
              "Deaths"
            ]
          },
          "SortedValue": "Kills",
          "IsSortedValueJSON": true,
          "AutoLeaderboardUpdate": {
            "Enabled": false,
            "ChannelID": "",
            "MessageID": ""
          },
          "Embed": {
            "SilentReponse": true,
            "Content": "",
            "Title": "\uD83C\uDFC6 Only Mirage Server Leaderboard (TOP 10) (Most Kills)",
            "Description": "This is the leaderboard for the Only Mirage server.",
            "Thumbnail": "",
            "Image": "",
            "HEXColor": "#3399ff",
            "Footer": "Last update",
            "FooterTimestamp": true,
            "PlayersListFormat": {
              "NameFormat": "{PLACE_EMOJI} \u0060{PLACE}.\u0060 **{name}** (Points: {points})\nKills: {kills} | Deaths: {deaths}\n",
              "PlaceEmotes": {
                "FirstPlace": ":first_place:",
                "SecondPlace": ":second_place:",
                "ThirdPlace": ":third_place:",
                "FourthPlace": ":military_medal:",
                "FifthPlace": ":military_medal:",
                "SixthPlace": ":military_medal:",
                "SeventhPlace": ":military_medal:",
                "EighthPlace": ":military_medal:",
                "NinthPlace": ":military_medal:",
                "TenthPlace": ":military_medal:",
                "EleventhPlace": ":military_medal:",
                "TwelfthPlace": ":military_medal:",
                "ThirteenthPlace": ":military_medal:",
                "FourteenthPlace": ":military_medal:",
                "FifteenthPlace": ":military_medal:"
              }
            },
            "SearchButton": {
              "Enabled": false,
              "ServerName": "Only Mirage",
              "Text": "Search Player Stats (Only Mirage)",
              "Color": 3,
              "Emoji": ":mag:"
            }
          },
          "Database": {
            "Host": "",
            "Port": 3306,
            "User": "",
            "Database": "",
            "Password": ""
          }
        }
      }
    }
  },
  "ConfigVersion": 1
}
```

</details>

<div align="left"><figure><img src="/files/3RywxKm8lJc7K7zrpC37" alt="" width="406"><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 leaderboards create a ticket on our Discord 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/leaderboard.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.
