Custom Variables

Custom variables is a feature that allows you to create and use your own variables. These variables can contain conditions that affect the output text.

How do Custom Variables Work?

When creating a custom variable, you define conditions that must be met to display certain text. These conditions can be specified within various contexts, such as Player, Target, Server, DiscordUser, or DiscordChannel.

How to Use a Custom Variable

Default Variables (also known as Available Variables) are used like this: {Server.MapName}, where each default variable overrides the input with a single value. However, Custom Conditions are used like this: [Server.YourCustomVariable], these custom variables can display different texts based on the conditions met.

So, in short, Default Variables, already implemented in the plugin, are enclosed within {XX}, while your Custom Variables are enclosed within [XX], distinguishing them from each other.

How to Setup a Custom Variable

  • Value - The value that will be checked (You can use Default Variables)

  • Operator - What condition must be met

  • ValueToCheck - The value that will be compared with Value(You can use Default Variables)

  • ReplacementValue - Result if the condition is met

Available Conditions (Operators)

  • ==: Means "equals". This condition is met if the Value is equal to the ValueToCheck

  • !=: Means "not equals". This condition is met if the Value is not equal to the ValueToCheck

  • ~: Means "contains". This condition is met if the Value contains the ValueToCheck

  • >=: Means "greater than or equal to". This condition is met if the Value is greater than or equal to the ValueToCheck

  • <=: Means "less than or equal to". This condition is met if the Value is less than or equal to the ValueToCheck

  • >: Means "greater than". This condition is met if the Value is greater than the ValueToCheck

  • <: Means "less than". This condition is met if the Value is less than the ValueToCheck

  • empty : Leave operator empty ("Operator": "",), to override variable if none of the previous conditions are met (And this condition must always be the last one)

Available Functions

  • {Replace(VALUE1)(VALUE2)} - The value in the first brackets is overwritten by the value in the second brackets

Example of use:

  1. We create a Custom Variable that:

• When the server is empty, display "Server Is Empty"

• When there are more than 0 players on the server, display: "Number of players on the Server"

"Server.CustomOnlinePlayers": [ // YOUR CUSTOM VARIABLE NAME
      {
        "Value": "{Server.OnlinePlayers}", // DEFAULT VALUE
        "Operator": "==", // CONDITION
        "ValueToCheck": "0", // VALUE TO CHECK
        "ReplacementValue": "Server Is Empty" // DISPLAYED TEXT
      },
      { // If all previous conditions are not met, the ReplacementValue is displayed
        "ReplacementValue": "{Server.OnlinePlayers}"
      }
    ]

Examples

Replace Map Prefixes (Like de_ , cs_ , awp_)
  • If the map name contains de_ / cs_ / awp_ , this text will be removed

"Server.RemoveMapPrefix": [
      {
        "Value": "{Server.MapName}",
        "Operator": "~",
        "ValueToCheck": "de_",
        "ReplacementValue": "{Replace(de_)()}"
      },
      {
        "Value": "{Server.MapName}",
        "Operator": "~",
        "ValueToCheck": "cs_",
        "ReplacementValue": "{Replace(cs_)()}"
      },
      {
        "Value": "{Server.MapName}",
        "Operator": "~",
        "ValueToCheck": "awp_",
        "ReplacementValue": "{Replace(awp_)()}"
      }
    ]
Better Map Names
  1. If the map name is de_mirage, the resulting text will be MIRAGE

  2. If the map name contains nuke, the resulting text will be Nuke

  3. None of the previous conditions is met, the default map name will be displayed

"Server.BetterMapName": [
      {
        "Value": "{Server.MapName}",
        "Operator": "==",
        "ValueToCheck": "de_mirage",
        "ReplacementValue": "MIRAGE"
      },
      {
        "Value": "{Server.MapName}",
        "Operator": "~",
        "ValueToCheck": "nuke",
        "ReplacementValue": "Nuke"
      },
      {
        "ReplacementValue": "{Server.MapName}"
      }
    ]
Better Players Count
  1. If only bots are connected, the result will be: Only the Bots are connected

  2. If the server is empty, the result will be: Server Is Empty

  3. If the server is not empty, the result will be: e.g. 5/10

"Server.BetterPlayersCount": [
      {
        "Value": "{Server.OnlinePlayers}",
        "Operator": "==",
        "ValueToCheck": "{Server.OnlineBots}",
        "ReplacementValue": "Only the Bots are connected"
      },
      {
        "Value": "{Server.OnlinePlayers}",
        "Operator": "==",
        "ValueToCheck": "0",
        "ReplacementValue": "Server Is Empty"
      },
      {
        "Value": "{Server.OnlinePlayers}",
        "Operator": ">",
        "ValueToCheck": "0",
        "ReplacementValue": "{Server.OnlinePlayers}/{Server.MaxPlayers}"
      }
    ]

Last updated