fn_checkGear.sqf 804 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. Name: cTab_fnc_checkGear
  3. Author(s):
  4. Gundy
  5. Description:
  6. Check a units gear for certain items
  7. Parameters:
  8. 0: OBJECT - Unit object to check gear on
  9. 1: ARRAY - Array of item names to search for
  10. Returns:
  11. BOOLEAN - If at least one of the items passed in parameter 1 was found or not
  12. Example:
  13. _playerHasCtabItem = [player,["ItemcTab","ItemAndroid","ItemMicroDAGR"]] call cTab_fnc_checkGear;
  14. */
  15. private ["_unit","_items","_chk_all_items"];
  16. _unit = _this select 0;
  17. _items = _this select 1;
  18. _chk_all_items = items _unit;
  19. _chk_all_items append (assignedItems _unit);
  20. _chk_all_items pushBack (goggles _unit);
  21. // Some "units" don't return assignedItems, for example the Headquater module
  22. if (isNil "_chk_all_items") exitWith {false};
  23. {_x in _chk_all_items} count _items > 0