diff --git a/addons/common/functions/fnc_limitMovementSpeed.sqf b/addons/common/functions/fnc_limitMovementSpeed.sqf index 33af15d3a4..e8e17eb21f 100644 --- a/addons/common/functions/fnc_limitMovementSpeed.sqf +++ b/addons/common/functions/fnc_limitMovementSpeed.sqf @@ -17,25 +17,25 @@ if (count _this > 1) then { _fallDown = _this select 1; }; -if ((_vehicle getvariable [QGVAR(limitMovementSpeed),false])) exitwith { - _vehicle setvariable [QGVAR(limitMovementSpeed),nil,true]; +if ((_unit getvariable [QGVAR(limitMovementSpeed),false])) exitwith { + _unit setvariable [QGVAR(limitMovementSpeed),nil,true]; }; -{ +[{ private["_unit","_fallDown","_carriedObj"]; _unit = (_this select 0) select 0; _fallDown = (_this select 0) select 1; - _carriedObj = [_unit] call FUNC(getCarriedObj) + _carriedObj = [_unit] call FUNC(getCarriedObj); - if !(_vehicle getvariable [QGVAR(limitMovementSpeed),false]) exitwith { + if !(_unit getvariable [QGVAR(limitMovementSpeed),false]) exitwith { [(_this select 1)] call cba_fnc_removePerFrameHandler; }; if !((!isNull _carriedObj) && (alive _unit)) exitwith { [(_this select 1)] call cba_fnc_removePerFrameHandler; }; - if (speed _unit > 12 && vehicle _unit == _unit && isTouchingGround) then { + if (speed _unit > 12 && vehicle _unit == _unit && isTouchingGround _unit) then { _unit setVelocity [0,0,0]; diff --git a/addons/common/functions/fnc_limitSpeed.sqf b/addons/common/functions/fnc_limitSpeed.sqf index 63c855f69f..7062d43736 100644 --- a/addons/common/functions/fnc_limitSpeed.sqf +++ b/addons/common/functions/fnc_limitSpeed.sqf @@ -21,7 +21,7 @@ if ((_vehicle getvariable [QGVAR(limitSpeed_f),false])) then { if (_maxSpeed < 0) exitwith {}; _vehicle setvariable [QGVAR(limitSpeed_f),true,true]; -{ +[{ private["_vehicle","_maxSpeed","_speed","_x","_y","_z", "_diff","_percentage","_newVelocity","_velocity"]; _vehicle = (_this select 0) select 0; _maxSpeed = (_this select 0) select 1;