From ea8c14c5fbdcc1638b24686aca63b9639b2737a1 Mon Sep 17 00:00:00 2001 From: icomrade Date: Tue, 3 May 2016 01:19:36 -0400 Subject: [PATCH] Fix #1187 keypadCancel returns false when a combo/keypad dialog is not open and when reset by calling the code keyPadReset = {uiSleep 2; keypadCancel = false;}; There is a 2 second delay which makes brute forcing very very time consuming. Note there must be a delay when resetting the variable since fn_selfactions will update so quickly it will display the unlock/lock/remove option before onUnload is executed. --- CHANGE LOG 1.0.6.txt | 1 + .../Configs/CfgVehicles/DZE/Doors.hpp | 30 +++++++++---------- SQF/dayz_code/Configs/RscDisplay/safegui.hpp | 21 ++++++++----- SQF/dayz_code/compile/fn_selfActions.sqf | 6 ++-- SQF/dayz_code/init/variables.sqf | 4 +++ 5 files changed, 36 insertions(+), 26 deletions(-) diff --git a/CHANGE LOG 1.0.6.txt b/CHANGE LOG 1.0.6.txt index 00100e20a..230333ca4 100644 --- a/CHANGE LOG 1.0.6.txt +++ b/CHANGE LOG 1.0.6.txt @@ -91,6 +91,7 @@ [FIXED] Ponds and lakes are now detected correctly in player_goFishing. #1678 @ebaydayz [FIXED] Players are now ejected and killed when their vehicle is destroyed (Fix applies to all types of vehicles). @icomrade [NOTE] Servers that use trader safezones must configure the variable DZE_SafeZonePosArray with their safezone posisitons and radii, otherwise passangers of vehicles in safezones will be killed upon destruction of their vehicle +[FIXED] Players are no longer able to brute force doors or safes by the method described in #1187 @icomrade [UPDATED] .hpp files updated in dayz_epoch_b CfgLootPos > CfgBuildingPos. @Uro1 [UPDATED] .bat files updated in Config-Examples @Raziel23x diff --git a/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp b/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp index 603566e76..7e47e9bc6 100644 --- a/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp +++ b/SQF/dayz_code/Configs/CfgVehicles/DZE/Doors.hpp @@ -359,21 +359,21 @@ class Land_DZE_WoodDoorLocked: Land_DZE_WoodDoorLocked_Base { { displayName="Lock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; statement="this animate [""Open_hinge"", 0]"; }; class Unlock_Door : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; statement="this animate [""Open_hinge"", 1]"; }; class Unlock_Door_Dialog : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="DZE_Lock_Door != (this getvariable['CharacterID','0'])"; + condition=" !keypadCancel and DZE_Lock_Door != (this getvariable['CharacterID','0'])"; statement="dayz_selectedDoor = this;DZE_topCombo = 0;DZE_midCombo = 0;DZE_botCombo = 0;createdialog ""ComboLockUI"""; }; }; @@ -459,21 +459,21 @@ class Land_DZE_LargeWoodDoorLocked: Land_DZE_WoodDoorLocked_Base { { displayName="Lock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; statement="this animate [""Open_hinge"", 0]"; }; class Unlock_Door : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; statement="this animate [""Open_hinge"", 1]"; }; class Unlock_Door_Dialog : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="DZE_Lock_Door != (this getvariable['CharacterID','0'])"; + condition=" !keypadCancel and DZE_Lock_Door != (this getvariable['CharacterID','0'])"; statement="dayz_selectedDoor = this;DZE_topCombo = 0;DZE_midCombo = 0;DZE_botCombo = 0;createdialog ""ComboLockUI"""; }; }; @@ -559,21 +559,21 @@ class Land_DZE_GarageWoodDoorLocked: Land_DZE_WoodDoorLocked_Base { { displayName="Lock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; statement="this animate [""Open_hinge"", 0]"; }; class Unlock_Door : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; statement="this animate [""Open_hinge"", 1]"; }; class Unlock_Door_Dialog : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="DZE_Lock_Door != (this getvariable['CharacterID','0'])"; + condition=" !keypadCancel and DZE_Lock_Door != (this getvariable['CharacterID','0'])"; statement="dayz_selectedDoor = this;DZE_topCombo = 0;DZE_midCombo = 0;DZE_botCombo = 0;createdialog ""ComboLockUI"""; }; }; @@ -624,21 +624,21 @@ class CinderWallDoorLocked_DZ: CinderWallDoorLocked_DZ_Base { { displayName="Lock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 1)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 1)"; statement="this animate [""Open_latch"", 0]"; }; class Unlock_Door : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 0)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 0)"; statement="this animate [""Open_latch"", 1]"; }; class Unlock_Door_Dialog : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="DZE_Lock_Door != (this getvariable['CharacterID','0'])"; + condition=" !keypadCancel and DZE_Lock_Door != (this getvariable['CharacterID','0'])"; statement="dayz_selectedDoor = this;DZE_topCombo = 0;DZE_midCombo = 0;DZE_botCombo = 0;createdialog ""ComboLockUI"""; }; }; @@ -727,21 +727,21 @@ class CinderWallDoorSmallLocked_DZ: CinderWallDoorLocked_DZ_Base { { displayName="Lock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 1)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 1)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 1)"; statement="this animate [""Open_latch"", 0]"; }; class Unlock_Door : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="(DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 0)"; + condition="( !keypadCancel and DZE_Lock_Door == (this getvariable['CharacterID','0'])) and (this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_latch"" == 0)"; statement="this animate [""Open_latch"", 1]"; }; class Unlock_Door_Dialog : Open_Door { displayName="Unlock Door"; //condition="(this animationPhase ""Open_door"" == 0) and (this animationPhase ""Open_hinge"" == 0)"; - condition="DZE_Lock_Door != (this getvariable['CharacterID','0'])"; + condition=" !keypadCancel and DZE_Lock_Door != (this getvariable['CharacterID','0'])"; statement="dayz_selectedDoor = this;DZE_topCombo = 0;DZE_midCombo = 0;DZE_botCombo = 0;createdialog ""ComboLockUI"""; }; }; diff --git a/SQF/dayz_code/Configs/RscDisplay/safegui.hpp b/SQF/dayz_code/Configs/RscDisplay/safegui.hpp index 0efabd307..688a1c9e9 100644 --- a/SQF/dayz_code/Configs/RscDisplay/safegui.hpp +++ b/SQF/dayz_code/Configs/RscDisplay/safegui.hpp @@ -100,6 +100,8 @@ class SafeKeyPad { idd = -1; movingenable = 0; + onLoad = "keypadCancel = true;"; + onUnload = "if (keypadCancel) then {dayz_combination = ''; [] spawn keyPadReset;};"; class Controls { @@ -287,7 +289,7 @@ class SafeKeyPad colorBackground[] = {0,0,0,0}; colorBackgroundActive[] = {0,0,0,0}; soundClick[] = {"\dayz_sfx\action\cell\dtmf_star.ogg",0.6,1}; - onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 3000);"; + onButtonClick = "keypadCancel = true; ((ctrlParent (_this select 0)) closeDisplay 3000);"; }; class benter: RscButton { @@ -302,7 +304,7 @@ class SafeKeyPad colorText[] = {0,1,0,1}; colorBackground[] = {0,0,0,0}; colorBackgroundActive[] = {0,0,0,0}; - onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 3000); if(!isNull dayz_selectedVault and (typeOf dayz_selectedVault) in DZE_LockedStorage) then {dayz_selectedVault spawn player_unlockVault;};"; + onButtonClick = "keypadCancel = false; ((ctrlParent (_this select 0)) closeDisplay 3000); if(!isNull dayz_selectedVault and (typeOf dayz_selectedVault) in DZE_LockedStorage) then {dayz_selectedVault spawn player_unlockVault;};"; soundClick[] = {"\dayz_sfx\action\cell\dtmf_hash.ogg",0.6,1}; }; }; @@ -313,6 +315,8 @@ class ComboLockUI { idd = 41144; movingenable = 0; + onLoad = "keypadCancel = true;"; + onUnload = "if (keypadCancel) then {DZE_Lock_Door = ''; [] spawn keyPadReset;};"; class Controls { @@ -447,7 +451,7 @@ class ComboLockUI y = 0.0153665; w = 0.158511; h = 0.153191; - onButtonClick = "((ctrlParent (_this select 0)) closeDisplay 3000);"; + onButtonClick = "keypadCancel = true; ((ctrlParent (_this select 0)) closeDisplay 3000);"; }; class unlock_combo_btn: main_combo { @@ -456,7 +460,7 @@ class ComboLockUI y = 0.762017; w = 0.201064; h = 0.233964; - onButtonClick = "call player_unlockDoor"; + onButtonClick = "keypadCancel = false; call player_unlockDoor"; }; }; }; @@ -466,7 +470,8 @@ class KeypadUI { idd = -1; movingenable = 0; - + onLoad = "keypadCancel = true;"; + onUnload = "if (keypadCancel) then {dayz_combination = ''; [] spawn keyPadReset;};"; class Controls { class KeypadUIPic: RscPicture @@ -630,7 +635,7 @@ class KeypadUI y = 0.312845; w = 0.126596; h = 0.153191; - onButtonClick = "[player,""keypad_tick"",0,false] call dayz_zombieSpeak;((ctrlParent (_this select 0)) closeDisplay 3000);"; + onButtonClick = "keypadCancel = true; [player,""keypad_tick"",0,false] call dayz_zombieSpeak;((ctrlParent (_this select 0)) closeDisplay 3000);"; }; class kpbcancel2: main_button { @@ -639,7 +644,7 @@ class KeypadUI y = 0.50985; w = 0.126596; h = 0.153191; - onButtonClick = "[player,""keypad_tick"",0,false] call dayz_zombieSpeak;((ctrlParent (_this select 0)) closeDisplay 3000);"; + onButtonClick = "keypadCancel = true; [player,""keypad_tick"",0,false] call dayz_zombieSpeak;((ctrlParent (_this select 0)) closeDisplay 3000);"; }; class kpbenter: main_button { @@ -648,7 +653,7 @@ class KeypadUI y = 0.121749; w = 0.126596; h = 0.153191; - onButtonClick = "[player,""keypad_tick"",0,false] call dayz_zombieSpeak;((ctrlParent (_this select 0)) closeDisplay 3000); if(!isNull dayz_selectedVault) then {dayz_selectedVault spawn player_unlockVault;};"; + onButtonClick = "keypadCancel = false; [player,""keypad_tick"",0,false] call dayz_zombieSpeak;((ctrlParent (_this select 0)) closeDisplay 3000); if(!isNull dayz_selectedVault) then {dayz_selectedVault spawn player_unlockVault;};"; }; }; }; diff --git a/SQF/dayz_code/compile/fn_selfActions.sqf b/SQF/dayz_code/compile/fn_selfActions.sqf index 7c7423229..010e791df 100644 --- a/SQF/dayz_code/compile/fn_selfActions.sqf +++ b/SQF/dayz_code/compile/fn_selfActions.sqf @@ -778,7 +778,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //Allow owner to unlock vault - if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3}) then { + if ((_typeOfCursorTarget in DZE_LockableStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then { if (s_player_unlockvault < 0) then { if (_typeOfCursorTarget in DZE_LockedStorage) then { if (_characterID == dayz_combination || _ownerID == dayz_playerUID) then { @@ -803,7 +803,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; //Allow owner to pack vault - if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3}) then { + if ((_typeOfCursorTarget in DZE_UnLockedStorage) && {_characterID != "0"} && {player distance _cursorTarget < 3} && {!keypadCancel}) then { if (s_player_lockvault < 0) then { if (_characterID == dayz_combination || _ownerID == dayz_playerUID) then { s_player_lockvault = player addAction [format[localize "STR_EPOCH_ACTIONS_LOCK",_text], "\z\addons\dayz_code\actions\vault_lock.sqf",_cursorTarget, 0, false, true]; @@ -885,7 +885,7 @@ if (!isNull _cursorTarget && !_inVehicle && !_isPZombie && (player distance _cur }; // downgrade system - if ((DZE_Lock_Door == _characterID) && {_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base"}) then { + if ((DZE_Lock_Door == _characterID) && {!keypadCancel} && {_isDestructable || _cursorTarget isKindOf "Land_DZE_WoodDoorLocked_Base" || _cursorTarget isKindOf "CinderWallDoorLocked_DZ_Base"}) then { if ((s_player_lastTarget select 1) != _cursorTarget) then { if (s_player_downgrade_build > 0) then { player removeAction s_player_downgrade_build; diff --git a/SQF/dayz_code/init/variables.sqf b/SQF/dayz_code/init/variables.sqf index d52e0207c..96f98ca54 100644 --- a/SQF/dayz_code/init/variables.sqf +++ b/SQF/dayz_code/init/variables.sqf @@ -26,6 +26,10 @@ Message_3_time = 0; //OpenTarget timer OpenTarget_Time = 0; +//Brute force fix +keypadCancel = false; +keyPadReset = {uiSleep 2; keypadCancel = false;}; + ///Player classes AllPlayers = ["Survivor_DZ","Survivor1_DZ","SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ","SurvivorWcombat_DZ","SurvivorWdesert_DZ","SurvivorWurban_DZ","SurvivorWsequishaD_DZ","SurvivorWsequisha_DZ","SurvivorWpink_DZ","SurvivorW3_DZ","Bandit2_DZ","BanditW2_DZ","Soldier_Crew_PMC","Rocket_DZ","Rocker1_DZ","Rocker2_DZ","Rocker3_DZ","Rocker4_DZ","Priest_DZ","Functionary1_EP1_DZ","GUE_Commander_DZ","Ins_Soldier_GL_DZ","Haris_Press_EP1_DZ","Pilot_EP1_DZ","RU_Policeman_DZ","pz_policeman","pz_suit1","pz_suit2","pz_worker1","pz_worker2","pz_worker3","pz_doctor","pz_teacher","pz_hunter","pz_villager1","pz_villager2","pz_villager3","pz_priest","Soldier_TL_PMC_DZ","Soldier_Sniper_PMC_DZ","Soldier_Bodyguard_AA12_PMC_DZ","Drake_Light_DZ","CZ_Special_Forces_GL_DES_EP1_DZ","TK_INS_Soldier_EP1_DZ","TK_INS_Warlord_EP1_DZ","FR_OHara_DZ","FR_Rodriguez_DZ","CZ_Soldier_Sniper_EP1_DZ","Graves_Light_DZ","GUE_Soldier_MG_DZ","GUE_Soldier_Sniper_DZ","GUE_Soldier_Crew_DZ","GUE_Soldier_CO_DZ","GUE_Soldier_2_DZ","TK_Special_Forces_MG_EP1_DZ","TK_Soldier_Sniper_EP1_DZ","TK_Commander_EP1_DZ","RU_Soldier_Crew_DZ","INS_Lopotev_DZ","INS_Soldier_AR_DZ","INS_Soldier_CO_DZ","INS_Bardak_DZ","INS_Worker2_DZ"]; DayZ_Male = ["Survivor_DZ","Survivor1_DZ","Survivor2_DZ","Survivor3_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","Bandit1_DZ","Bandit2_DZ","Soldier_Crew_PMC","Rocket_DZ","Rocker1_DZ","Rocker2_DZ","Rocker3_DZ","Rocker4_DZ","Priest_DZ","Functionary1_EP1_DZ","GUE_Commander_DZ","Ins_Soldier_GL_DZ","Haris_Press_EP1_DZ","Pilot_EP1_DZ","RU_Policeman_DZ","pz_policeman","pz_suit1","pz_suit2","pz_worker1","pz_worker2","pz_worker3","pz_doctor","pz_teacher","pz_hunter","pz_villager1","pz_villager2","pz_villager3","pz_priest","Soldier_TL_PMC_DZ","Soldier_Sniper_PMC_DZ","Soldier_Bodyguard_AA12_PMC_DZ","Drake_Light_DZ","CZ_Special_Forces_GL_DES_EP1_DZ","TK_INS_Soldier_EP1_DZ","TK_INS_Warlord_EP1_DZ","FR_OHara_DZ","FR_Rodriguez_DZ","CZ_Soldier_Sniper_EP1_DZ","Graves_Light_DZ","GUE_Soldier_MG_DZ","GUE_Soldier_Sniper_DZ","GUE_Soldier_Crew_DZ","GUE_Soldier_CO_DZ","GUE_Soldier_2_DZ","TK_Special_Forces_MG_EP1_DZ","TK_Soldier_Sniper_EP1_DZ","TK_Commander_EP1_DZ","RU_Soldier_Crew_DZ","INS_Lopotev_DZ","INS_Soldier_AR_DZ","INS_Soldier_CO_DZ","INS_Bardak_DZ","INS_Worker2_DZ"];