ACE3/addons/scopes/functions/fnc_getOptics.sqf

33 lines
644 B
Plaintext
Raw Permalink Normal View History

#include "..\script_component.hpp"
/*
* Author: commy2
* Gets the optic classnames of all currently equipped weapons.
*
* Arguments:
* 0: Unit <OBJECT>
*
* Return Value:
* 0: Optic of primary <STRING>
* 1: Optic of secondary <STRING>
* 2: Optic of handgun <STRING>
*
2015-08-07 14:43:06 +00:00
* Example:
* [player] call ace_scopes_fnc_getOptics
*
* Public: No
*/
2015-08-07 14:43:06 +00:00
params ["_unit"];
private _optics = ["", "", ""];
if !(_unit isKindOf "CAManBase") exitWith {_optics};
{
if (count _x >= 2) then {
2015-08-07 14:43:06 +00:00
_optics set [_forEachIndex, _x select 2];
};
2015-08-08 22:41:43 +00:00
} forEach [primaryWeaponItems _unit, secondaryWeaponItems _unit, handgunItems _unit];
2015-08-07 14:43:06 +00:00
_optics