Skip to content

Plugin "SlotBlocking"

This plugin is designed for slot blocking and offers multiple usage options. Slots can be restricted based on Discord roles (for instance, restricting certain planes for regular Discord members while blocking others for donators), credit points (as detailed in the CreditSystem document), or a specific VIP role set within this plugin's configuration. It also includes a balance system for both teams (red and blue), ensuring fair gameplay by maintaining an equal distribution of players on each side.

Configuration

As SlotBlocking is an optional plugin, you need to activate it in main.yaml first like so:

# config/main.yaml
opt_plugins:
  - slotblocking

The plugin itself is configured with a file named config/plugins/slotblocking.yaml. You'll find a sample file in the ./samples directory:

# config/plugins/slotblocking.yaml
DEFAULT:            # Default section - true for all your servers.
  VIP:              # define a VIP group
    audit: true     # you want to be informed if someone of that group enters your server
    discord:        # you can define VIPs by a specific discord role
      - Admin
      - DCS Admin
    ucid:           # and a list of UCIDs (can be single also)
      - aabbccddeeffgghh
      - 11aa22bb33dd44ee
    slots: 2        # Optional: These numbers of slots are locked for VIPs only 
    message_server_full: The server is full, please try again later!  # default message, if the server is considered full
  restricted:       # These slots are restricted in any way. Here we restrict CA slots for Donators or members or the Discord.
  - unit_type: artillery_commander
    discord: Donators
    message: This slot is reserved for Donators!
  - unit_type: forward_observer
    discord: Donators
    message: This slot is reserved for Donators!
  - unit_type: instructor
    discord: Donators
    message: This slot is reserved for Donators!
  - unit_type: observer   # Lock the observer role to a specific discord side and discord role
    side: 2               # side 1 = red, 2 = blue, not given - both sides
    discord: '@everyone'  # Only the "everyone" role needs the @ at the beginning, all other roles don't.
    message: This slot is reserved for members of https://invite.link!
  - unit_type: dynamic    # restrict the usage of dynamic slots in general for a specific Discord role
    discord: Tester
    message: Dynamic Slots are restricted for Testers only.
  maximum:                    # Optional: Maximum number of slots per side
    blue: 60                  # if red is set, default is maxPlayers - red
    red: 40                   # if blue is set, default is maxPlayers - blue
    message: This coalition is full, please try the other.
  balancing:                  # Optional: Allows balancing for your server (blue vs red)
    blue_vs_red: 0.5          # 50% balance blue vs red
    threshold: 0.1            # 10% threshold until slots are blocked
    activation_threshold: 10  # do not balance, if the number of players is below this threshold
    message: You need to take a slot of the opposite coalition to keep the balance!
  names:
    pattern: ['%[SK%]', '%[VFW%]']   # Lua patterns matched against the player name; brackets escape as %[ %]
    message: You need a squadron tag in your name to join this server.
  messages:
    credits_taken: '{deposit} credits taken for using a reserved module.' # Possible variables: deposit, old_points, new_points
    payback: 'You have been given {deposit} credits back.'                # Possible variables: deposit, old_points, new_points
DCS.dcs_serverrelease:
  restricted:             # in this example we restrict by credit points
  - group_name: Rookie    # this tag has to be in the group name of the respective units (best is to prepend it)
    points: 10            # you need at least 10 credit points to join this unit
    costs: 10             # the unit will cost you 10 points, depending on the payback (see below)
  - group_name: Veteran
    points: 20
    costs: 10
  - group_name: Ace
    points: 50
    costs: 30
  payback: true         # payback the plane costs on proper landings, otherwise charge by usage
Each unit can be identified using either its "group_name" or "unit_name", which are substrings or patterns of the names used in your mission, or by its "unit_type". Restrictions can be enforced through credit "points" earned from kills or "discord" (specific Discord roles, such as "Donators" in the example provided). The "costs" refer to the points you lose when you are killed while flying this specific aircraft, if applicable. The maximum section limits how many players can be on each coalition side. If you only define one side, the other side is derived from maxPlayers - configured_side.

Sample Use Case

Here are some sample use cases that show how the plugin can be used.

One Life per User

You die, you can't hop in again.

slotblocking.yaml:

# config/plugins/slotblocking.yaml
DEFAULT:
  restricted:
    - group_name: ".+"  # true for each unit / group 
      points:  1        # you need 1 credit point to enter
      costs: 1          # you'll immediately lose 1 credit point on entering
      message: You ran out of lifes.

creditsystem.yaml:

# config/plugins/creditsystem.yaml
DEFAULT:
  initial_points: 1   # you get one initial credit point (your "lifes")
  points_per_kill:
    - default: 0      # you don't get new lifes by kills

One Life per User (get new lives per pvp kills)

slotblocking.yaml:

# config/plugins/slotblocking.yaml
DEFAULT:
  restricted:
    - group_name: ".+"  # true for each unit / group 
      points:  1        # you need 1 credit point to enter
      costs: 1          # you'll immediately lose 1 credit point on entering
      message: You ran out of lifes.
creditsystem.yaml:
# config/plugins/creditsystem.yaml
DEFAULT:
  initial_points: 1     # you get one initial credit point (your "lifes")
  points_per_kill:
    - default: 0        # you don't get new lifes by kills
    - category: Planes  # you get one point (aka one additional life), if you kill another player
      type: Player
      points: 1

One Life per User (hard version)

Life will be taken if you hop in your plane already. You get it back, if you land properly on any airport, only then you can select another slot.

slotblocking.yaml:

# config/plugins/slotblocking.yaml
DEFAULT:
  payback: true           # you get the costs back on landing
  restricted:
    - group_name: ".+"    # true for each unit / group 
      points:  1          # you need 1 credit point to enter
      costs: 1            # you'll immediately lose 1 credit point on entering
      message: You ran out of lifes.
creditsystem.yaml:
# config/plugins/creditsystem.yaml
DEFAULT:
  initial_points: 1   # you get one initial credit point (your "lifes")
  points_per_kill:
    - default: 0      # you don't get new lifes by kills

Balancing

If you have a PvP server and want to enable balancing, this is how you can set it up.

# config/plugins/slotblocking.yaml
DEFAULT:
  balancing:                  # Optional: Allows balancing for your server (blue vs red)
    blue_vs_red: 0.5          # 50% balance blue vs red
    threshold: 0.1            # 10% threshold until slots are blocked
    activation_threshold: 10  # do not balance if the number of players is below this threshold
    message: You need to take a slot of the opposite coalition to keep the balance!

Note

Balancing will not be checked - if a user selects another slot on the same side (if you are on blue, you can stay on blue) - if a user jumps in a CA (Artillery Commander, etc.) or carrier slot (LSO, Airboss)


Configuration reference

Key Type Description Example
DEFAULT map Applies to every instance.
commands
chat_commands

DEFAULT

Key Type Description Example
DEFAULT.VIP map Defines a VIP group with reserved slots and named members. audit: true
discord:
- Admin
- DCS Admin
ucid:
- aabbccddeeffgghh
slots: 2
message_server_full: The server is full, please try again later!
DEFAULT.VIP.audit bool Notify the VIP group when one of its members joins a server. true
DEFAULT.VIP.discord any Discord roles that grant VIP status. Donators
DEFAULT.VIP.ucid any UCIDs of the players that are granted VIP status. aabbccddeeffgghh
DEFAULT.VIP.slots int Number of slots kept free for VIP members only. (range: min 1) 2
DEFAULT.VIP.message_server_full str Message shown when the server is considered full. (range: min 1) The server is full, please try again later!
DEFAULT.restricted list Slots restricted by Discord role, UCID, or credit points. - unit_type: observer
side: 2
discord: '@everyone'
message: This slot is reserved for members of https://invite.link!
DEFAULT.restricted[].unit_type str Unit type this restriction applies to, e.g. observer. (range: min 1) observer
DEFAULT.restricted[].unit_name str Unit name or Lua pattern that this restriction matches. (range: min 1) Hawg
DEFAULT.restricted[].group_name str Group name or Lua pattern that this restriction matches. (range: min 1) Rookie
DEFAULT.restricted[].discord any Discord roles that are allowed to use this slot. Donators
DEFAULT.restricted[].message str Message shown to players that cannot use this slot. (range: min 1) This slot is reserved for Donators!
DEFAULT.restricted[].points int Credit points needed to enter this slot. 10
DEFAULT.restricted[].costs int Credit points charged for losing this unit. 10
DEFAULT.restricted[].crew int Number of crew members required for this slot. 2
DEFAULT.restricted[].VIP bool Reserve this slot for VIP members only. true
DEFAULT.restricted[].side int Side this restriction applies to, 0 both, 1 red, 2 blue. (one of: 0, 1, 2) 2
DEFAULT.payback bool Refund the credit costs of a unit when it lands properly. true
DEFAULT.maximum map Maximum number of players allowed per coalition side. blue: 60
red: 40
message: This coalition is full, please try the other.
DEFAULT.maximum.blue int Maximum number of blue players, derived from red if unset. (range: min 0) 60
DEFAULT.maximum.red int Maximum number of red players, derived from blue if unset. (range: min 0) 40
DEFAULT.maximum.message str Message shown when a coalition has reached its maximum. (range: min 1) This coalition is full, please try the other.
DEFAULT.balancing map Keeps the number of blue and red players balanced. blue_vs_red: 0.5
threshold: 0.1
activation_threshold: 10
message: You need to take a slot of the opposite coalition to keep the balance!
DEFAULT.balancing.blue_vs_red float (required) Target ratio of blue to red players, e.g. 0.5 for even teams. 0.5
DEFAULT.balancing.threshold float (required) Allowed deviation from the ratio before slots are blocked. 0.1
DEFAULT.balancing.activation_threshold int Do not balance while fewer than this many players are online. 10
DEFAULT.balancing.message str Message shown when a player must switch sides to balance. (range: min 1) You need to take a slot of the opposite coalition to keep the balance!
DEFAULT.names map Requires a squadron tag in the player name to join. pattern: ['%[SK%]', '%[VFW%]']
message: You need a squadron tag in your name to join this server.
DEFAULT.names.pattern any Lua patterns that a player name must match to join. %[SK%]
DEFAULT.names.message str Message shown when a player name does not match. (range: min 1) You need a squadron tag in your name to join this server.
DEFAULT.messages map Messages shown for credit-based restrictions. credits_taken: '{deposit} credits taken for using a reserved module.'
payback: 'You have been given {deposit} credits back.'
DEFAULT.messages.credits_taken str Message when credits are charged; holds {deposit}, {old_points}, {new_points}. (range: min 1) {deposit} credits taken for using a reserved module.
DEFAULT.messages.payback str Message when credits are refunded; holds {deposit}, {old_points}, {new_points}. (range: min 1) You have been given {deposit} credits back.

<(.+)>

Key Type Description Example
<(.+)> any (one of: element_schema, instance_schema)