Fix plot friends return

This commit is contained in:
icomrade
2016-05-08 19:13:18 -04:00
parent c0cb702534
commit 875b63027a

View File

@@ -1,4 +1,10 @@
private ["_findNearestPoles","_AdminAccess","_IsNearPlot","_pole","_friendUID","_owner","_allowed","_friends","_fuid","_FindNearestPole"];
/************************************************************************************************************************************************
This file is used to obtain plot pole owners and friends, which includes plot management admins depending on the third array element passed to the script
You should NOT call this file directly, you should call FNC_check_owner as below to obtain a list of the plot owner and friends.
[player, _nearestPole, DZE_plotManagement] call FNC_check_owner;
************************************************************************************************************************************************/
private ["_findNearestPoles","_AdminAccess","_IsNearPlot","_pole","_friendUID","_owner","_allowed","_friends","_FindNearestPole"];
_pole = _this select 0;
_FindNearestPole = _this select 1;
_AdminAccess = _this select 2;
@@ -13,16 +19,12 @@ if(!_FindNearestPole || {_IsNearPlot > 0}) then {
_owner = if(DZE_plotforLife) then { _pole getVariable ["ownerPUID","0"]; } else { _pole getVariable ["characterID","0"]; };
_allowed = [_owner];
_friends = _pole getVariable ["plotfriends", []];
_fuid = [];
{
_friendUID = _x select 0;
_fuid set [(count _fuid), _friendUID];
_allowed set [(count _allowed), _friendUID];
} count _friends;
if (_AdminAccess) then {
_allowed set [1, DZE_PlotManagementAdmins];
_allowed set [2, _fuid];
} else {
_allowed set [1, _fuid];
_allowed = _allowed + DZE_PlotManagementAdmins;
};
};
_allowed;