Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




Introduced in

Version:1.31

Description

Description:

Returns the type of weapon the unit is currently using. Does not return the

classname

class name of the weapon used, but rather whether it

's

is the primary weapon (

e.g.

for example, a rifle), secondary weapon (

e.g.

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

, not reliable for launchers or pistols held in

"safe"

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