DayZ Epoch Script - Generate Key for selected Vehicle
Posts 1–3 of 3 · Page 1 of 1
DayZ Epoch Script - Generate Key for selected Vehicle
I do not take credit for this.
Haven't tried it.
Simply walk up to a car that has been bought from an NPC and execute the script. You should receive a key to open it.
Code:
private ["_ct","_id","_result","_inventory","_backpack"];
_ct = cursorTarget;
if (!isNull _ct) then {
if (_ct distance player > 12) exitWith {cutText [format["%1 is to far away.",typeOF _ct], "PLAIN"];};
if !((_ct isKindOf "LandVehicle") || (_ct isKindOf "Air") || (_ct isKindOf "Ship")) exitWith {cutText [format["%1 is not a vehicle..",typeOF _ct], "PLAIN"];};
_id = _ct getVariable ["CharacterID","0"];
_id = parsenumber _id;
if (_id == 0) exitWith {cutText [format["%1 has ID 0 - No Key possible.",typeOF _ct], "PLAIN"];};
if ((_id > 0) && (_id <= 2500)) then {_result = format["ItemKeyGreen%1",_id];};
if ((_id > 2500) && (_id <= 5000)) then {_result = format["ItemKeyRed%1",_id-2500];};
if ((_id > 5000) && (_id <= 7500)) then {_result = format["ItemKeyBlue%1",_id-5000];};
if ((_id > 7500) && (_id <= 10000)) then {_result = format["ItemKeyYellow%1",_id-7500];};
if ((_id > 10000) && (_id <= 12500)) then {_result = format["ItemKeyRed%1",_id-10000];};
_inventory = (weapons player);
_backpack = ((getWeaponCargo unitbackpack player) select 0);
if (_result in (_inventory+_backpack)) then
{
if (_result in _inventory) then {cutText [format["Key [%1] already in your inventory!",_result], "PLAIN"];};
if (_result in _backpack) then {cutText [format["Key [%1] already in your backpack!",_result], "PLAIN"];};
}
else
{
player addweapon _result;
cutText [format["Key [%1] added to inventory!",_result], "PLAIN"];
};
};