Дмитрий:
if (!isNil "infLauncherAmmoEH") then {
player removeEventHandler ["FiredMan", infLauncherAmmoEH];
};
infLauncherAmmoEH = player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine"];
if (_weapon == secondaryWeapon _unit) then {
[_unit, _weapon, _magazine, _muzzle] spawn {
params ["_unit", "_weapon", "_magazine", "_muzzle"];
uiSleep 0.2;
_unit addWeaponItem [
_weapon,
[_magazine, 1, _muzzle],
true
];
};
};
}];
hint "Infinite Carl Gustaf ammo ON";
if (!isNil "shotRangeEH") then {
player removeEventHandler ["FiredMan", shotRangeEH];
};
shotRangeEH = player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile"];
private _startPos = getPosASL _projectile;
[_projectile, _startPos] spawn {
params ["_projectile", "_startPos"];
private _lastPos = _startPos;
private _startTime = time;
while {!isNull _projectile} do {
_lastPos = getPosASL _projectile;
uiSleep 0.01;
};
private _range2D = _startPos distance2D _lastPos;
private _range3D = _startPos distance _lastPos;
private _flightTime = time - _startTime;
hintSilent format [
"SHOT DATA\n\nRange: %1 m\n3D distance: %2 m\nFlight time: %3 s",
round _range2D,
round _range3D,
(_flightTime toFixed 2)
];
systemChat format [
"Range: %1 m | Flight time: %2 s",
round _range2D,
(_flightTime toFixed 2)
];
};
}];
hint "Shot range meter ON";