CS2Plugins / WeaponRestrict

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Summary

Allows you to restrict weapon based on a percentage quota and a hard cap.

Installation

  1. Download the .dll and .json files in the releases page
  2. Create a folder named WeaponRestrict in /game/csgo/addons/counterstrikesharp/plugins and move the WeaponRestrict.dll into the folder you just created
  3. Move the WeaponRestrict.json file into /game/csgo/addons/counterstrikesharp/gamedata/
  4. Start the server
  5. Configure the auto-generated config in /game/csgo/addons/counterstrikesharp/configs/plugins/WeaponRestrict/WeaponRestrict.json to your liking using the guide below
  6. (Optional) Reload the plugin using css_plugins reload [plugin index] to update the loaded config (you can get the index by running css_plugins list)

Config

You can customize the MessagePrefix, RestrictMessage and DisabledMessage. To not use the DisabledMessage leave it as an empty string ("").

For RestrictMessage use {0} for the weapon name and {1} for the limit.

For DisabledMessage use {0} for the weapon name.

When formatting the messages with colors, use the escaped character code or {Color.*} where * is the exact name of the field from this class.

For example, to use the light purple color use {Color.LightPurple} and NOT {Color.lightPurple} or any other case variant.

To completely disable a weapon, set the WeaponQuotas or WeaponLimits for the desired weapon to 0.

WeaponQuotas is a decimal number used for a percentage of players (0.2 = 20%, for every 5th person a new weapon is allowed), either on the total players or for the team (depending on DoTeamCheck).

WeaponLimits is a hard cap per weapon (1 = 1 AWP total/per team, also caps out the WeaponQuotas value).

You can use one, both, or none of WeaponQuotas and WeaponLimits.

AllowPickup will allow anyone to pick up the restricted weapons after buytime is over, but not allow the purchase if the limit is met on their team. Do note that this is easily bypassable by holders dropping the weapons until other players purchase and picking up when buytime is over.

You can use the VIPFlag to enable VIP bypass for a permission group, or use an empty string ("") to disable the check.

The example config will allow 20% of the players on either team to have an AWP, with a hard limit of 1 per team. Meaning if you have at least 5 players on a team, they get one AWP. VIPs are completely ignored and can always buy, drop and pick up the AWP.

MapConfigs is an optional dictionary of maps which contains the same structure of WeaponQuotas and WeaponLimits. Both are optional. If you specify a map name and do not specify any quotas or limits, the map will load unrestricted. See awp.* in the example config. You can use a regular expression for the map name. Do note that the pattern is already wrapped in ^ and $ for simplicity.

Example config generated by the plugin:

{
  "MessagePrefix": "\u1010\u0010[WeaponRestrict] ",
  "RestrictMessage": "\u0003{0}\u0001 is currently restricted to \u000F{1}\u0001 per team.",
  "DisabledMessage": "\u0003{0}\u0001 is currently \u000Fdisabled\u0001.",
  "WeaponQuotas": {
    "weapon_awp": 0.2
  },
  "WeaponLimits": {
    "weapon_awp": 1
  },
  "DoTeamCheck": true,
  "VIPFlag": "@css/vip",
  "MapConfigs": {
    "de_dust2": {
      "WeaponLimits": {
        "weapon_awp": 0
      }
    },
    "awp.*": {},
  },
  "ConfigVersion": 2
}

Commands

css_restrictweapon (!restrictweapon) lets you restrict, unrestrict or reset any weapon until next map change or plugin reload. Usage: css_restrictweapon weapon_name [[default/none] | [quota/limit value]].

About

License:The Unlicense


Languages

Language:C# 100.0%