ACE3/addons/common/functions/fnc_getWeaponIndex.sqf
Phyma ffaa195fe5 Conform function headers to coding guidelines (#5255)
* Fixed headers to work with silentspike python script

* Fixed rest of the files

* Fixed ace-team
2017-06-08 15:31:51 +02:00

32 lines
515 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
*
* Example:
* [bob, "gun"] call ace_common_fnc_getWeaponIndex
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit", "_weapon"];
if (_weapon == "") exitWith {-1};
[
primaryWeapon _unit,
secondaryWeapon _unit,
handgunWeapon _unit
] find _weapon // return