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