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




Introduced in

Version:1.31

Description

Description:

Returns the type of weapon the unit is currently using. Does not return the class name of the weapon used, but rather whether it is the primary weapon (for example, a rifle), secondary weapon (for example, launcher) or a handgun.

If the specified object is not a unit, or if the unit is unarmed or in a vehicle, or the weapon is on the back or holstered, then "NONE" is returned.

Note: Before V3.4, not reliable for launchers or pistols held in the safety position.

Syntax

Syntax:unit call fn_vbs_selectedWeaponType
Parameters:
Return Value:String - One of "PRIMARY", "SECONDARY", "PISTOL", "NONE".

Warning

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.

Examples

Examples:
_weap = player call fn_vbs_selectedWeaponType;

Additional Information

See also: primaryWeapon, secondaryWeapon, PistolWeapon
Multiplayer: 
Problems: 

Notes