return key name used to unlock take 2

This commit is contained in:
[VB]AWOL
2013-11-24 15:26:11 -06:00
parent 1af7d7f08f
commit 14da78a843
2 changed files with 10 additions and 17 deletions

View File

@@ -1,5 +1,6 @@
private["_vehicle"];
_vehicle = _this select 3;
private["_vehicle","_key"];
_vehicle = (_this select 3) select 0;
_key = (_this select 3) select 1;
if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_37") , "PLAIN DOWN"]; };
TradeInprogress = true;
@@ -14,6 +15,8 @@ if(player distance _vehicle < 10) then {
} else {
publicVariable "PVDZE_veh_Lock";
};
cutText [format["[%1] used to unlock vehicle.",_key], "PLAIN"];
};
s_player_lockUnlock_crtl = -1;

View File

@@ -4,7 +4,7 @@ scriptName "Functions\misc\fn_selfActions.sqf";
- Function
- [] call fnc_usec_selfActions;
************************************************************/
private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_resultKeyname","_resultKeyname2","_ownerIDname","_isModular"];
private ["_isWreckBuilding","_temp_keys","_magazinesPlayer","_isPZombie","_vehicle","_inVehicle","_hasFuelE","_hasRawMeat","_hasKnife","_hasToolbox","_onLadder","_nearLight","_canPickLight","_canDo","_text","_isHarvested","_isVehicle","_isVehicletype","_isMan","_traderType","_ownerID","_isAnimal","_isDog","_isZombie","_isDestructable","_isTent","_isFuel","_isAlive","_Unlock","_lock","_buy","_dogHandle","_lieDown","_warn","_hastinitem","_allowedDistance","_menu","_menu1","_humanity_logic","_low_high","_cancel","_metals_trader","_traderMenu","_isWreck","_isRemovable","_isDisallowRepair","_rawmeat","_humanity","_speed","_dog","_hasbottleitem","_isAir","_isShip","_playersNear","_findNearestGens","_findNearestGen","_IsNearRunningGen","_cursorTarget","_isnewstorage","_itemsPlayer","_ownerKeyId","_typeOfCursorTarget","_hasKey","_oldOwner","_combi","_key_colors","_player_deleteBuild","_player_flipveh","_player_lockUnlock_crtl","_player_butcher","_player_studybody","_player_cook","_player_boil","_hasFuelBarrelE","_hasHotwireKit","_player_SurrenderedGear","_isSurrendered","_isModular","_ownerKeyName","_temp_keys_names"];
if (TradeInprogress) exitWith {}; // Do not allow if any script is running.
@@ -132,11 +132,14 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_itemsPlayer = items player;
_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 = getNumber(configFile >> "CfgWeapons" >> _x >> "displayName");
_temp_keys_names set [_ownerKeyId,_ownerKeyName];
_temp_keys set [count _temp_keys,str(_ownerKeyId)];
};
} forEach _itemsPlayer;
@@ -240,20 +243,7 @@ if (!isNull cursorTarget and !_inVehicle and !_isPZombie and (player distance cu
_oldOwner = (_ownerID == dayz_playerUID);
if(locked _cursorTarget) then {
if(_hasKey or _oldOwner) then {
_Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",_cursorTarget, 2, true, true, "", ""];
//return the key name which unlocked the vehicle adapted from Axe Cop
_ownerIDname = parsenumber _ownerID;
_resultKeyname = "ItemKey";
if (_ownerIDname == 0) exitWith {cutText [format["%1 has ID 0 - No Key possible.",typeOF _cursorTarget], "PLAIN"];};
if ((_ownerIDname > 0) && (_ownerIDname <= 2500)) then {_resultKeyname = format["ItemKeyGreen%1",_ownerIDname];};
if ((_ownerIDname > 2500) && (_ownerIDname <= 5000)) then {_resultKeyname = format["ItemKeyRed%1",_ownerIDname-2500];};
if ((_ownerIDname > 5000) && (_ownerIDname <= 7500)) then {_resultKeyname = format["ItemKeyBlue%1",_ownerIDname-5000];};
if ((_ownerIDname > 7500) && (_ownerIDname <= 10000)) then {_resultKeyname = format["ItemKeyYellow%1",_ownerIDname-7500];};
if ((_ownerIDname > 10000) && (_ownerIDname <= 12500)) then {_resultKeyname = format["ItemKeyRed%1",_ownerIDname-10000];};
_resultKeyname2 = getText (configFile >> "CfgWeapons" >> _resultKeyname >> "displayName");
{cutText [format["[%1] used to unlock vehicle.",_resultKeyname2], "PLAIN"];};
_Unlock = player addAction [format["Unlock %1",_text], "\z\addons\dayz_code\actions\unlock_veh.sqf",[_cursorTarget,(_temp_keys_names select _ownerID)], 2, true, true, "", ""];
s_player_lockunlock set [count s_player_lockunlock,_Unlock];
s_player_lockUnlock_crtl = 1;
} else {