Add a few missing playerIsNear checks

Blocks duping method reported by Sercan and confirmed with @oiad .
Thanks
This commit is contained in:
ebayShopper
2017-02-25 17:29:27 -05:00
parent a3f2b8db57
commit d12fda5e21
5 changed files with 30 additions and 7 deletions

View File

@@ -1,9 +1,11 @@
private ["_notClosest","_playerDistance","_nearPlayers","_obj","_playerNear"];
private ["_notClosest","_playerDistance","_nearPlayers","_playerNear"];
_notClosest = false;
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;
@@ -11,8 +13,6 @@ if (!isNull _this) then {
if (_playerDistance > (_x distance _this)) exitWith { _notClosest = true; };
} count _nearPlayers;
};
} else {
_notClosest = false;
};
_notClosest

View File

@@ -14,9 +14,14 @@ if (DZE_permanentPlot) then {
_ownerID = _obj getVariable["ownerPUID","0"];
};
// Make sure you are the closest player to the tent
_playerNear = _obj call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_epoch_player_16" call dayz_rollingMessages;};
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([_obj] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
_packobj = getText (configFile >> "CfgVehicles" >> typeOf _obj >> "pack");
player removeAction s_player_packtent;