Better checks for removing the owner of plots/doors

Revert
f0e8796996

Partial revert:
2f0774d531 (diff-c3aa237d9007054fc3a724116a5d9f1a)

This is a better check for removing the owner of plots/doors based on
conversations on discord.
Plot/door owner can remove them selves
plot/door friends can't remove plot owner
plot/door admins can remove anyone
This commit is contained in:
oiad
2017-10-24 20:19:21 +13:00
parent 7a8d23bdeb
commit 64b5659bbd
3 changed files with 9 additions and 17 deletions

View File

@@ -1,15 +1,16 @@
private ["_pos","_friends","_toRemove","_newList"];
private ["_pos","_friends","_toRemove","_newList","_ownerPUID"];
_pos = _this select 0;
if (_pos < 0) exitWith {};
_friends = TheDoor getVariable ["doorfriends", []];
_ownerPUID = TheDoor getVariable ["ownerPUID","0"];
_toRemove = (_friends select _pos);
if ((_toRemove select 0) == ((_friends select 0) select 0) && (!(dayz_playerUID in DZE_doorManagementAdmins) && !(dayz_playerUID == ((_friends select 0) select 0)))) exitWith {systemChat localize "STR_EPOCH_DOORMANAGEMENT_CANT_REMOVE";};
if ((_toRemove select 0) == _ownerPUID && (!(dayz_playerUID in DZE_doorManagementAdmins) && !(dayz_playerUID == _ownerPUID))) exitWith {systemChat localize "STR_EPOCH_DOORMANAGEMENT_CANT_REMOVE";};
_newList = [];
{
if(_x select 0 != _toRemove select 0) then {
if (_x select 0 != _toRemove select 0) then {
_newList set [count _newList, _x ];
};
} forEach _friends;