diff --git a/SQF/dayz_code/compile/epoch_tempKeys.sqf b/SQF/dayz_code/compile/epoch_tempKeys.sqf index 87fba19c7..07ea3b9cf 100644 --- a/SQF/dayz_code/compile/epoch_tempKeys.sqf +++ b/SQF/dayz_code/compile/epoch_tempKeys.sqf @@ -1,14 +1,16 @@ private ["_temp_keys","_temp_keys_names","_key_colors","_ownerKeyId","_ownerKeyName"]; _temp_keys = []; _temp_keys_names = []; -// find available keys + _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]; + { if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in _key_colors) then { _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid"); _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName"); - _temp_keys_names set [_ownerKeyId,_ownerKeyName]; + _temp_keys_names set [count _temp_keys_names,_ownerKeyName]; _temp_keys set [count _temp_keys,str(_ownerKeyId)]; }; } count (items player); + [_temp_keys,_temp_keys_names] \ No newline at end of file diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 767a9d82c..588aa560e 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -120,10 +120,11 @@ if (_inVehicle) then { _temp_keys_names = _totalKeys select 1; _hasKey = _vehicleOwnerID in _temp_keys; _oldOwner = (_vehicleOwnerID == _uid); + _text = getText (configFile >> "CfgVehicles" >> (typeOf DZE_myVehicle) >> "displayName"); if (locked DZE_myVehicle) then { if (_hasKey || _oldOwner) then { - _unlock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[DZE_myVehicle,(_temp_keys_names select (parseNumber _vehicleOwnerID))], 2, false, true]; + _unlock = DZE_myVehicle addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[DZE_myVehicle,(_temp_keys_names select (_temp_keys find _vehicleOwnerID))], 2, false, true]; s_player_lockUnlockInside set [count s_player_lockUnlockInside,_unlock]; s_player_lockUnlockInside_ctrl = 1; } else { @@ -692,7 +693,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur _oldOwner = (_characterID == _uid); if (locked _cursorTarget) then { if (_hasKey || _oldOwner) then { - _unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (parseNumber _characterID))], 2, true, true]; + _unlock = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select (_temp_keys find _characterID))], 2, true, true]; s_player_lockunlock set [count s_player_lockunlock,_unlock]; s_player_lockUnlock_crtl = 1; } else {