Page tree
Skip to end of metadata
Go to start of metadata

Introduced in




Controls the currently active weapon type.

If the unit is currently using a type which is not allowed, then that weapon is holstered / shouldered, and the unit switches to an allowed type (if equipped with one). An appropriate switching animation is played during the action.

The function has no lasting effect - the player could switch right back to a prohibited weapon, after the function switches them to a permitted one.

More than one weapon type is allowed.


Syntax:[unit, allowRifle, allowPistol, allowLauncher, allowUnarmed] call fn_vbs_equipAllowedWeapon
  • unit: Object - The unit to control.
  • allowRifle: Boolean - If true, then rifles are allowed.
  • allowPistol: Boolean -If true, then handguns are allowed.
  • allowLauncher: Boolean - If true, then launchers are allowed.
  • allowUnarmed: Boolean - If true, then the unit can be unarmed.
Return Value:String - The name of the animation the unit switches to, or an empty string ("") in case no switching is needed (or if the unit is not local).


When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.


Player switches to rifle:
_ret = [player, true, false, false, false] call fn_vbs_equipAllowedWeapon
Player switches to handgun, if present, or to unarmed:
_ret = [player, false, true, false, true] call fn_vbs_equipAllowedWeapon

Additional Information

See also: fn vbs selectedWeaponType, isWeaponOnBack, fn vbs weapon on back