This commit is contained in:
[VB]AWOL
2013-11-24 03:35:13 -06:00
parent d55abe389a
commit f4909fd676
6 changed files with 71 additions and 41 deletions

View File

@@ -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"];

View File

@@ -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"];

View File

@@ -17,6 +17,15 @@ if(!isNull dayz_selectedDoor) then {
// our target // our target
_obj = dayz_selectedDoor; _obj = dayz_selectedDoor;
_notNearestPlayer = _obj call dze_isnearest_player;
if (_notNearestPlayer) then {
// close display since another player is closer
_display = findDisplay 41144;
_display closeDisplay 3000;
cutText ["Failed, another player is closer than you are.", "PLAIN DOWN"];
} else {
// get object combination // get object combination
_objectCharacterID = _obj getVariable ["CharacterID","0"]; _objectCharacterID = _obj getVariable ["CharacterID","0"];
@@ -59,6 +68,7 @@ if(!isNull dayz_selectedDoor) then {
_display closeDisplay 3000; _display closeDisplay 3000;
}; };
}; };
};
} else { } else {
// close display since no target // close display since no target

View File

@@ -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");

View File

@@ -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;

View File

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