Page 1 of 1

[CS:GO/CS:S] Simple Weapon Restrictor

Posted: Fri Jan 24, 2020 9:56 am
by Andreeas
Simple Weapon Restrictor
This plugin simply restricts weapons, so they can't be used. All weapons can easily be restricted by the use of commands or the config file. The plugin is "sv_cheats"-friendly, and it's impossible to equip a restricted weapon. (If that's not the case, please contact me)

Feature list
Very simple to use
Prevent specific weapons from being used
Control restricted weapons through commands
Easy-to-use config file for permanent restrictions
Commands
wr_restrict <weapon*> - Restricts the given weapon.
wr_unrestrict <weapon*> - Unrestricts the given weapon.
wr_reload - Reloads the config files. (Note: This removes all temporary restrictions.)
All commands require the config admin flag.
*: The weapon parameter can either be the classname (e.g. weapon_awp) or the weapon alias (e.g. awp). It's also case-insensitive.

Config
The config adds a neat and simple way to permanently restrict weapons. It's not needed and does not have to be present at all. The config is located in addons/sourcemod/configs/restricted_weapons.txt. It's a plain text file, where each line is an entry in the restrictions list. A line consists of just a weapon alias, which works the same way as the commands. The plugin will yield warning, if a line is an invalid weapon or if the same weapon is listed multiple times. An example of a config file could be:
Code:

Code: Select all

awp
p90
weapon_Glock
rpg
weapon_deagle
weapon_stunstick
P90
The config can use both class names and weapon aliases. There's some invalid weapons and some other weapons are listed multiple times in this config. The plugin skips the invalid entries and works fine even with errors in the config, but it does print some warnings in the console to assist the server manager:
Code:

Code: Select all

[WR] Config file: WARNING - Invalid entry: rpg! (Line: 4)
[WR] Config file: WARNING - Invalid entry: stunstick! (Line: 6)
[WR] Config file: WARNING - Duplicate entry: p90! (Line: 7)
[WR] Config file: Loaded 4 restriction(s).
This makes it easy to identify mistakes. It loaded 4 restrictions in total: awp, p90, glock, and deagle. The other lines were simply skipped. A more detailed description of the loading process can be seen with debug enabled. The ConVar config is located in cfg/sourcemod/restricted_weapons.txt

Installation
If you want to utilize the config file, then you have to manually create the file: addons/sourcemod/configs/restricted_weapons.txt. Otherwise, it's a normal plugin installation.

ConVars
wr_debug (default: false/0) - Prints debug information to the console.
wr_version - The current version of the plugin.
Download
Source