Merge pull request #1990 from oiad/patch-2

Fix issues with DZE_limitPlots
This commit is contained in:
icomrade
2017-10-15 11:56:13 -04:00
committed by GitHub
2 changed files with 16 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
private ["_pos","_plots","_thePlot","_friends","_toRemove","_newList"];
private ["_pos","_plots","_thePlot","_friends","_toRemove","_newList","_hasPole"];
_pos = _this select 0;
if (_pos < 0) exitWith {};
@@ -6,13 +6,24 @@ _plots = ([player] call FNC_getPos) nearEntities ["Plastic_Pole_EP1_DZ",15];
_thePlot = _plots select 0;
_friends = _thePlot getVariable ["plotfriends", []];
_toRemove = (_friends select _pos);
_hasPole = false;
_newList = [];
if ((_toRemove select 0) == ((_friends select 0) select 0) && (!(dayz_playerUID in DZE_PlotManagementAdmins) && !(dayz_playerUID == ((_friends select 0) select 0)))) exitWith {systemChat localize "STR_EPOCH_PLOTMANAGEMENT_CANT_REMOVE";};
_newList = [];
if (DZE_limitPlots && {!(dayz_playerUID in DZE_PlotManagementAdmins)}) then {
{
if (_x getVariable["ownerPUID","0"] == dayz_playerUID || (_x getVariable["CharacterID","0"] == dayz_characterID) || ((((_x getVariable ["plotfriends",[]]) select 0) select 0) == dayz_playerUID) && (_x != _thePlot)) exitWith {
_hasPole = true;
};
} count (entities "Plastic_Pole_EP1_DZ");
};
if (_hasPole) exitWith {systemChat localize "STR_EPOCH_PLAYER_133";};
{
if (_x select 0 != _toRemove select 0) then {
_newList set [(count _newList), _x];
if (_x select 0 != _toRemove select 0) then {
_newList set [(count _newList), _x];
};
} count _friends;
_thePlot setVariable ["plotfriends", _newList, true];

View File

@@ -45,7 +45,7 @@ if (_isPole) then {
_distance = DZE_PlotPole select 1;
if (DZE_limitPlots && {!(dayz_playerUID in DZE_PlotManagementAdmins)}) then {
{
if (_x getVariable["ownerPUID","0"] == dayz_playerUID or (_x getVariable["CharacterID","0"] == dayz_characterID)) exitWith {
if (_x getVariable["ownerPUID","0"] == dayz_playerUID || (_x getVariable["CharacterID","0"] == dayz_characterID) || ((((_x getVariable ["plotfriends",[]]) select 0) select 0) == dayz_playerUID)) exitWith {
_hasPole = true;
};
} count (entities "Plastic_Pole_EP1_DZ");