fn_unslingHelmet.sqf 806 B

12345678910111213141516171819202122
  1. _unit = _this select 0;
  2. _helmetAttached = _unit getVariable ["GEARF_HelmetAttached", false];
  3. _helmetCurrent = headgear _unit;
  4. if (_helmetCurrent != "") then {
  5. if (_unit canAddItemToBackpack _helmetCurrent) then {
  6. _unit addItemToBackpack _helmetCurrent;
  7. } else {
  8. if (_helmetAdditional != "") then {
  9. _helmetHolder = "GroundWeaponHolder" createVehicle position _unit;
  10. _helmetHolder addItemCargoGlobal [_helmetCurrent, 1];
  11. systemChat "Not enough space to add addtional headgear to inventory, dropped on ground.";
  12. };
  13. };
  14. };
  15. _helmet = _unit getVariable ["GEARF_HelmetAttachedClass", false];
  16. _unit addHeadgear _helmet;
  17. _unit setVariable ["GEARF_HelmetAttached", false];
  18. {
  19. if (typeOf _x == "GroundWeaponHolder") then {deleteVehicle _x};
  20. } forEach (attachedObjects _unit);