diff --git a/dayz_code/actions/lock_veh.sqf b/dayz_code/actions/lock_veh.sqf index 2f32f4c56..2025b7cd5 100644 --- a/dayz_code/actions/lock_veh.sqf +++ b/dayz_code/actions/lock_veh.sqf @@ -5,13 +5,16 @@ if(TradeInprogress) exitWith { cutText ["Lock vehicle already in progress." , "P TradeInprogress = true; {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = []; +s_player_lockUnlock_crtl = 1; + +dayzLockVehicle = [_vehicle,true]; +if(player distance _vehicle < 10) then { + if (local _vehicle) then { + dayzLockVehicle spawn local_lockUnlock + } else { + publicVariable "dayzLockVehicle"; + }; +}; + s_player_lockUnlock_crtl = -1; - -_vehicle setVehicleInit "this lock true; this lockCargo true;"; -processInitCommands; - -//_vehicle lock true; -//dayzLockVehicle = [_vehicle,true]; -//publicVariable "dayzLockVehicle"; - TradeInprogress = false; \ No newline at end of file diff --git a/dayz_code/actions/unlock_veh.sqf b/dayz_code/actions/unlock_veh.sqf index 40452f968..8e13723cb 100644 --- a/dayz_code/actions/unlock_veh.sqf +++ b/dayz_code/actions/unlock_veh.sqf @@ -1,13 +1,20 @@ private["_vehicle"]; _vehicle = _this select 3; +if(TradeInprogress) exitWith { cutText ["Lock vehicle already in progress." , "PLAIN DOWN"]; }; +TradeInprogress = true; + {player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = []; +s_player_lockUnlock_crtl = 1; + +dayzLockVehicle = [_vehicle,false]; +if(player distance _vehicle < 10) then { + if (local _vehicle) then { + dayzLockVehicle spawn local_lockUnlock + } else { + publicVariable "dayzLockVehicle"; + }; +}; + s_player_lockUnlock_crtl = -1; - -_vehicle setVehicleInit "this lock false; this lockCargo false;"; -processInitCommands; - -// Wiki states that lock is globally brodcast but the variable has to be local -//_vehicle lock false; -//dayzLockVehicle = [_vehicle,false]; -//publicVariable "dayzLockVehicle"; +TradeInprogress = false; \ No newline at end of file