Plot / door management userlist sorting (#1747)

* Plot / door management userlist sorting

This correctly sorts the nearby humans list in both mods, I have this
running on my 1051 server with no issues, @ebaydayz please advise if
this is not right, I've tested it pretty well and it is indeed selecting
the right person/UID

* Door/plot management fixes

As per @ebaydayz
This commit is contained in:
oiad
2016-08-22 09:19:52 +12:00
committed by ebaydayz
parent 8ef349e2bb
commit 6bdc3956fb
7 changed files with 104 additions and 73 deletions

View File

@@ -1,26 +1,33 @@
private ["_pos","_plots","_thePlot","_inList","_toAdd","_friends"];
private ["_plots","_thePlot","_inList","_toAdd","_friends","_friendUID","_friendName","_userList"];
disableSerialization;
_pos = _this select 0;
if (_pos < 0) exitWith {};
_userList = (findDisplay 711194) displayCtrl 7001;
_toAdd = (Humans select _pos);
_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15];
_friendUID = _this select 0;
_friendName = _userList lbText (lbCurSel _userList);
if (_friendUID == "") exitWith {};
_plots = nearestObjects [[player] call FNC_getPos, ["Plastic_Pole_EP1_DZ"],15];
_thePlot = _plots select 0;
_friends = _thePlot getVariable ["plotfriends",[]];
_toAdd = [_friendUID,toArray _friendName];
_inList = false;
{ if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; } count _friends;
if (_inList) exitWith {localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST" call dayz_rollingMessages};
if ((count _friends) == DZE_MaxPlotFriends) exitWith { format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_MaxPlotFriends] call dayz_rollingMessages;};
{ if ((_x select 0) == (_toAdd select 0)) exitWith { _inList = true; }; false } count _friends;
if (_inList) exitWith { systemChat localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_ALREADYONTHELIST"; };
if ((count _friends) == DZE_MaxPlotFriends) exitWith { systemChat format[localize "STR_EPOCH_PLOTMANAGEMENT_ADDFRIEND_FRIENDLIMIT", DZE_MaxPlotFriends]; };
_friends set [(count _friends), _toAdd];
_thePlot setVariable ["plotfriends", _friends, true];
PVDZ_veh_Save = [_thePlot,"gear"];
if (isServer) then {
PVDZ_veh_Save call server_updateObject;
} else {
publicVariableServer "PVDZ_veh_Save";
};
call PlotGetFriends;
call PlotNearbyHumans;