player addEventHandler ["InventoryOpened", {_this call EPOCH_startInteract; true}];
EPOCH_startInteract = { player action ["Gear", (_this select 1)]};
OR
player addEventHandler ["InventoryOpened", {call EPOCH_startInteract}];
EPOCH_startInteract = {
_handled = false;
_targets = nearestObjects[getPosATL player, ["WeaponHolder","WeaponHolderSimulated"], 2];
if ((count _targets) > 0) then {
_target = _targets select 0;
if (!isNull _target) then {
player action ["Gear", _target];
_handled = true;
};
};
_handled
};