Allows you to restrict weapon based on a percentage quota and a hard cap.
.dll
file in the releases pageWeaponRestrict
in /game/csgo/addons/counterstrikesharp/plugins
and move the WeaponRestrict.dll
into the folder you just created/game/csgo/addons/counterstrikesharp/configs/plugins/WeaponRestrict/WeaponRestrict.json
to your liking using the guide belowcss_plugins reload [plugin index]
to update the loaded config (you can get the index by running css_plugins list
)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.
RestrictWarmup
will restrict weapon usage in warmup if set to true. If set to false, restrictions are not applied on warmup period.
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.
If you do not want to add any overrides to maps, make MapConfigs
and empty array as such:
"MapConfigs": {}
Example config generated by the plugin:
{
"MessagePrefix": "{Color.Orange}[WeaponRestrict] ",
"RestrictMessage": "{Color.LightPurple}{0}{Color.Default} is currently restricted to {Color.LightRed}{1}{Color.Default} per team.",
"DisabledMessage": "{Color.LightPurple}{0}{Color.Default} is currently {Color.LightRed}disabled{Color.Default}.",
"DefaultQuotas": {
"weapon_awp": 0.2
},
"DefaultLimits": {
"weapon_awp": 1
},
"DoTeamCheck": true,
"AllowPickup": false,
"RestrictWarmup": true,
"VIPFlag": "@css/vip",
"MapConfigs": {
"de_dust2": {
"WeaponQuotas": {
"weapon_awp": 0.2
},
"WeaponLimits": {
"weapon_awp": 1
},
"awp.*": {}
}
},
"ConfigVersion": 4
}
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]]
.