fix that in UGV dont work speedLimiter

This commit is contained in:
jokoho48 2015-11-26 23:39:17 +01:00
parent 52a6eddb44
commit 5f2840bf39
2 changed files with 33 additions and 12 deletions

View File

@ -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

View File

@ -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;
};