mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-13 19:52:38 +03:00
@@ -16,8 +16,7 @@ _text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName"
|
||||
// Silently exit if object no longer exists
|
||||
if(isNull _obj) exitWith { TradeInprogress = false; };
|
||||
|
||||
// Test cannot lock while another player is nearby
|
||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_11") , "PLAIN DOWN"]; };
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
|
||||
@@ -16,8 +16,8 @@ _text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName"
|
||||
// Silently exit if object no longer exists
|
||||
if(isNull _obj or !(alive _obj)) exitWith { TradeInprogress = false; };
|
||||
|
||||
// Test cannot lock while another player is nearby
|
||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
|
||||
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_16") , "PLAIN DOWN"]; };
|
||||
|
||||
_ownerID = _obj getVariable["CharacterID","0"];
|
||||
|
||||
@@ -17,46 +17,56 @@ if(!isNull dayz_selectedDoor) then {
|
||||
// our target
|
||||
_obj = dayz_selectedDoor;
|
||||
|
||||
// get object combination
|
||||
_objectCharacterID = _obj getVariable ["CharacterID","0"];
|
||||
_notNearestPlayer = _obj call dze_isnearest_player;
|
||||
|
||||
// Check combination
|
||||
if (DZE_Lock_Door == _objectCharacterID) then {
|
||||
|
||||
[player,"combo_unlock",0,false] call dayz_zombieSpeak;
|
||||
|
||||
// close display
|
||||
if (_notNearestPlayer) then {
|
||||
// close display since another player is closer
|
||||
_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;
|
||||
|
||||
cutText ["Failed, another player is closer than you are.", "PLAIN DOWN"];
|
||||
} else {
|
||||
DZE_Lock_Door = "";
|
||||
[player,"combo_locked",0,false] call dayz_zombieSpeak;
|
||||
[player,20,true,(getPosATL player)] spawn player_alertZombies;
|
||||
|
||||
// get object combination
|
||||
_objectCharacterID = _obj getVariable ["CharacterID","0"];
|
||||
|
||||
if (isNil 'KeyCodeTry') then {KeyCodeTry = 0;};
|
||||
// Check combination
|
||||
if (DZE_Lock_Door == _objectCharacterID) then {
|
||||
|
||||
[player,"combo_unlock",0,false] call dayz_zombieSpeak;
|
||||
|
||||
KeyCodeTry = KeyCodeTry + 1;
|
||||
|
||||
if (!isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+10;};
|
||||
|
||||
if(KeyCodeTry >= ((round(random 4)) + 4)) then {
|
||||
|
||||
if (isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+10;};
|
||||
|
||||
cutText [(localize "str_epoch_player_19"), "PLAIN DOWN"];
|
||||
// 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 (!isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+10;};
|
||||
|
||||
if(KeyCodeTry >= ((round(random 4)) + 4)) then {
|
||||
|
||||
if (isNil 'KeyCodeTryTimer') then {KeyCodeTryTimer = diag_tickTime+10;};
|
||||
|
||||
cutText [(localize "str_epoch_player_19"), "PLAIN DOWN"];
|
||||
_display = findDisplay 41144;
|
||||
_display closeDisplay 3000;
|
||||
};
|
||||
};
|
||||
};
|
||||
} else {
|
||||
|
||||
@@ -8,12 +8,12 @@ private ["_objectID","_objectUID","_obj","_ownerID","_dir","_pos","_holder","_we
|
||||
if(TradeInprogress) exitWith { cutText [(localize "str_epoch_player_21") , "PLAIN DOWN"]; };
|
||||
TradeInprogress = true;
|
||||
|
||||
// Test cannot lock while another player is nearby
|
||||
_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 6]) > 1;
|
||||
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_20") , "PLAIN DOWN"]; };
|
||||
|
||||
_obj = _this;
|
||||
|
||||
_playerNear = _obj call dze_isnearest_player;
|
||||
|
||||
if(_playerNear) exitWith { TradeInprogress = false; cutText [(localize "str_epoch_player_20") , "PLAIN DOWN"]; };
|
||||
|
||||
_unlockedClass = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "unlockedClass");
|
||||
_text = getText (configFile >> "CfgVehicles" >> (typeOf _obj) >> "displayName");
|
||||
|
||||
|
||||
@@ -20,8 +20,10 @@ _IsNearVehicle = count (_findNearestVehicle);
|
||||
if (_IsNearVehicle >= 1) then {
|
||||
|
||||
_vehicle = _findNearestVehicle select 0;
|
||||
|
||||
_notNearestPlayer = _vehicle call dze_isnearest_player;
|
||||
|
||||
if (!isNull _vehicle and local _vehicle) then {
|
||||
if (!isNull _vehicle and local _vehicle and !_notNearestPlayer) then {
|
||||
|
||||
_classname = typeOf _vehicle;
|
||||
|
||||
|
||||
@@ -417,6 +417,25 @@ if (!isDedicated) then {
|
||||
_objName = toLower(toString(_objName));
|
||||
_objName
|
||||
};
|
||||
|
||||
dze_isnearest_player = {
|
||||
private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
|
||||
if(!isNull _this) then {
|
||||
_nearPlayers = _this nearEntities ["CAManBase", 12];
|
||||
_playerNear = ({isPlayer _x} count _nearPlayers) > 1;
|
||||
_notClosest = false;
|
||||
if (_playerNear) then {
|
||||
// check if another player is closer
|
||||
_playerDistance = player distance _this;
|
||||
{
|
||||
if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
|
||||
} forEach _nearPlayers;
|
||||
};
|
||||
} else {
|
||||
_notClosest = false;
|
||||
};
|
||||
_notClosest
|
||||
};
|
||||
|
||||
dayz_originalPlayer = player;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user