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

@@ -9,10 +9,13 @@
};
*/
if (dayz_actionInProgress) exitWith { localize "str_player_actionslimit" call dayz_rollingMessages; };
dayz_actionInProgress = true;
private ["_cursorTarget","_item","_classname","_requiredTools","_requiredParts","_upgrade","_upgradeConfig",
"_upgradeDisplayname","_onLadder","_isWater","_upgradeParts","_startUpgrade","_missingPartsConfig","_textMissingParts","_dis",
"_sfx","_ownerID","_objectID","_objectUID","_alreadyupgrading","_dir","_weapons","_magazines","_backpacks","_object",
"_objWpnTypes","_objWpnQty","_countr","_itemName","_vector"];
"_objWpnTypes","_objWpnQty","_countr","_itemName","_vector","_playerNear"];
_cursorTarget = _this select 3;
@@ -52,7 +55,15 @@ _isWater = (surfaceIsWater (getPosATL player)) or dayz_isSwimming;
_upgradeParts = [];
_startUpgrade = true;
if(_isWater or _onLadder) exitWith { localize "str_CannotUpgrade" call dayz_rollingMessages; };
if(_isWater or _onLadder) exitWith {dayz_actionInProgress = false; localize "str_CannotUpgrade" call dayz_rollingMessages;};
// Make sure you are the closest player to the object
_playerNear = _cursorTarget call dze_isnearest_player;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([_cursorTarget] call FNC_GetPos) nearEntities ["CAManBase",10]) > 1;
if (_playerNear) exitWith {dayz_actionInProgress = false; localize "str_pickup_limit_5" call dayz_rollingMessages;};
// lets check player has requiredTools for upgrade
{
@@ -197,4 +208,6 @@ if ((_startUpgrade) AND (isClass(_upgradeConfig))) then {
} else {
localize "str_upgradeNoOption" call dayz_rollingMessages;
*/
};
};
dayz_actionInProgress = false;

View File

@@ -1,6 +1,10 @@
if (dayz_lastClothesChange + 5 > diag_tickTime) exitWith {localize "str_player_actionslimit" call dayz_rollingMessages;};
dayz_lastClothesChange = diag_tickTime;
// Make sure no other players are nearby
_playerNear = {isPlayer _x} count (([player] call FNC_GetPos) nearEntities ["CAManBase",12]) > 1;
if (_playerNear) exitWith {localize "STR_EPOCH_PLAYER_84" call dayz_rollingMessages;};
if (_this in DZE_RestrictSkins) exitWith { format[localize "str_epoch_player_315",_this] call dayz_rollingMessages; };
if (dayz_actionInProgress) exitWith {localize "str_epoch_player_83" call dayz_rollingMessages;};
dayz_actionInProgress = true;

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;