# Use Weapon Restrictions

## Requirements

- The `admin_cs_restrict` cvar must be set to `1` in adminmod.cfg
- The countrstrike specific plugin must be installed and loaded
- Restricting or unrestricting requires access level 32.
- Saving or removing map or server default restrictions requires access level 512
- If you wish to save map or default values then the `vault_file` cvar must be set in adminmod.cfg

## Command Access

The easiest way to restrict weapons is to add `amv_enable_beta "menu1"` in adminmod.cfg. This allows you to use the command `admin_restrictmenu` in console and a menu (like the buy menu) appears in game for restricting weapons and items.

The standard method of using plugin commands from the console still works, if you want to enter restrictions manually in console or use the commands in a config file the syntax described in the next section.

## Command Syntax

### admin_restrict

`admin_restrict [ <weapon-name> | <item-name> | menu [<menu-name>|<menu-number>] ]
admin_restrict [ team [ t | ct ] | player <player-id> ] (as above)
admin_restrict [ save | delete ] [ map | default ]
admin_restrict
admin_restrict [ help | on | off | restore | weapons | all ]
`

### admin_unrestrict

`admin_unrestrict [ <weapon-name> | <item-name> | menu [<menu-name>|<menu-number>] ]
admin_unrestrict [ team [ t | ct ] | player <player-id> ] (as above)
admin_unrestrict
admin_unrestrict [ help | weapons | all ]
`

The `admin_unrestrict` commmand uses the same basic syntax for adding or removing restrictions with the exception of the advanced management functions being unavailable. The effects of the arguments are identical except that they cause an unrestriction rather than a restriction. For example `admin_unrestrict` all will unrestrict everything.

- Using the command with no following arguments will print out the current status of restrictions on the server.
- Using `help` as the argument will print information on how to use the plugin.
- Using `team` followed by one of `t` or `ct` will make the restrictions following it apply only to that team. The rest of the command syntax is identical to standard restriction.
- Using `player` followed by a player identification, one of name wonid steamid or uniqueid, will apply the following restrictions commands only to the identified player. The restriction syntax is identical to standard restrictions.
- The argument `save` followed by `map` saves the current restrictions as the default for the current map, if the user has access enough to do so, similarly the `save default` arguments will cause the current restrictions to be the default restrictions on the server. Map restrictions override default restrictions when both are present.
- the argument `delete` will delete either map or default weapon restrictions.
- The `restore` argument causes weapon restrictions to be resotred to the default state for the current map. This means that if there are saved map restrictions they will be used, else if there are default restrictions those will be used, else there will be no restrictions.
- The `on` and `off` commands toggle weapon restrictions on and off respectively.
- The `all` command affects everything available, weapons and items.
- the `weapon` command affects everything except items.

## Weapon and Item restriction

### Weapon And Item Names

To restrict weapons and items the syntax is

`admin_restrict [ <weapon-name> | <item-name> | menu [<menu-name>|<menu-number>] ]`

The unrestriction syntax is identical. The `weapon-name`, `item-name` and `menu-name`s will be explained below.

The list of `weapon-name`s and `item-name`s available for counter-strike is:

glock | usp | p228
deagle | elites | fn57
m3 | xm1014 | mac10
mp5 | ump45 | p90
tmp | gallil | ak47
scout | sg552 | awp
g3sg1 | famas | aug
m4a1 | sg550 | m249
vest | vesthelm | flash
hegren | sgren | defuser
nvgs | shield

The new names for some weapons can also be used. The table below complements the table above, an empty cell means that there is no alternative name to the name above, an entry in the table below can be used in place of the entry in the same position in the table above. For example `glock` can also be known as `9x19mm` but there is no other name for `elites`.

9x19mm | km45 | 229compact
nighthawk |  | fiveseven
12gauge | autoshotgun |
smg |  | c90
mp | defender | cv47
| krieg552 | magnum
d3au1 | clarion | bullup
| krieg550 |

As well as being able to restrict individual weapons and items it is possible to restrict them in menu-names using their menu positions. These `menu-name` names can be used in place of `weapon-name` or `item-name`. Each menu `menu-name` also has a number, these numbers are the menu-name menu entry number. You can use the number instead of the menu-name name when restricting or unrestricting the menu-name.

The menu-name names and numbers available as as follows:

Name (`<menu-name>`) | Number (`<menu-number>`)
--- | ---
pistols | 1
shotguns | 2
smg | 3
rifles | 4
machine guns | 5
equipment | 8

for example if you wanted to restrict all rifles you could either use the command `admin_restrict menu rifles` or `admin_restrict menu 4`. Both will restrict all rifles. Similarly if you wish to unrestrict all rifle usage you could use `admin_unrestrict menu 4` or `admin_unrestrict menu rifles`.

### Examples

This command will prevent all users from using the `12gauge` shotgun.
`admin_restrict 12gauge`

The following commands will restrict all rifles for the duration of the current map only
`admin_restrict menu rifles`
`admin_restrict menu 4`

This command will save the current restrictions as the default restrictions on the server
`admin_restrict save default`

this command will prevent the user whos name is `A User` from using the `mac10` rifle.
`admin_restrict player "A User" mac10`

this command will prevent all terrorists from using the `awp` rifle.
`admin_restrict team t awp`