From 33fd92db67a87dbfee8b52ee2198dbc870b4f470 Mon Sep 17 00:00:00 2001 From: oiad Date: Sat, 25 Feb 2017 10:58:16 +1300 Subject: [PATCH] Extend epoch_tempKeys to be able to read from backpack as well. (#1897) * Extend epoch_tempKeys to be able to read from backpack as well. * Rework --- SQF/dayz_code/compile/epoch_tempKeys.sqf | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/SQF/dayz_code/compile/epoch_tempKeys.sqf b/SQF/dayz_code/compile/epoch_tempKeys.sqf index 07ea3b9cf..da1d36fae 100644 --- a/SQF/dayz_code/compile/epoch_tempKeys.sqf +++ b/SQF/dayz_code/compile/epoch_tempKeys.sqf @@ -1,6 +1,19 @@ -private ["_temp_keys","_temp_keys_names","_key_colors","_ownerKeyId","_ownerKeyName"]; +/* + To return array of keys on the players toolbelt and inside a (valid) backpack: + _result = call epoch_tempKeys; + Returns array: [["11148","1457"],["Black Key (2eb5)","Green Key (9c30)"]] +*/ + +private ["_temp_keys","_temp_keys_names","_key_colors","_ownerKeyId","_ownerKeyName","_items"]; + _temp_keys = []; _temp_keys_names = []; +_items = items player; +dayz_myBackpack = unitBackpack player; + +if (!isNull dayz_myBackpack) then { + _items = _items + ((getWeaponCargo dayz_myBackpack) select 0); +}; _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]; @@ -9,8 +22,8 @@ _key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKe _ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid"); _ownerKeyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName"); _temp_keys_names set [count _temp_keys_names,_ownerKeyName]; - _temp_keys set [count _temp_keys,str(_ownerKeyId)]; + _temp_keys set [count _temp_keys,str _ownerKeyId]; }; -} count (items player); +} count _items; [_temp_keys,_temp_keys_names] \ No newline at end of file