From 5f2840bf39a6e56dccd8488f419996dbe28678f3 Mon Sep 17 00:00:00 2001 From: jokoho48 Date: Thu, 26 Nov 2015 23:39:17 +0100 Subject: [PATCH] fix that in UGV dont work speedLimiter --- addons/vehicles/XEH_postInit.sqf | 31 +++++++++++++------ .../vehicles/functions/fnc_speedLimiter.sqf | 14 +++++++-- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/addons/vehicles/XEH_postInit.sqf b/addons/vehicles/XEH_postInit.sqf index a8ec2fb75f..16b0bce991 100644 --- a/addons/vehicles/XEH_postInit.sqf +++ b/addons/vehicles/XEH_postInit.sqf @@ -6,16 +6,27 @@ if (!hasInterface) exitWith {}; // Add keybinds ["ACE3 Vehicles", QGVAR(speedLimiter), localize LSTRING(SpeedLimiter), { - // Conditions: canInteract - if !([ACE_player, objNull, ["isnotinside"]] call EFUNC(common,canInteractWith)) exitWith {false}; - // Conditions: specific - if !(ACE_player == driver vehicle ACE_player && - {vehicle ACE_player isKindOf 'Car' || - {vehicle ACE_player isKindOf 'Tank'}}) exitWith {false}; + private _connectedUAV = getConnectedUAV ACE_player; + private _uavControll = UAVControl _connectedUAV; + if ((_uavControll select 1) == "DRIVER") then { + if !(_connectedUAV isKindOf "UGV_01_base_F") exitWith {false}; + GVAR(isUAV) = true; + [_uavControll select 0, _connectedUAV] call FUNC(speedLimiter); + true + } else { + // Conditions: canInteract + if !([ACE_player, objNull, ["isnotinside"]] call EFUNC(common,canInteractWith)) exitWith {false}; + // Conditions: specific + if !(ACE_player == driver vehicle ACE_player && + {vehicle ACE_player isKindOf 'Car' || + {vehicle ACE_player isKindOf 'Tank'}}) exitWith {false}; + + GVAR(isUAV) = false; + // Statement + [ACE_player, vehicle ACE_player] call FUNC(speedLimiter); + true + }; - // Statement - [ACE_player, vehicle ACE_player] call FUNC(speedLimiter); - true }, {false}, -[211, [false, false, false]], false] call cba_fnc_addKeybind; //DELETE Key +[211, [false, false, false]], false] call CBA_fnc_addKeybind; //DELETE Key diff --git a/addons/vehicles/functions/fnc_speedLimiter.sqf b/addons/vehicles/functions/fnc_speedLimiter.sqf index 151c02fd8a..d91e09fe99 100644 --- a/addons/vehicles/functions/fnc_speedLimiter.sqf +++ b/addons/vehicles/functions/fnc_speedLimiter.sqf @@ -36,8 +36,18 @@ _maxSpeed = speed _vehicle max 10; params ["_args", "_idPFH"]; _args params ["_driver", "_vehicle", "_maxSpeed"]; - if (!GVAR(isSpeedLimiter) || {_driver != driver _vehicle}) exitWith { - GVAR(isSpeedLimiter) = false; + if (GVAR(isUAV)) then { + private _uavControll = UAVControl _vehicle; + if ((_uavControll select 0) != _driver) then { + GVAR(isSpeedLimiter) = false; + }; + } else { + if (_driver != driver _vehicle) then { + GVAR(isSpeedLimiter) = false; + }; + }; + + if (!GVAR(isSpeedLimiter)) exitWith { [_idPFH] call CBA_fnc_removePerFrameHandler; };