Jump to content
  • 0

Unlock door change


Cryten

Question

's just a thought .... it would work `?

 

have not tested it. but would like to know if that is the right way

/*
	DayZ Unlock Door
	Usage: [_obj] call player_unlockDoor;
	Made for DayZ Epoch please ask permission to use/edit/distrubute email [email protected].
	##################################################################################################
	Edit by Cryten
*/
private ["_ok"];

if(!isNull dayz_selectedDoor) then {

	if (!isNil 'KeyCodeTryTimer') then {
		if(diag_tickTime > KeyCodeTryTimer) then {
			KeyCodeTry = nil;
			KeyCodeTryTimer = nil;
		};
	};

	// our target
	_obj = dayz_selectedDoor;

	// get object combination
	_objectCharacterID 	= _obj getVariable ["CharacterID","0"];

	// Check combination
	if (DZE_Lock_Door == _objectCharacterID) then {
	
		[player,"combo_unlock",0,false] call dayz_zombieSpeak;

		// close display
		_display = findDisplay 41144;
		_display closeDisplay 3000;

		// unlock if locked
		if(_obj animationPhase "Open_hinge" == 0) then {
			_obj animate ["Open_hinge", 1];
		};

		if(_obj animationPhase "Open_latch" == 0) then {
			_obj animate ["Open_latch", 1];
		};
		KeyCodeTry = nil;

	} else {
		DZE_Lock_Door = "";
		[player,"combo_locked",0,false] call dayz_zombieSpeak;
		[player,20,true,(getPosATL player)] spawn player_alertZombies;

		if (isNil 'KeyCodeTry') then {KeyCodeTry = 0;};

		KeyCodeTry = KeyCodeTry + 1;
		
		if(KeyCodeTry == (1)) then
		{
			cutText ["Wrong Code!  - 2 trys left!", "PLAIN DOWN"];
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		}
		
		if(KeyCodeTry == (2)) then
		{
			cutText ["Wrong Code!  - 1 try left!", "PLAIN DOWN"];
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		}
		
		if (!isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+300;};

		if(KeyCodeTry >= (3) then {
			
			if (isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+300;};
			
			cutText ["Wrong Code!  - Wait 10 Minutes!", "PLAIN DOWN"];
			_display = findDisplay 41144;
			_display closeDisplay 3000;
		};
	};
} else {
	
	// close display since no target
	_display = findDisplay 41144;
	_display closeDisplay 3000;
};
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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