Jump to content

[Release] ComboKeyChanger_cKc [Updated 1.2]


Recommended Posts

Do you ever want to change your door or safe key, here is the solution,

just open your safe or door and click "Set new key".

It will open the Epoch-ComboLock or KeypadUI, show you your old Key and after setting the new one, the actual key.

 

Install is pretty easy, 

 

In yourmissionfile.pbo, open "description.ext"

 

add

#include "ckc\ckc_defines.hpp"
#include "ckc\ckc_ui.hpp"
#include "ckc\ckc_SafeUI.hpp"

at the very bottom of the "description.ext".

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

In yourmissionfile.pbo, open "compiles.sqf"

 

add

ckc_button     =	compile preprocessFileLineNumbers "ckc\ckc_button.sqf";
ckc_upddoor    =        compile preprocessFileLineNumbers "ckc\ckc_upddoor.sqf";
ckc_updSafe    =        compile preprocessFileLineNumbers "ckc\ckc_updSafe.sqf";

below

player_unlockDoor      =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_unlockDoor.sqf";

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

 

In yourmissionfile.pbo, open "fn_selActions.sqf"

 

add




//Allow owner to change Door code

if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
		if ((s_player_lastTarget select 1) != _cursorTarget) then {
			if (s_player_ckc > 0) then {	
				player removeAction s_player_ckc;
				s_player_ckc = -1;
			};
		};

		if (s_player_ckc < 0) then {
			s_player_lastTarget set [1,_cursorTarget];	
		        s_player_ckc = player addaction["Set new Code", "ckc\ckc_startUI.sqf","",0,false,true,"", ""];
		};
	} else {
		player removeAction s_player_ckc;
		s_player_ckc = -1;
	};



//Allow owner to change vault code

_unlockedVault = ["VaultStorage"];

	if(typeOf(cursortarget) in _unlockedVault && _ownerID != "0" && (player distance _cursorTarget < 2)) then {
	
	if (s_player_Safe_ckc < 0) then {
	if ((typeOf(cursortarget) == "VaultStorage") &&(_ownerID == dayz_combination || _ownerID == dayz_playerUID)  ) then {
     
				
			s_player_Safe_ckc = player addaction["Set new Code", "ckc\ckc_startSafeUI.sqf","",1,false,true,"", ""];
		};
		};
	} else {
		player removeAction s_player_Safe_ckc;
		s_player_Safe_ckc = -1;

	};

ABOVE

//Allow owner to pack vault

Again in the "fn_selfActions.sqf"

 

add

        player removeAction s_player_ckc;
	s_player_ckc = -1;
        player removeAction s_player_Safe_ckc;
        s_player_Safe_ckc = -1;

just below

 

 
	player removeAction s_player_upgrade_build;
	s_player_upgrade_build = -1;
	player removeAction s_player_maint_build;
	s_player_maint_build = -1;
	player removeAction s_player_downgrade_build;
	s_player_downgrade_build = -1;

finally copy the "ckc" Folder in the download file, to yourmissionfile.pbo main directory.

 

Youre done ;)

 

Tested with Epoch Vers. 1.0.5.1, but should work with older versions too.

 

 

 

UPDATE since post #39 :

 

- Fixed missing   ";" bug

 

- "Set new Key" option no longer appears at the Lockbox

 

- Safe updates to Database directly after setting a new Key

 

 

 

 

UPDATE since post #55

 

- fixed bug occuring when player want to "Set new Code" two times in a row at doors.   Thanks to Jossy for pointing it out ;)

 

- fixed save to DB bug for Safes (randomly the inventory of the safes was not updated to the DB) ...safes are really save now :)

 

 

 

For people who wanna just update from the old Version:

 

DELETE the old "cKc" folder and replace it with the new one.

 

Please replace the entrys in the "fn_selfactions.sqf" with the new ones, posted in the code spoiler above.

 

 

 

 

 

 

 

 

Im sorry for any inconvenience... 

 

 

 

 

 

ComboKeyChanger_CKC.zip

Link to comment
Share on other sites

Set this up this morning.  

 

I get the following RPT error.

 6:35:47 File mpmissions\DayZ_Epoch_11.Chernarus\Scripts\ckc\ckc_defines.hpp, line 2: '/RscButton_ckc.access': Missing ';' at the end of line
 6:35:47 File mpmissions\DayZ_Epoch_11.Chernarus\Scripts\ckc\ckc_defines.hpp, line 35: '/RscButton_ckcS.access': Missing ';' at the end of line
 6:35:51 File mpmissions\DayZ_Epoch_11.Chernarus\Scripts\ckc\ckc_defines.hpp, line 2: '/RscButton_ckc.access': Missing ';' at the end of line
 6:35:51 File mpmissions\DayZ_Epoch_11.Chernarus\Scripts\ckc\ckc_defines.hpp, line 35: '/RscButton_ckcS.access': Missing ';' at the end of line
 6:35:51 File mpmissions\DayZ_Epoch_11.Chernarus\Scripts\ckc\ckc_defines.hpp, line 2: '/RscButton_ckc.access': Missing ';' at the end of line
 6:35:51 File mpmissions\DayZ_Epoch_11.Chernarus\Scripts\ckc\ckc_defines.hpp, line 35: '/RscButton_ckcS.access': Missing ';' at the end of line

The option to change the code on safes doesn't work. Wood doors works, haven't tested on cinder.

Link to comment
Share on other sites

I seem to forget a semicolon, sry for that, just set a  "  ;  "  behind the both  "access = ReadAndWrite" entrys, at your ckc_defines.hpp, then the Safe should work fine too.

I will update the file as soon as im home.

Link to comment
Share on other sites

  On 7/2/2014 at 9:01 AM, Renegade2k6 said:

No scroll option to set the code, works fine on the doors. What about expanding to garage doors too?

hmm when there is no scrolloption at all, the problem must be in the fn_selfactions.sqf

 

 

please check if your entry looks like

	//Allow owner to change vault code
	if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
     
	 if (s_player_Safe_ckc < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
			
			s_player_Safe_ckc = player addaction["Set new Code", "ckc\ckc_startSafeUI.sqf","",0,false,true,"", ""];
		};
	} else {
		player removeAction s_player_Safe_ckc;
		s_player_Safe_ckc = -1;

	};

just below

	//Allow owner to unlock vault
	if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
		if (s_player_unlockvault < 0) then {
			
			if(_typeOfCursorTarget in DZE_LockedStorage) then {
				
				if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
				} else {
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
				};
				s_player_unlockvault = 1;
			} else {
				if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
					_combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
					s_player_unlockvault = 1;
				};
			};
		};
	} else {
		{player removeAction _x} count s_player_combi;s_player_combi = [];
		s_player_unlockvault = -1;
	};
	

Garage doors (cinder and wood) should work too.

 

 

 

Are there guys who have succesfully installed the mod ?

Because at my system it works like a charm for doors and safes.

Link to comment
Share on other sites

Hi, works pretty well on my server

thanks for this!

 

only issue i've noticed is that lockboxes bring up the safe lock display.

 

and then set code <null> 

 

and it doesn't change the code.

everything else i've tested seems cool. 

Link to comment
Share on other sites

works fine and update correct to database

 

Information for Server with Infistar Antihack add this to your AHconfig.sqf, otherwise only admins can use it !!!

/*  ALLOWED Custom Dialogs are only used if you have  _CUD =  true;
/*  ALLOWED Dialogs       */ _ALLOWED_Dialogs = [...,...,...,...,...,118338,118339];


/*  ALLOWED Actions are only used if you have _CSA =  true;  */
/*  ALLOWED Actions      */ _dayzActions =
...,....,...,s_player_ckc,s_player_Safe_ckc
Link to comment
Share on other sites

Hmmmm not getting any change code options after opening doors and safes. Here is mine fn_selActions.sqf:

	//Packing my tent
	if(_isTent && (player distance _cursorTarget < 3)) then {
		if (_ownerID == dayz_characterID) then {
			if (s_player_packtent < 0) then {
				s_player_packtent = player addAction [localize "str_actions_self_07", "\z\addons\dayz_code\actions\tent_pack.sqf",_cursorTarget, 0, false, true, "",""];
			};
		} else {
			if(("ItemJerrycan" in _magazinesPlayer) && ("ItemMatchbox_DZE" in weapons player)) then {
				if (s_player_packtent < 0) then {
					s_player_packtent = player addAction [localize "STR_EPOCH_ACTIONS_DESTROYTENT", "\z\addons\dayz_code\actions\remove.sqf",_cursorTarget, 1, true, true, "", ""];
				};
			};
		};
	} else {
		player removeAction s_player_packtent;
		s_player_packtent = -1;
	};

	//Allow owner to unlock vault
	if((_typeOfCursorTarget in DZE_LockableStorage) && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
		if (s_player_unlockvault < 0) then {
			if(_typeOfCursorTarget in DZE_LockedStorage) then {
				if(_ownerID == dayz_combination || _ownerID == dayz_playerUID) then {
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_OPEN",_text], "\z\addons\dayz_code\actions\vault_unlock.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
				} else {
					_combi = player addAction [format[localize "STR_EPOCH_ACTIONS_UNLOCK",_text], "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
				};
				s_player_unlockvault = 1;
			} else {
				if(_ownerID != dayz_combination && _ownerID != dayz_playerUID) then {
					_combi = player addAction [localize "STR_EPOCH_ACTIONS_RECOMBO", "\z\addons\dayz_code\actions\vault_combination_1.sqf",_cursorTarget, 0, false, true, "",""];
					s_player_combi set [count s_player_combi,_combi];
					s_player_unlockvault = 1;
				};
			};
		};
	} else {
		{player removeAction _x} count s_player_combi;s_player_combi = [];
		s_player_unlockvault = -1;
	};

	//Allow owner to pack vault
Link to comment
Share on other sites

Because I cant see the fn_selfActions edits in your last post .

 

It schoul look like 

//Allow owner to change Door code

if((_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base") && (DZE_Lock_Door == _ownerID)) then {
		if ((s_player_lastTarget select 1) != _cursorTarget) then {
			if (s_player_ckc > 0) then {	
				player removeAction s_player_ckc;
				s_player_ckc = -1;
			};
		};

		if (s_player_ckc < 0) then {
			s_player_lastTarget set [1,_cursorTarget];	
		        s_player_ckc = player addaction["Set new Code", "ckc\ckc_startUI.sqf","",0,false,true,"", ""];
		};
	} else {
		player removeAction s_player_ckc;
		s_player_ckc = -1;
	};



//Allow owner to change vault code
	if(_typeOfCursorTarget in DZE_UnLockedStorage && _ownerID != "0" && (player distance _cursorTarget < 3)) then {
     
	 if (s_player_Safe_ckc < 0 && (_ownerID == dayz_combination || _ownerID == dayz_playerUID)) then {
			
			s_player_Safe_ckc = player addaction["Set new Code", "ckc\ckc_startSafeUI.sqf","",0,false,true,"", ""];
		};
	} else {
		player removeAction s_player_Safe_ckc;
		s_player_Safe_ckc = -1;

	};

past this ABOVE the...

//Allow owner to pack vault

...line.

Link to comment
Share on other sites

Sorry here is my fn_selfActions

 

  Reveal hidden contents

Link to comment
Share on other sites

Please replace the whole block:

 

  Reveal hidden contents

 

 

 

 

 

with this one:

 

  Reveal hidden contents

 

 

I have marked you the positions of the errors, please copy the "ckc" folder in your root/main directory of the mission.pbo
 
I would recommend you, to start fresh, with your backuped fn_selfactions.sqf

Link to comment
Share on other sites

Cant get this running :(

Ok, the option Set new code is showing up, but when i click at it, the keypad comes up, looks a bit broken and i dont can click any numbers or something. The only button, which is working is "Exit".

Can anybody help me out ?

Link to comment
Share on other sites

@Tricks

 

You can if you want, BUT then you must change several pathes in the files of ckc.

For example in the descrition.ext and the compiles.sqf ,but not only there, in the *.hpp files too and so one...

 

Maybe I update the first post, with a HowTo\WhereTo change the pathes, but not today Im busy atm.

Link to comment
Share on other sites

  On 7/4/2014 at 10:58 AM, Sp4rkY said:

Cant get this running :(

Ok, the option Set new code is showing up, but when i click at it, the keypad comes up, looks a bit broken and i dont can click any numbers or something. The only button, which is working is "Exit".

Can anybody help me out ?

have you included the #defines to your description.ext (incl. the right path) , and dont forget the entrys at the compile.sqf?

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...