<commit_before>//	@file Version: 1.0
//	@file Name: acceptGroupInvite.sqf
//	@file Author: [404] Deadbeat
//	@file Created: 20/11/2012 05:19

private["_inviterUID","_inviter"];

//Get the inviters UID
_groupExists = false;
{
	if(getPlayerUID player == _x select 1) then
	{
    	_inviterUID = _x select 0;
        currentInvites set [_forEachIndex, -1];
        currentInvites = currentInvites - [-1];
        publicVariable "currentInvites";       
	};
}forEach currentInvites;

//Get the inviter with their UID
if (!isNil "_inviterUID") then {
	{
		if(getPlayerUID _x == _inviterUID) then
	    {
    		_inviter = _x;
			_groupExists = true;	    
		};   
	};
}forEach playableUnits;

if(_groupExists) then
{
	_oldGroup = group player;
	_oldTerritories = _oldGroup getVariable ["currentTerritories", []];
	
	[player] join (group _inviter);
	
	_newGroup = group player;
	_newTerritories = _newGroup getVariable ["currentTerritories", []];
	[_newTerritories, _territories] call BIS_fnc_arrayPushStack;

	_newGroup setVariable ["currentTerritories", _newTerritories, true];
	_oldGroup setVariable ["currentTerritories", [], true];

	[[_oldGroup, _newGroup], "convertTerritoryOwner", false, false] call TPG_fnc_MP;
	[_newTerritories, false, _newGroup, true] call updateTerritoryMarkers;

    player globalChat format["you have accepted the invite"];
	player setVariable ["currentGroupRestore", group _inviter, true];
	player setVariable ["currentGroupIsLeader", false, true];
} else {
	player globalChat format["The group no longer exists or the leader disconnected"];    
}; <commit_msg>Fixed error when accepting group invite (cherry picked from commit A3Wasteland/ArmA3_Wasteland.Altis@9f4e139ba558b72840167877bc17102e43e6cf0e)<commit_after>//	@file Version: 1.0
//	@file Name: acceptGroupInvite.sqf
//	@file Author: [404] Deadbeat
//	@file Created: 20/11/2012 05:19

private["_inviterUID","_inviter"];

//Get the inviters UID
_groupExists = false;
{
	if(getPlayerUID player == _x select 1) then
	{
    	_inviterUID = _x select 0;
        currentInvites set [_forEachIndex, -1];
        currentInvites = currentInvites - [-1];
        publicVariable "currentInvites";       
	};
}forEach currentInvites;

//Get the inviter with their UID
if (!isNil "_inviterUID") then {
	{
		if(getPlayerUID _x == _inviterUID) exitWith
	    {
    		_inviter = _x;
			_groupExists = true;	    
		};   
	} forEach playableUnits;
};


if(_groupExists) then
{
	_oldGroup = group player;
	_oldTerritories = _oldGroup getVariable ["currentTerritories", []];
	
	[player] join (group _inviter);
	
	_newGroup = group player;
	_newTerritories = _newGroup getVariable ["currentTerritories", []];
	[_newTerritories, _territories] call BIS_fnc_arrayPushStack;

	_newGroup setVariable ["currentTerritories", _newTerritories, true];
	_oldGroup setVariable ["currentTerritories", [], true];

	[[_oldGroup, _newGroup], "convertTerritoryOwner", false, false] call TPG_fnc_MP;
	[_newTerritories, false, _newGroup, true] call updateTerritoryMarkers;

    player globalChat format["you have accepted the invite"];
	player setVariable ["currentGroupRestore", group _inviter, true];
	player setVariable ["currentGroupIsLeader", false, true];
} else {
	player globalChat format["The group no longer exists or the leader disconnected"];    
}; 
{'fraction_non_alphanumeric': 0.11239018479248712, 'fraction_numerical': 0.02181157225083308, 'mean_word_length': 4.606112054329372, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5820478', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1084, 'n_words': 288}