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|
|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
|See also:||fn vbs selectedWeaponType, isWeaponOnBack, fn vbs weapon on back|