From 01ee35d6c56eb2f066b3ba4626141e68782f3bdc Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sun, 1 Feb 2015 13:09:17 -0600 Subject: [PATCH] Geforces: Fix "Error Zero divisor" Adds some simple checks before dividing. Before dropping uniform or playing as a dog would throw script error. --- addons/gforces/functions/fnc_pfhUpdateGForces.sqf | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf index afee7579cd..f45d629760 100644 --- a/addons/gforces/functions/fnc_pfhUpdateGForces.sqf +++ b/addons/gforces/functions/fnc_pfhUpdateGForces.sqf @@ -60,7 +60,15 @@ if (count GVAR(GForces) > 0) then { _classCoef = ACE_player getVariable ["ACE_GForceCoef", getNumber (configFile >> "CfgVehicles" >> (typeOf ACE_player) >> "ACE_GForceCoef")]; -_suitCoef = getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef"); +_suitCoef = if ((uniform ACE_player) != "") then { + getNumber (configFile >> "CfgWeapons" >> (uniform ACE_player) >> "ACE_GForceCoef") +} else { + 1 +}; + +//Fix "Error Zero divisor" +if (_classCoef == 0) then {_classCoef = 0.001}; +if (_suitCoef == 0) then {_suitCoef = 0.001}; _gBlackOut = MAXVIRTUALG / _classCoef + MAXVIRTUALG / _suitCoef - MAXVIRTUALG; _gRedOut = MINVIRTUALG / _classCoef;