Jump to content

[RELEASE] Vehicle Key Changer - For making Masterkey - V 1.4.1 (Updated for Epoch 1.0.6)


Grahame

Recommended Posts

I take no credit for this mod created by @OtterNas3, I have simply made the few small changes necessary for it to work on Epoch 1.0.6 servers. See the following thread for more details:

https://epochmod.com/forum/topic/5972-release-vehicle-key-changer-for-making-masterkey-v-14-updated-06152014/

UPDATE, 01072017: Added Tank class vehicles to those able to be claimed and unlocked

Instructions:

(1) Download the new archive from dropbox

(2) Download and unpack your mission file.

   (a) Copy the contents of custom/VehicleKeyChanger to a custom/VehicleKeyChanger folder in your mission file.

   (b) Open your missions init.sqf in your editor of choice. Find the line that reads,

	//[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";

and add the following line after it:

	_nil = [] execVM "custom\VehicleKeyChanger\VehicleKeyChanger_init.sqf";

(3) Repack the mission file and upload it back to your server.

(4) Download your dayz_server PBO file and unpack it. Copy the server_updateObject.sqf file in the downloaded archive to the compile folder in there.

(5) Repack the dayz_server.pbo and upload it to your server.

You are good to go. For config and other options see the original thread listed above.

Link to comment
Share on other sites

This works but I have a bug - I Installed the mod to my test box - Overpoch 1.0.6b with WAI, service points, deploy anything, logistic tow/lift installed - no infistar etc - and I got a failure to change key, refunding bar, contact admin etc message when trying to change key for a vehicle and when trying to claim a map-spawned vehicle.

this was in the server-side RPT, some of this might be unrelated but it was all within a second or so: 

Spoiler

21:28:43 "DELETE: Player B 1-1-B:1 (_Lance_) REMOTE deleted object with ID: 378"
21:28:43 "HIVE: WRITE: VEHICLE KEY CHANGER: "CHILD:308:11:MTVR:0.024:7695:[43.5796,[4301.44,11208.6,0.00534058]]:[[["Makarov_SD_DZ","m16a4","M4A1_AIM_SD_camo","M16A4_ACOG_DZ","M14_CCO_DZ","SA58_ACOG_DZ","AKS74U_DZ","M1911_DZ","ItemEtool","Sa61_EP1","Revolver_DZ","SA58_DZ","G17_DZ","ItemToolbox","Mk48_CCO_DZ","Binocular_Vector","M110_NVG_EP1","L85_Holo_DZ","Sa58V_RCO_EP1","SCAR_L_STD_Mk4CQT","m8_carbine","DMR_DZ","SCAR_L_STD_HOLO","M4A3_CCO_EP1","M249_DZ","ItemGPS","ItemKeyKit","VSS_vintorez"],[1,4,4,2,1,1,1,1,1,1,1,1,1,4,2,4,3,1,4,1,2,1,1,1,1,1,1,1]],[["CinderBlocks","ItemPlank","MAAWS_HEAT","ItemTrashPaperMusic","20Rnd_B_AA12_74Slug","FoodPistachio","Skin_USMC_Soldier_Pilot_DZ","Skin_GUE_Soldier_MG_DZ","ItemBandage","ItemMorphine","Attachment_SCOPED","ItemJerrycan","FoodCanCurgon","Attachment_FL","100Rnd_556x45_M249","FoodChipsChocolate","Attachment_Sup9","75Rnd_762x39_RPK","75Rnd_545x39_RPK","20Rnd_B_765x17_Ball","6Rnd_45ACP","Attachment_SA58RIS","FoodCanFraggleos","Skin_US_Soldier_EP1_DZ","17Rnd_9x19_gloc
21:28:43 "HIVE: WRITE: VEHICLE KEY CHANGER: Vehicle:24056080# 1061240: mtvr.p3d NewKey:Yellow Key (8c90) BY _Lance_(7656xxxxxxxxxxxxxx)"
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""
21:28:43 "HIVE: READ: VEHICLE KEY CHANGER: "CHILD:388:45194411209218:""
21:28:43 "CUSTOM: VEHICLE KEY CHANGER: trying again to get id for: "45194411209218""

I rebooted the server to clear the logs and when I logged back in it HAD in fact changed to the other key I had specified, and claimed the heli - BUT - the heli I claimed created a duplicate of itself in place which exploded. Any ideas?

 

Link to comment
Share on other sites

I have seen the repeated messages once... I think it's an issue when the server is busy (I think, I had the issue when my server had been up for 12 hours). I had to remove the sleep()s in the code. Thinking maybe I need to add uisleep() and see whether that is allowed. The sleep() in the check loops cause an error which stopped the mod from working.

Link to comment
Share on other sites

3 minutes ago, Grahame said:

I have seen the repeated messages once... I think it's an issue when the server is busy (I think, I had the issue when my server had been up for 12 hours). I had to remove the sleep()s in the code. Thinking maybe I need to add uisleep() and see whether that is allowed. The sleep() in the check loops cause an error which stopped the mod from working.

Seems legit - I'm happy to test anything you're willing to edit, and thanks for working on this by the way. Here we are just under 30 days from release and 90% of the working 1.0.5 mods have been adapted for 1.0.6 - good stuff!

Link to comment
Share on other sites

Not a problem at all, doing this for myself as much as anyone else :ph34r:

Masterkeys should be a core part of Epoch IMO, when you have five vics in a group and you're trying to remember which key is for what vehicle ("Was that MTVR Blue Key (26d7) or Blue Key (efff)? Where did I put my notepad?"... Either that or use the door code for vics too and allow friending of vehicles to other group members

Link to comment
Share on other sites

1 minute ago, _Lance_ said:

Hey, maybe it'll make 1.0.7 :D

I'm going to raise an issue on GitHub... easy addition that could be turned on/off by config variable. Question is whether @OtterNas3 would be okay with it.

On my server btw, have now changed over ten vehicles to one key. Also claimed spawned vehicles to test that (will not have that on by default on the server). Have seen two glitches when the request to the DB times out... the issue mentioned above. Then on restart the vics disappeared (the code deletes then creates a new vehicle so if it can not create the new one...). Think this issue is related to the removal of the sleeps. Will play with it tomorrow but we're most of the way there.

 

Link to comment
Share on other sites

TESTED AND WORKING! Installed by directions and edited script to use silver bar for changes, 10oz gold for claims, and require a keymaker's kit - I logged in and tested a claim and a keychange - worked like a charm, bars were taken. Logged out, restarted server, logged in, lock/unlock functions work perfectly with the new keys, no explosions or any other bugs so far. Good work!

Link to comment
Share on other sites

I can get this to load, the scroll menu works, but I continue to get kicked for "BattlEYE: Public variable value restriction #259"

I have been in Publicvariableval.txt and changed the 5 to a 1  for number #259 (#261, as I am lead to believe you need to add two the number) i have also changed the 5 to a 1 for the four either side of #261

1 "'"
1 actionmonitor
1 bis_
1 building_spawnloot
1 building_spawnzombies   #261 in my publicvariableval.txt file. I dont see how this could affect the script?
1 camp_spawnzombies
1 dayz !"dayzSetDate"
1 drn_
1 eh_localcleanup

 

 

I have also gone back through the old thread and found a mention that adding "   5 PVDZ_ !"Key \("   " to the should/could be a fix and have tried that to and it doesn't help. I even tried changing the 5 to a 1 and still, it did not work.

I have now gone back to the publicvairiableval.txt from 1.0.5.1 and I am getting same kick #259.............Making me think it may not only be this script, but a combination of this and something else I have added.

 

I have spent way to long trying to get this to work. I can not get my head around Battleye filters. They have always troubled me.

 

I think I am going to start it all from scratch.

Edited by Leg-it
editied due to my poor gramma
Link to comment
Share on other sites

19 hours ago, Leg-it said:

I can get this to load, the scroll menu works, but I continue to get kicked for "BattlEYE: Public variable value restriction #259"

I have been in Publicvariableval.txt and changed the 5 to a 1  for number #259 (#261, as I am lead to believe you need to add two the number) i have also changed the 5 to a 1 for the four either side of #261

1 "'"
1 actionmonitor
1 bis_
1 building_spawnloot
1 building_spawnzombies   #261 in my publicvariableval.txt file. I dont see how this could affect the script?
1 camp_spawnzombies
1 dayz !"dayzSetDate"
1 drn_
1 eh_localcleanup

 

 

I have also gone back through the old thread and found a mention that adding "   5 PVDZ_ !"Key \("   " to the should/could be a fix and have tried that to and it doesn't help. I even tried changing the 5 to a 1 and still, it did not work.

I have now gone back to the publicvairiableval.txt from 1.0.5.1 and I am getting same kick #259.............Making me think it may not only be this script, but a combination of this and something else I have added.

 

I have spent way to long trying to get this to work. I can not get my head around Battleye filters. They have always troubled me.

 

I think I am going to start it all from scratch.

I've had players with this kick before.  If in your name ingame you have a {} or other characters similar, it will cause that kick on death, or execution of certain scripts also.... might not be your issue. But i searched long and hard for that kick...one of m players had {} in his name... removed it and no problem after that...

 

IF your name is fine..like normal text. Post the full kick from the log... You can blank out your guid, but leave the rest...

Link to comment
Share on other sites

first time....

05.01.2017 11:16:18: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #0 "PVAH_AdminReq" = [1234,<NULL-object>,"76561198101880706"]
05.01.2017 11:16:18: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #1 "PVDZ_plr_LoginRecord" = ["76561198101880706","1",0,[70,114,101,101,108,111,97,100,101,114]]
05.01.2017 11:16:21: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #1 "PVDZ_send" = [<NULL-object>,"SafeZoneState",[0]]
05.01.2017 11:16:29: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - Value Restriction #259 "PVDZ_veh_Save" = [<NULL-object>,"vehiclekey",<NULL-object>,"UAZ_MG_TK_EP1_DZE","7910","Yellow Key (608b)","2293","123198961420352"]

 

With name changed

05.01.2017 11:15:56: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #1 "PVDZ_send" = [<NULL-object>,"dayzSetDate",[<NULL-object>]]
05.01.2017 11:16:18: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #0 "PVAH_AdminReq" = [1234,<NULL-object>,"76561198101880706"]
05.01.2017 11:16:18: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #1 "PVDZ_plr_LoginRecord" = ["76561198101880706","1",0,[70,114,101,101,108,111,97,100,101,114]]
05.01.2017 11:16:21: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - #1 "PVDZ_send" = [<NULL-object>,"SafeZoneState",[0]]
05.01.2017 11:16:29: Freeloader (101.190.15.103:62280) dda3b03287f0e10820e99e********** - Value Restriction #259 "PVDZ_veh_Save" = [<NULL-object>,"vehiclekey",<NULL-object>,"UAZ_MG_TK_EP1_DZE","7910","Yellow Key (608b)","2293","123198961420352"]

 

Also other player that was testing to make sure it wasn't me

05.01.2017 11:47:11: Ufaild (14.201.204.208:2304) 977d7ba4256a5a88b02ab********** - #0 "PVDZ_veh_Save" = [<NULL-object>,"vehiclekey",<NULL-object>,"UAZ_MG_TK_EP1_DZE","541","Green Key (791d)","2293","123198961420620"]
05.01.2017 11:47:11: Ufaild (14.201.204.208:2304) 977d7ba4256a5a88b02ab********** - #1 "PVDZ_veh_Save" = [<NULL-object>,"vehiclekey",<NULL-object>,"UAZ_MG_TK_EP1_DZE","541","Green Key (791d)","2293","123198961420620"]
05.01.2017 11:47:11: Ufaild (14.201.204.208:2304) 977d7ba4256a5a88b02ab********** - Value Restriction #259 "PVDZ_veh_Save" = [<NULL-object>,"vehiclekey",<NULL-object>,"UAZ_MG_TK_EP1_DZE","541","Green Key (791d)","2293","123198961420620"]

Link to comment
Share on other sites

I have found some errors in my client.rpt.

Error in expression <ON_fnc_vkcReset = {
player removeAction s_player_claimVehicle;
s_player_claimVeh>
  Error position: <s_player_claimVehicle;
s_player_claimVeh>

Edit: 

Maybe for further Improvements:

The script isnt able to take Gold out of a Briefcase. Maybe this can be changed so users dont have to create gold nuggets(or whatever) before using change vehicle key

Link to comment
Share on other sites

I'll add the tanks and upload. I'll also look at briefcase issue.

For the duping, are you using the very latest dropbox version. Thought that was only happening in the old version when there was no sleep after the delete DB entry... 

Link to comment
Share on other sites

ah thank you, I do remember having to edit that line now that you linked it. But give me a break it was over a year ago when 1051 came out lol. I did install the latest drop box, ill keep an eye out for the duping.

**UPDATE**

 

Yeah added "Tank" to the line required, now the option to change keys/claim works for nothing. Here is my file in spoiler.

Spoiler

/////////////////////////////////////////////////
/////////////////////////////////////////////////
/////////////// DONT EDIT BELOW ! ///////////////
/////////////////////////////////////////////////

ON_fnc_vkcReset = {
    player removeAction s_player_claimVehicle;
    s_player_claimVehicle = -1;
    player removeAction s_player_copyToKey;
    s_player_copyToKey = -1;
    lastKeyChangeCursorTarget = [objNull,objNull];
    vkc_cTarget = objNull;
};

/* Wait for player full ingame so we can access the action-menu */
waitUntil{!isNil "PVDZ_plr_LoginRecord"};

/* Initial Reset */
[] call ON_fnc_vkcReset;

/* Start the loop check */
while{true} do {
    sleep 3;

    if ((vehicle player) == player) then {
    
        if (speed player <= 1) then {

            if (!isNull cursorTarget) then {
                _cursorTarget = cursorTarget;
                
                if ((_cursorTarget isKindOf "Motorcycle" || _cursorTarget isKindOf "Car" || _cursorTarget isKindOf "Air" || _cursorTarget isKindOf "Ship" || _cursorTarget isKindOf "Tank")) then {

                    if ((_cursorTarget distance player) <= 10) then {

                        if (!isEngineOn _cursorTarget) then {

                            vkc_carKey = _cursorTarget getVariable ["CharacterID","0"];

                            if (vkc_claiming == 1) then {
                            
                                if (vkc_carKey == "0") then {

                                    if ((lastKeyChangeCursorTarget select 0) != _cursorTarget) then {
                                        player removeAction s_player_claimVehicle;
                                        s_player_claimVehicle = -1;
                                
                                        lastKeyChangeCursorTarget set [0,_cursorTarget];
                                        vkc_cTarget = lastKeyChangeCursorTarget select 0;
                                    };

                                    if (vkc_cTarget getVariable ["VKC_claming_disabled", 0] == 0) then {
                                        vkc_magazinesPlayer = magazines player;
                                        vkc_itemsPlayer = weapons player;
                                    
                                        if (("ItemKeyKit" in vkc_itemsPlayer || vkc_needKeykit == 0) && ((vkc_claimingPrice == "0" || vkc_claimingPrice in vkc_magazinesPlayer))) then {
                                            vkc_objectID = vkc_cTarget getVariable ["ObjectID","0"];
                                            vkc_objectUID = vkc_cTarget getVariable ["ObjectUID","0"];

                                            if (!(vkc_objectID == "0" && vkc_objectUID == "0")) then {
                                                vkc_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
                                                vkc_temp_keys = [];
                                                vkc_temp_keysDisplayName = [];
                                                vkc_temp_keysDisplayNameParse = [];
                                            
                                                {
    
                                                    if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in vkc_key_colors) then {
                                                        vkc_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
                                                        vkc_keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
                                                        vkc_temp_keysDisplayName set [count vkc_temp_keysDisplayName,vkc_keyName];
                                                        vkc_temp_keys set [count vkc_temp_keys,str(vkc_ownerKeyId)];
                                                    };
                                                } forEach vkc_itemsPlayer;

                                                if ((count vkc_temp_keys) > 0) then {
    
                                                    if (s_player_claimVehicle < 0) then {
                                                        s_player_claimVehicle = player addAction [("<t color='#00FFFF'>" + ("Claim Vehicle") + "</t>"),"custom\VehicleKeyChanger\VehicleKeyChanger.sqf",[vkc_cTarget,vkc_temp_keys,"0",vkc_temp_keysDisplayName,"0","0","0", vkc_claimingPrice],-1002,false,false,"",""];
                                                    };
    
                                                } else {

                                                    player removeAction s_player_claimVehicle;
                                                    s_player_claimVehicle = -1;
                                                };

                                            } else {

                                                player removeAction s_player_claimVehicle;
                                                s_player_claimVehicle = -1;
                                            };

                                        } else {

                                            player removeAction s_player_claimVehicle;
                                            s_player_claimVehicle = -1;
                                        };

                                    } else {

                                        player removeAction s_player_claimVehicle;
                                        s_player_claimVehicle = -1;
                                    };

                                } else {

                                    player removeAction s_player_claimVehicle;
                                    s_player_claimVehicle = -1;
                                };

                            } else {

                                player removeAction s_player_claimVehicle;
                                s_player_claimVehicle = -1;
                            };

                            if (vkc_carKey != "0") then {

                                if ((lastKeyChangeCursorTarget select 1) != _cursorTarget) then {
                                    player removeAction s_player_copyToKey;
                                    s_player_copyToKey = -1;

                                    lastKeyChangeCursorTarget set [1,_cursorTarget];
                                    vkc_cTarget = lastKeyChangeCursorTarget select 1;
                                };

                                if (vkc_cTarget getVariable ["VKC_disabled",0] == 0) then {

                                    vkc_magazinesPlayer = magazines player;
                                    vkc_itemsPlayer = weapons player;

                                    if (("ItemKeyKit" in vkc_itemsPlayer || vkc_needKeykit == 0) && (vkc_Price == "0" || vkc_Price in vkc_magazinesPlayer)) then {

                                        vkc_objectID = vkc_cTarget getVariable ["ObjectID","0"];
                                        vkc_objectUID = vkc_cTarget getVariable ["ObjectUID","0"];

                                        if (!(vkc_objectID == "0" && vkc_objectUID == "0")) then {
                                
                                            vkc_key_colors = ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"];
                                            vkc_temp_keys = [];
                                            vkc_temp_keysDisplayName = [];
                                            vkc_temp_keysDisplayNameParse = [];
                                            vkc_temp_keysParse = [];

                                            {

                                                if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in vkc_key_colors) then {
                                                    vkc_ownerKeyId = getNumber(configFile >> "CfgWeapons" >> _x >> "keyid");
                                                    vkc_keyName = getText(configFile >> "CfgWeapons" >> _x >> "displayName");
                                                    vkc_temp_keysDisplayName set [count vkc_temp_keysDisplayName,vkc_keyName];
                                                    vkc_temp_keysDisplayNameParse set [vkc_ownerKeyId,vkc_keyName];
                                                    vkc_temp_keys set [count vkc_temp_keys,str(vkc_ownerKeyId)];
                                                    vkc_temp_keysParse set [vkc_ownerKeyId, _x];
                                                };
                                            } forEach vkc_itemsPlayer;

                                            vkc_hasKey = vkc_carKey in vkc_temp_keys;

                                            if (vkc_hasKey && (count vkc_temp_keys) > 1) then {
                                                vkc_carKeyName = (vkc_temp_keysDisplayNameParse select (parseNumber vkc_carKey));
                                                vkc_targetVehicleKey = (vkc_temp_keysParse select (parseNumber vkc_carKey));
                                                vkc_temp_keys = vkc_temp_keys - [vkc_carKey];
                                                vkc_temp_keysDisplayName = vkc_temp_keysDisplayName - [vkc_carKeyName];

                                                if (s_player_copyToKey < 0) then {
                                                    s_player_copyToKey = player addAction [("<t color=""#0000FF"">" + ("Change Vehicle Key") + "</t>"),"custom\VehicleKeyChanger\VehicleKeyChanger.sqf",[vkc_cTarget, vkc_temp_keys, vkc_carKey, vkc_temp_keysDisplayName, vkc_carKeyName, vkc_targetVehicleKey, vkc_Price, "0"],-1002,false,false,"",""];
                                                };

                                            } else {
                                        
                                                player removeAction s_player_copyToKey;
                                                s_player_copyToKey = -1;
                                            };

                                        } else {
                                        
                                            player removeAction s_player_copyToKey;
                                            s_player_copyToKey = -1;
                                        };

                                    } else {
                                    
                                        player removeAction s_player_copyToKey;
                                        s_player_copyToKey = -1;
                                    };
                            
                                } else {
                                    
                                    player removeAction s_player_copyToKey;
                                    s_player_copyToKey = -1;
                                };

                            } else {
                                    
                                player removeAction s_player_copyToKey;
                                s_player_copyToKey = -1;
                            };

                        } else {
                            
                            [] call ON_fnc_vkcReset;
                        };

                    } else {

                        [] call ON_fnc_vkcReset;
                    };

                } else {

                    [] call ON_fnc_vkcReset;
                };

            } else {

                [] call ON_fnc_vkcReset;
            };

        } else {

            [] call ON_fnc_vkcReset;
        };

    } else {

        [] call ON_fnc_vkcReset;
    };

}; 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...