ACE3/addons/common/functions/fnc_getWeaponIndex.sqf
2015-09-21 13:08:10 +02:00

29 lines
449 B
Plaintext

/*
* Author: commy2
* Get the index of the weapon.
*
* Arguments:
* 0: Unit <OBJECT>
* 1: Weapon <STRING>
*
* Return Value:
* Weapon index <NUMBER>
* 0 = primary
* 1 = secondary
* 2 = handgun
* -1 = other
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_weapon"];
if (_weapon == "") exitWith {-1};
[
primaryWeapon _unit,
secondaryWeapon _unit,
handgunWeapon _unit
] find _weapon // return