Plot Management cleanup + improvement

New compile DZE_GetPlotFriends

DZE_PlotManagementAdmins allows admin management of plot poles and
buildables near poles

DZE_MaxPlotFriends allows servers to allow more than 6 friends on a pole
at once
This commit is contained in:
icomrade
2016-05-01 13:20:21 -04:00
parent 9e2728af07
commit 1e65f7a959
8 changed files with 62 additions and 111 deletions

View File

@@ -2,14 +2,14 @@ private ["_pos","_plots","_thePlot","_inList"];
_pos = _this select 0;
if (_pos < 0) exitWith {};
_toAdd = (Humans select _pos);
_plots = nearestObjects [player, ["Plastic_Pole_EP1_DZ"],15];
_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15];
_thePlot = _plots select 0;
_friends = _thePlot getVariable ["plotfriends",[]];
_inList = false;
{ if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; } forEach _friends;
{ if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; } count _friends;
if (_inList) exitWith { cutText ["Already on the list", "PLAIN DOWN"]; };
if (count _friends == 6) exitWith { cutText ["Only 6 allowed","PLAIN DOWN"]; };
_friends = _friends + [_toAdd ];
if ((count _friends) == DZE_MaxPlotFriends) exitWith { cutText [format["Only %1 friends allowed", DZE_MaxPlotFriends], "PLAIN DOWN"]; };
_friends set [(count _friends), [_toAdd]];;
_thePlot setVariable ["plotfriends", _friends, true];
if (isServer) then {

View File

@@ -1,11 +1,11 @@
private ["_plots","_friendlies","_thePlot"];
lbClear 7002;
_plots = nearestObjects [player, ["Plastic_Pole_EP1_DZ"],15];
_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15];
_thePlot = _plots select 0;
_friendlies = _thePlot getVariable ["plotfriends", []];
{
lbAdd [7002, (_x select 1)];
} forEach _friendlies;
} count _friendlies;

View File

@@ -2,16 +2,16 @@ private ["_list","_plots","_thePlot","_friends"];
_pos = _this select 0;
if (_pos < 0) exitWith {};
_plots = nearestObjects [player, ["Plastic_Pole_EP1_DZ"],15];
_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15];
_thePlot = _plots select 0;
_friends = _thePlot getVariable ["plotfriends", []];
_toRemove = (_friends select _pos);
_newList = [];
{
if(_x select 0 != _toRemove select 0)then{
_newList = _newList + [_x];
_newList set [(count _newList), [_x]];
};
} forEach _friends;
} count _friends;
_thePlot setVariable ["plotfriends", _newList, true];
if (isServer) then {