WHERE name='%1' AND active='1'",_gangName]; waitUntil{!DB_Async_Active}; _queryResult = [_query,2] call DB_fnc_asyncCall; //Check to see if the gang name already exists. if(count _queryResult != 0) exitWith { [[1,"There is already a gang created with that name please pick another name."],"life_fnc_broadcast",_ownerID,false] spawn life_fnc_MP; [["life_action_gangInUse",nil,missionNamespace],"life_fnc_netSetVar",_ownerID,false] spawn life_fnc_MP; }; _query = format["SELECT id FROM gangs WHERE members LIKE '%2%1%2' AND active='1'",_uid,"%"]; waitUntil{!DB_Async_Active}; _queryResult = [_query,2] call DB_fnc_asyncCall; //Check to see if this person already owns or belongs to a gang. if(count _queryResult != 0) exitWith { [[1,"You are currently already active in a gang, please leave the gang first."],"life_fnc_broadcast",_ownerID,false] spawn life_fnc_MP; [["life_action_gangInUse",nil,missionNamespace],"life_fnc_netSetVar",_ownerID,false] spawn life_fnc_MP; }; //Check to see if a gang with that name already exists but is inactive. _query = format["SELECT id, active FROM gangs WHERE name='%1' AND active='0'",_gangName]; waitUntil{!DB_Async_Active}; _queryResult = [_query,2] call DB_fnc_asyncCall; _gangMembers = [[_uid]] call DB_fnc_mresArray; if(count _queryResult != 0) then { _query = format["UPDATE gangs SET active='1', owner='%1',members='%2' WHERE id='%3'",_uid,_gangMembers,(_queryResult select 0)]; } else { _query = format["INSERT INTO gangs (owner, name, members) VALUES('%1','%2','%3')",_uid,_gangName,_gangMembers]; }; waitUntil{!DB_Async_Active}; _queryResult = [_query,1] call DB_fnc_asyncCall; _group setVariable["gang_name",_gangName,true]; _group setVariable["gang_owner",_uid,true]; _group setVariable["gang_bank",0,true]; _group setVariable["gang_maxMembers",8,true]; _group setVariable["gang_members",[_uid],true]; [[_group],"life_fnc_gangCreated",_ownerID,false] spawn life_fnc_MP; sleep 0.35; _query = format["SELECT id FROM gangs WHERE owner='%1' AND active='1'",_uid]; waitUntil{!DB_Async_Active}; _queryResult = [_query,2] call DB_fnc_asyncCall; _group setVariable["gang_id",(_queryResult select 0),true]; /* Author: Bryan "Tonic" Boardwine Description: Blah */ private["_group","_groupID"]; _group = [_this,0,grpNull,[grpNull]] call BIS_fnc_param; if(isNull _group) exitWith {}; _groupID = _group getVariable["gang_id",-1]; if(_groupID == -1) exitWith {}; waitUntil{!DB_Async_Active}; [format["UPDATE gangs SET active='0' WHERE id='%1'",_groupID],1] call DB_fnc_asyncCall; waitUntil{!DB_Async_Active}; _result = [format["SELECT id FROM gangs WHERE active='1' AND id='%1'",_groupID],2] call DB_fnc_asyncCall; if(count _result == 0) then { [[_gr