Jump to content
  • 0

Restoring Keys under 1.0.2.5


Nekuan

Question

Hey, can anyone tell me how i can restore lost vehicle keys under 1.0.2.5? 
I used to be able to do that by accessing the ItemKeys.hpp file inside the dayz_code.pbo but after the update this file seems to have been relocated. 

Can anyone tell me the new location or how to restore keys in another way?

Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0

You should not be directly accessing this file as when we binarize the pbo it does not exist any longer. If you must give the player a key make them do a little work by giving them a hotwire kit instead so they can unlock it and go sell and buy back the car to get a new key. Other than that you will need to perform the lookup manually via the source code.

Link to comment
Share on other sites

  • 0

The script from sorry188 isn't working for me, I've just tested it with my new bought car has the ID 2285 but _result is "any" that is weird! Should be ItemKeyGreen2285 with that code!? :o

 

Ok fixed it myself, if anyone wants to know variables in arma scripts have to be defined before you can use them... (like in "c" or whatever, I thought it would work without it like many other script languages but I guess not).

I also added some checks if the target is a vehicle first and declared all variables in the script private like you should:

private ["_ct","_id","_result","_inventory","_backpack"];

_ct = cursorTarget;
if (_ct isKindOf "LandVehicle" OR _ct isKindOf "Helicopter" OR _ct isKindOf "Plane" OR _ct isKindOf "Ship") then
{
	_id = _ct getVariable ["CharacterID","0"];
	_id = parsenumber _id;
	_result = "ItemKey";
	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["ItemKeyBlack%1",_id-10000];};
	
	cutText [format["id = %1, result = %2",_id,_result], "PLAIN"];

	_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"];
	};
};

Edited by Axe Cop
Link to comment
Share on other sites

  • 0

Axe Cop, feel like this is a silly question, but just getting started, where would I put this or set this up?

Yeah dude, thats not a simple question! :D You actually just need to run there script somehow and that the problem, you need like an admin tool with a permission system so only admins can run the script not every player :D

if you just want 1 or 2 scripts like this as admin tools you can do it without any tools, but I would suggest use another admin tool and just add this script to the menu like I did. 

I use a modified version of the blue phoenix admin tools on my server, you need to be careful that you won't open to many door for hackers when using something like that: https://github.com/BluePhoenix175/DayZ-Admin-Tools-

Still a tool like that is not easy to install if you don't know how ArmA scripting or DayZ works, just saying :)

Link to comment
Share on other sites

  • 0

Thanks for the reply, believe me I know, I've struggled trying to setup those admin tools for my Epoch server without help, going to try and find more or better tutorials for it later this week since I'm transferring hosts tomorrow most likely. Thanks for the link though, really helpful.

Link to comment
Share on other sites

  • 0

Hey, can anyone tell me how i can restore lost vehicle keys under 1.0.2.5? 

I used to be able to do that by accessing the ItemKeys.hpp file inside the dayz_code.pbo but after the update this file seems to have been relocated. 

Can anyone tell me the new location or how to restore keys in another way?

 

 

im assuming you have access to the DB.  in which case the simplest method i have found is what MGT mentioned

 

I use this http://privatehivetools.n8m4re.de/carkey.php

 

Paste in the vehicle number and it gives you the key to add to your toolbelt items via database.

 

 

a similar method is to find a key / vehicle combo that works and just plaste the characterID into the vehicle with a lost key.  This has also made is possible to make a 'magic' key.  for simplicity I offer players the option to change all of their vehicles over to one key, for a 10oz gold on each car.  

 

Just wish I had the scripting knowledge to create a locksmithing script...

Link to comment
Share on other sites

  • 0

im assuming you have access to the DB.  in which case the simplest method i have found is what MGT mentioned

 

 

 

a similar method is to find a key / vehicle combo that works and just plaste the characterID into the vehicle with a lost key.  This has also made is possible to make a 'magic' key.  for simplicity I offer players the option to change all of their vehicles over to one key, for a 10oz gold on each car.  

 

Just wish I had the scripting knowledge to create a locksmithing script...

Im abit confused your saying you make all the cars you want have the same characterID  and then the one key works for all of them ?? this sounds sweet

Link to comment
Share on other sites

  • 0

I don't use those admin tools you have to pay for, so I can't add the script to a menu. I have the Epoch Hive Tools that will let you enter a key number, such as ItemKeyBlue1234, or the vehicle ID, like 8456, but I need to know how I can find out the "ItemKeyColorXXXX" based on the in-game key name, like "Blue Key ab4c"... anyway to do this?

Link to comment
Share on other sites

  • 0

All the keys are defined in the config file ItemKeys.hpp : https://raw.github.com/vbawol/DayZ-Epoch/master/SQF/dayz_code/Configs/CfgWeapons/Item/ItemKeys.hpp

but i don't see any releation between the keyid and the hex code in the name!? maybe it is some weird number code or just plain random :D

the real question would be what do you want with that? it is only the display name and never used for anything (only to differentiate the keys for the player)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...