Added the _allPlayers variable to complete the delete and readd to
original Perm Group.

Optimized forEach statements.
Fixed use of _groupId with _permGroup
This commit is contained in:
DESKTOP-UH65DCE\MusTanG 2017-08-30 20:43:19 -05:00
parent a59fc4aee2
commit 71f6c3db70
2 changed files with 7 additions and 9 deletions

View File

@ -22,7 +22,7 @@ if !([_player, _token] call EPOCH_server_getPToken) exitWith{};
_return = false; _return = false;
_groupID = getPlayerUID _player; _groupID = getPlayerUID _player;
if (_groupID != "") then { if (_groupID != "") then {
_allPlayers = allPlayers select {alive _x};
{ {
_group = grpNull; _group = grpNull;
_permGroup = _x getVariable["GROUP",""]; _permGroup = _x getVariable["GROUP",""];

View File

@ -43,10 +43,8 @@ if !(_contentArray isEqualTo []) then {
if ((_x getVariable ["TEMPGROUP",""]) != _groupID) then { if ((_x getVariable ["TEMPGROUP",""]) != _groupID) then {
_group = grpNull; _group = grpNull;
{ {
if ((_x getVariable["TEMPGROUP",""]) == _groupID) exitWith {
_group = group _x; _group = group _x;
}; } forEach (_allPlayers select {(_x getVariable["TEMPGROUP", ""]) == _groupID});
} forEach _allPlayers;
if (isNull _group) then { if (isNull _group) then {
_group = createGroup [west, true]; _group = createGroup [west, true];
@ -57,6 +55,7 @@ if !(_contentArray isEqualTo []) then {
}; };
} forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID}); } forEach (_allPlayers select {getPlayerUID _x == _selectedPlayerUID});
// find player name from DB // find player name from DB
if (_selectedPlayerName == "Dead Player") then { if (_selectedPlayerName == "Dead Player") then {
_memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE; _memberrange = ["PlayerData", _selectedPlayerUID] call EPOCH_fnc_server_hiveGETRANGE;
@ -86,6 +85,7 @@ if !(_contentArray isEqualTo []) then {
//Remove //Remove
_found = false; _found = false;
_group = grpNull; _group = grpNull;
_permGroup = "";
{ {
_permGroup = _x getVariable["GROUP",""]; _permGroup = _x getVariable["GROUP",""];
_playerObj = _x; _playerObj = _x;
@ -93,10 +93,8 @@ if !(_contentArray isEqualTo []) then {
if !(_permGroup isEqualTo "")then if !(_permGroup isEqualTo "")then
{ {
{ {
if ((_x getVariable["GROUP",""]) == _groupID) exitWith {
_group = group _x; _group = group _x;
}; } forEach (_allPlayers select {(_x getVariable["GROUP", ""]) == _permGroup});
} forEach _allPlayers;
}; };
_playerObj setVariable ["TEMPGROUP", nil]; _playerObj setVariable ["TEMPGROUP", nil];
if (isNull _group) then { if (isNull _group) then {