ACE3/addons/common/functions/fnc_getWeaponIndex.sqf

26 lines
420 B
Plaintext
Raw Normal View History

/*
* Author: commy2
* Get the index of the weapon.
* 0 = primary, 1 = secondary, 2 = handgun, -1 = other
*
* Argument:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return value:
* Weapon index <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
2015-05-14 18:06:06 +00:00
PARAMS_2(_unit,_weapon);
2015-02-13 02:43:50 +00:00
if (_weapon == "") exitWith {-1};
2015-02-12 14:57:55 +00:00
[
primaryWeapon _unit,
secondaryWeapon _unit,
handgunWeapon _unit
] find _weapon