initial commit

This commit is contained in:
Benjamin Kyd
2019-06-05 00:45:50 +01:00
commit c8014ec81e
610 changed files with 177002 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_chopShopSell.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Checks whether or not the vehicle is persistent or temp and sells it.
*/
private ["_unit","_vehicle","_price","_cash","_ownerUnit"];
_unit = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_vehicle = [_this,1,objNull,[objNull]] call BIS_fnc_param;
_price = [_this,2,500,[0]] call BIS_fnc_param;
_cash = [_this,3,0,[0]] call BIS_fnc_param;
_ownerUnit = _unit getVariable "life_clientID";
//Error checks
if (isNull _vehicle || isNull _unit) exitWith {
life_action_inUse = false;
_ownerUnit publicVariableClient "life_action_inUse";
};
_displayName = FETCH_CONFIG2(getText,"CfgVehicles",typeOf _vehicle, "displayName");
_dbInfo = _vehicle getVariable ["dbInfo",[]];
if (count _dbInfo > 0) then {
_uid = (_dbInfo select 0);
_plate = (_dbInfo select 1);
_query = format ["UPDATE vehicles SET alive='0' WHERE pid='%1' AND plate='%2'",_uid,_plate];
_sql = [_query,1] call HC_fnc_asyncCall;
};
deleteVehicle _vehicle;
life_action_inUse = false;
_ownerUnit publicVariableClient "life_action_inUse";
CASH = _cash;
_ownerUnit publicVariableClient "life_cash";
[2,"STR_NOTF_ChopSoldCar",true,[_displayName,[_price] call life_fnc_numberText]] remoteExecCall ["life_fnc_broadcast",_unit];

View File

@@ -0,0 +1,44 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_getVehicles.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Sends a request to query the database information and returns vehicles.
*/
private ["_pid","_side","_type","_unit","_ret","_tickTime","_queryResult"];
_pid = [_this,0,"",[""]] call BIS_fnc_param;
_side = [_this,1,sideUnknown,[west]] call BIS_fnc_param;
_type = [_this,2,"",[""]] call BIS_fnc_param;
_unit = [_this,3,objNull,[objNull]] call BIS_fnc_param;
//Error checks
if (_pid isEqualTo "" || _side isEqualTo sideUnknown || _type isEqualTo "" || isNull _unit) exitWith {
if (!isNull _unit) then {
[[]] remoteExec ["life_fnc_impoundMenu",_unit];
};
};
_side = switch (_side) do {
case west:{"cop"};
case civilian: {"civ"};
case independent: {"med"};
default {"Error"};
};
if (_side == "Error") exitWith {
[[]] remoteExec ["life_fnc_impoundMenu",_unit];
};
_query = format ["SELECT id, side, classname, type, pid, alive, active, plate, color FROM vehicles WHERE pid='%1' AND alive='1' AND active='0' AND side='%2' AND type='%3'",_pid,_side,_type];
_tickTime = diag_tickTime;
_queryResult = [_query,2,true] call HC_fnc_asyncCall;
if (_queryResult isEqualType "") exitWith {
[[]] remoteExec ["life_fnc_impoundMenu",_unit];
};
[_queryResult] remoteExec ["life_fnc_impoundMenu",_unit];

View File

@@ -0,0 +1,45 @@
/*
File: fn_keyManagement.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Keeps track of an array locally on the server of a players keys.
*/
private ["_uid","_side","_input","_mode","_arr"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
_side = [_this,1,sideUnknown,[sideUnknown]] call BIS_fnc_param;
_mode = [_this,3,0,[0]] call BIS_fnc_param;
if (_uid isEqualTo "" || _side isEqualTo sideUnknown) exitWith {}; //BAAAAAAAAADDDDDDDD
switch (_mode) do {
case 0: {
_input = [_this,2,[],[[]]] call BIS_fnc_param;
_arr = [];
{
if (!isNull _x && {!(_x isKindOf "House")}) then {
_arr pushBack _x;
};
} forEach _input;
_arr = _arr - [objNull];
missionNamespace setVariable [format ["%1_KEYS_%2",_uid,_side],_arr];
};
case 1: {
_input = [_this,2,objNull,[objNull]] call BIS_fnc_param;
if (isNull _input || _input isKindOf "House") exitWith {};
_arr = missionNamespace getVariable [format ["%1_KEYS_%2",_uid,_side],[]];
_arr pushBack _input;
_arr = _arr - [objNull];
missionNamespace setVariable [format ["%1_KEYS_%2",_uid,_side],_arr];
};
case 2: {
_arr = missionNamespace getVariable [format ["%1_KEYS_%2",_uid,_side],[]];
_arr = _arr - [objNull];
missionNamespace setVariable [format ["%1_KEYS_%2",_uid,_side],_arr];
};
};

View File

@@ -0,0 +1,190 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_spawnVehicle.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Sends the query request to the database, if an array is returned then it creates
the vehicle if it's not in use or dead.
*/
private ["_vid","_sp","_pid","_query","_sql","_vehicle","_nearVehicles","_name","_side","_tickTime","_dir","_servIndex","_damage","_wasIllegal","_location"];
_vid = [_this,0,-1,[0]] call BIS_fnc_param;
_pid = [_this,1,"",[""]] call BIS_fnc_param;
_sp = [_this,2,[],[[],""]] call BIS_fnc_param;
_unit = [_this,3,objNull,[objNull]] call BIS_fnc_param;
_price = [_this,4,0,[0]] call BIS_fnc_param;
_dir = [_this,5,0,[0]] call BIS_fnc_param;
_spawntext = _this select 6;
_ownerID = _unit getVariable ["life_clientID",-1];
_unit_return = _unit;
_name = name _unit;
_side = side _unit;
//_unit = owner _unit;
if (_vid isEqualTo -1 || _pid isEqualTo "") exitWith {};
if (_vid in serv_sv_use) exitWith {};
serv_sv_use pushBack _vid;
_servIndex = serv_sv_use find _vid;
_query = format ["SELECT id, side, classname, type, pid, alive, active, plate, color, inventory, gear, fuel, damage, blacklist FROM vehicles WHERE id='%1' AND pid='%2'",_vid,_pid];
_tickTime = diag_tickTime;
_queryResult = [_query,2] call HC_fnc_asyncCall;
if (EXTDB_SETTING(getNumber,"DebugMode") isEqualTo 1) then {
diag_log "------------- Client Query Request -------------";
diag_log format ["QUERY: %1",_query];
diag_log format ["Time to complete: %1 (in seconds)",(diag_tickTime - _tickTime)];
diag_log format ["Result: %1",_queryResult];
diag_log "------------------------------------------------";
};
if (_queryResult isEqualType "") exitWith {};
_vInfo = _queryResult;
if (isNil "_vInfo") exitWith {serv_sv_use deleteAt _servIndex;};
if (count _vInfo isEqualTo 0) exitWith {serv_sv_use deleteAt _servIndex;};
if ((_vInfo select 5) isEqualTo 0) exitWith {
serv_sv_use deleteAt _servIndex;
[1,"STR_Garage_SQLError_Destroyed",true,[_vInfo select 2]] remoteExecCall ["life_fnc_broadcast",_unit];
};
if ((_vInfo select 6) isEqualTo 1) exitWith {
serv_sv_use deleteAt _servIndex;
[1,"STR_Garage_SQLError_Active",true,[_vInfo select 2]] remoteExecCall ["life_fnc_broadcast",_unit];
};
if (!(_sp isEqualType "")) then {
_nearVehicles = nearestObjects[_sp,["Car","Air","Ship"],10];
} else {
_nearVehicles = [];
};
if (count _nearVehicles > 0) exitWith {
serv_sv_use deleteAt _servIndex;
[_price,_unit_return] remoteExecCall ["life_fnc_garageRefund",_unit];
[1,"STR_Garage_SpawnPointError",true] remoteExecCall ["life_fnc_broadcast",_unit];
};
_query = format ["UPDATE vehicles SET active='1', damage='""[]""' WHERE pid='%1' AND id='%2'",_pid,_vid];
_trunk = [(_vInfo select 9)] call HC_fnc_mresToArray;
_gear = [(_vInfo select 10)] call HC_fnc_mresToArray;
_damage = [(_vInfo select 12)] call HC_fnc_mresToArray;
_wasIllegal = (_vInfo select 13);
_wasIllegal = if (_wasIllegal isEqualTo 1) then { true } else { false };
[_query,1] call HC_fnc_asyncCall;
if (_sp isEqualType "") then {
_vehicle = createVehicle[(_vInfo select 2),[0,0,999],[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_hs = nearestObjects[getMarkerPos _sp,["Land_Hospital_side2_F"],50] select 0;
_vehicle setPosATL (_hs modelToWorld [-0.4,-4,12.65]);
sleep 0.6;
} else {
_vehicle = createVehicle [(_vInfo select 2),_sp,[],0,"NONE"];
waitUntil {!isNil "_vehicle" && {!isNull _vehicle}};
_vehicle allowDamage false;
_vehicle setPos _sp;
_vehicle setVectorUp (surfaceNormal _sp);
_vehicle setDir _dir;
};
_vehicle allowDamage true;
//Send keys over the network.
[_vehicle] remoteExecCall ["life_fnc_addVehicle2Chain",_unit];
/*[_pid,_side,_vehicle,1] call HC_fnc_keyManagement;*/
[_pid,_side,_vehicle,1] remoteExecCall ["TON_fnc_keyManagement",RSERV];
_vehicle lock 2;
//Reskin the vehicle
[_vehicle,_vInfo select 8] remoteExecCall ["life_fnc_colorVehicle",_unit];
_vehicle setVariable ["vehicle_info_owners",[[_pid,_name]],true];
_vehicle setVariable ["dbInfo",[(_vInfo select 4),(_vInfo select 7)],true];
_vehicle disableTIEquipment true; //No Thermals.. They're cheap but addictive.
[_vehicle] call life_fnc_clearVehicleAmmo;
if (LIFE_SETTINGS(getNumber,"save_vehicle_virtualItems") isEqualTo 1) then {
_vehicle setVariable ["Trunk",_trunk,true];
if (_wasIllegal) then {
private _refPoint = if (_sp isEqualType "") then {getMarkerPos _sp;} else {_sp;};
private _distance = 100000;
private "_location";
{
private _tempLocation = nearestLocation [_refPoint, _x];
private _tempDistance = _refPoint distance _tempLocation;
if (_tempDistance < _distance) then {
_location = _tempLocation;
_distance = _tempDistance;
};
false
} count ["NameCityCapital", "NameCity", "NameVillage"];
_location = text _location;
[1,"STR_NOTF_BlackListedVehicle",true,[_location,_name]] remoteExecCall ["life_fnc_broadcast",west];
_query = format ["UPDATE vehicles SET blacklist='0' WHERE id='%1' AND pid='%2'",_vid,_pid];
_thread = [_query,1] call HC_fnc_asyncCall;
};
} else {
_vehicle setVariable ["Trunk",[[],0],true];
};
if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {
_vehicle setFuel (_vInfo select 11);
}else{
_vehicle setFuel 1;
};
if (count _gear > 0 && (LIFE_SETTINGS(getNumber,"save_vehicle_inventory") isEqualTo 1)) then {
_items = _gear select 0;
_mags = _gear select 1;
_weapons = _gear select 2;
_backpacks = _gear select 3;
for "_i" from 0 to ((count (_items select 0)) - 1) do {
_vehicle addItemCargoGlobal [((_items select 0) select _i), ((_items select 1) select _i)];
};
for "_i" from 0 to ((count (_mags select 0)) - 1) do {
_vehicle addMagazineCargoGlobal [((_mags select 0) select _i), ((_mags select 1) select _i)];
};
for "_i" from 0 to ((count (_weapons select 0)) - 1) do {
_vehicle addWeaponCargoGlobal [((_weapons select 0) select _i), ((_weapons select 1) select _i)];
};
for "_i" from 0 to ((count (_backpacks select 0)) - 1) do {
_vehicle addBackpackCargoGlobal [((_backpacks select 0) select _i), ((_backpacks select 1) select _i)];
};
};
if (count _damage > 0 && (LIFE_SETTINGS(getNumber,"save_vehicle_damage") isEqualTo 1)) then {
_parts = getAllHitPointsDamage _vehicle;
for "_i" from 0 to ((count _damage) - 1) do {
_vehicle setHitPointDamage [format ["%1",((_parts select 0) select _i)],_damage select _i];
};
};
//Sets of animations
if ((_vInfo select 1) isEqualTo "civ" && ((_vInfo select 2)) isEqualTo "B_Heli_Light_01_F" && !((_vInfo select 8) isEqualTo 13)) then {
[_vehicle,"civ_littlebird",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};
if ((_vInfo select 1) isEqualTo "cop" && ((_vInfo select 2)) in ["C_Offroad_01_F","B_MRAP_01_F","C_SUV_01_F","C_Hatchback_01_sport_F","B_Heli_Light_01_F","B_Heli_Transport_01_F"]) then {
[_vehicle,"cop_offroad",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};
if ((_vInfo select 1) isEqualTo "med" && ((_vInfo select 2)) isEqualTo "C_Offroad_01_F") then {
[_vehicle,"med_offroad",true] remoteExecCall ["life_fnc_vehicleAnimate",_unit];
};
[1,_spawntext] remoteExecCall ["life_fnc_broadcast",_unit];
serv_sv_use deleteAt _servIndex;

View File

@@ -0,0 +1,37 @@
/*
File: fn_vehicleCreate.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Answers the query request to create the vehicle in the database.
*/
private ["_uid","_side","_type","_classname","_color","_plate"];
_uid = [_this,0,"",[""]] call BIS_fnc_param;
_side = [_this,1,sideUnknown,[west]] call BIS_fnc_param;
_vehicle = [_this,2,objNull,[objNull]] call BIS_fnc_param;
_color = [_this,3,-1,[0]] call BIS_fnc_param;
//Error checks
if (_uid isEqualTo "" || _side isEqualTo sideUnknown || isNull _vehicle) exitWith {};
if (!alive _vehicle) exitWith {};
_className = typeOf _vehicle;
_type = switch (true) do {
case (_vehicle isKindOf "Car"): {"Car"};
case (_vehicle isKindOf "Air"): {"Air"};
case (_vehicle isKindOf "Ship"): {"Ship"};
};
_side = switch (_side) do {
case west:{"cop"};
case civilian: {"civ"};
case independent: {"med"};
default {"Error"};
};
_plate = round(random(1000000));
[_uid,_side,_type,_classname,_color,_plate] call HC_fnc_insertVehicle;
_vehicle setVariable ["dbInfo",[_uid,_plate],true];

View File

@@ -0,0 +1,23 @@
/*
File: fn_vehicleDelete.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Doesn't actually delete since we don't give our DB user that type of
access so instead we set it to alive=0 so it never shows again.
*/
diag_log "Script VehicleDelete HC";
private ["_vid","_sp","_pid","_query","_sql","_type","_thread"];
_vid = [_this,0,-1,[0]] call BIS_fnc_param;
_pid = [_this,1,"",[""]] call BIS_fnc_param;
_sp = [_this,2,2500,[0]] call BIS_fnc_param;
_unit = [_this,3,objNull,[objNull]] call BIS_fnc_param;
_type = [_this,4,"",[""]] call BIS_fnc_param;
if (_vid isEqualTo -1 || _pid isEqualTo "" || _sp isEqualTo 0 || isNull _unit || _type isEqualTo "") exitWith {};
_query = format ["UPDATE vehicles SET alive='0' WHERE pid='%1' AND id='%2'",_pid,_vid];
_thread = [_query,1] call HC_fnc_asyncCall;

View File

@@ -0,0 +1,154 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_vehicleStore.sqf
Author: Bryan "Tonic" Boardwine
This file is for Nanou's HeadlessClient.
Description:
Stores the vehicle in the 'Garage'
*/
private ["_vehicle","_impound","_vInfo","_vInfo","_plate","_uid","_query","_sql","_unit","_trunk","_vehItems","_vehMags","_vehWeapons","_vehBackpacks","_cargo","_saveItems","_storetext","_resourceItems","_fuel","_damage","_itemList","_totalweight","_weight"];
_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_impound = [_this,1,false,[true]] call BIS_fnc_param;
_unit = [_this,2,objNull,[objNull]] call BIS_fnc_param;
_storetext = [_this,3,"",[""]] call BIS_fnc_param;
_ownerID = _unit getVariable ["life_clientID",-1];
_resourceItems = LIFE_SETTINGS(getArray,"save_vehicle_items");
if (isNull _vehicle || isNull _unit) exitWith {life_impound_inuse = false; _ownerID publicVariableClient "life_impound_inuse";life_garage_store = false;_ownerID publicVariableClient "life_garage_store";}; //Bad data passed.
_vInfo = _vehicle getVariable ["dbInfo",[]];
if (count _vInfo > 0) then {
_plate = _vInfo select 1;
_uid = _vInfo select 0;
};
// save damage.
if (LIFE_SETTINGS(getNumber,"save_vehicle_damage") isEqualTo 1) then {
_damage = getAllHitPointsDamage _vehicle;
_damage = _damage select 2;
} else {
_damage = [];
};
_damage = [_damage] call HC_fnc_mresArray;
// because fuel price!
if (LIFE_SETTINGS(getNumber,"save_vehicle_fuel") isEqualTo 1) then {
_fuel = (fuel _vehicle);
} else {
_fuel = 1;
};
if (_impound) exitWith {
if (_vInfo isEqualTo []) then {
life_impound_inuse = false;
_ownerID publicVariableClient "life_impound_inuse";
if (!isNil "_vehicle" && {!isNull _vehicle}) then {
deleteVehicle _vehicle;
};
} else { // no free repairs!
_query = format ["UPDATE vehicles SET active='0', fuel='%3', damage='%4' WHERE pid='%1' AND plate='%2'",_uid , _plate, _fuel, _damage];
_thread = [_query,1] call HC_fnc_asyncCall;
if (!isNil "_vehicle" && {!isNull _vehicle}) then {
deleteVehicle _vehicle;
};
life_impound_inuse = false;
_ownerID publicVariableClient "life_impound_inuse";
};
};
// not persistent so just do this!
if (_vInfo isEqualTo []) exitWith {
[1,"STR_Garage_Store_NotPersistent",true] remoteExecCall ["life_fnc_broadcast",_ownerID];
life_garage_store = false;
_ownerID publicVariableClient "life_garage_store";
};
if !(_uid isEqualTo getPlayerUID _unit) exitWith {
[1,"STR_Garage_Store_NoOwnership",true] remoteExecCall ["life_fnc_broadcast",_ownerID];
life_garage_store = false;
_ownerID publicVariableClient "life_garage_store";
};
// sort out whitelisted items!
_trunk = _vehicle getVariable ["Trunk", [[], 0]];
_itemList = _trunk select 0;
_totalweight = 0;
_items = [];
if (LIFE_SETTINGS(getNumber,"save_vehicle_virtualItems") isEqualTo 1) then {
if (LIFE_SETTINGS(getNumber,"save_vehicle_illegal") isEqualTo 1) then {
_blacklist = false;
_profileQuery = format ["SELECT name FROM players WHERE pid='%1'", _uid];
_profileName = [_profileQuery, 2] call HC_fnc_asyncCall;
_profileName = _profileName select 0;
{
_isIllegal = M_CONFIG(getNumber,"VirtualItems",_x select 0,"illegal");
_isIllegal = if (_isIllegal isEqualTo 1) then { true } else { false };
if (((_x select 0) in _resourceItems) || (_isIllegal)) then {
_items pushBack[_x select 0, _x select 1];
_weight = (ITEM_WEIGHT(_x select 0)) * (_x select 1);
_totalweight = _weight + _totalweight;
};
if (_isIllegal) then {
_blacklist = true;
};
}
foreach _itemList;
if (_blacklist) then {
[_uid, _profileName, "481"] remoteExecCall["HC_fnc_wantedAdd", HC_Life];
_query = format ["UPDATE vehicles SET blacklist='1' WHERE pid='%1' AND plate='%2'", _uid, _plate];
_thread = [_query, 1] call HC_fnc_asyncCall;
};
}
else {
{
if ((_x select 0) in _resourceItems) then {
_items pushBack[_x select 0,_x select 1];
_weight = (ITEM_WEIGHT(_x select 0)) * (_x select 1);
_totalweight = _weight + _totalweight;
};
}
forEach _itemList;
};
_trunk = [_items, _totalweight];
}
else {
_trunk = [[], 0];
};
if (LIFE_SETTINGS(getNumber,"save_vehicle_inventory") isEqualTo 1) then {
_vehItems = getItemCargo _vehicle;
_vehMags = getMagazineCargo _vehicle;
_vehWeapons = getWeaponCargo _vehicle;
_vehBackpacks = getBackpackCargo _vehicle;
_cargo = [_vehItems,_vehMags,_vehWeapons,_vehBackpacks];
// no items? clean the array so the database looks pretty
if (((_vehItems select 0) isEqualTo []) && ((_vehMags select 0) isEqualTo []) && ((_vehWeapons select 0) isEqualTo []) && ((_vehBackpacks select 0) isEqualTo [])) then {_cargo = [];};
} else {
_cargo = [];
};
// prepare
_trunk = [_trunk] call HC_fnc_mresArray;
_cargo = [_cargo] call HC_fnc_mresArray;
// update
_query = format ["UPDATE vehicles SET active='0', inventory='%3', gear='%4', fuel='%5', damage='%6' WHERE pid='%1' AND plate='%2'", _uid, _plate, _trunk, _cargo, _fuel, _damage];
_thread = [_query,1] call HC_fnc_asyncCall;
if (!isNil "_vehicle" && {!isNull _vehicle}) then {
deleteVehicle _vehicle;
};
life_garage_store = false;
_ownerID publicVariableClient "life_garage_store";
[1,_storetext] remoteExecCall ["life_fnc_broadcast",_ownerID];

View File

@@ -0,0 +1,55 @@
#include "\life_hc\hc_macros.hpp"
/*
File: fn_vehicleUpdate.sqf
Author : NiiRoZz
This file is for Nanou's HeadlessClient.
Description:
Tells the database that this vehicle need update inventory.
*/
private ["_vehicle","_plate","_uid","_query","_sql","_dbInfo","_thread","_cargo","_trunk","_resourceItems","_itemList","_totalweight","_weight"];
_vehicle = [_this,0,objNull,[objNull]] call BIS_fnc_param;
_mode = [_this,1,1,[0]] call BIS_fnc_param;
if (isNull _vehicle) exitWith {}; //NULL
_dbInfo = _vehicle getVariable ["dbInfo",[]];
if (_dbInfo isEqualTo []) exitWith {};
_uid = _dbInfo select 0;
_plate = _dbInfo select 1;
switch (_mode) do {
case 1: {
_vehItems = getItemCargo _vehicle;
_vehMags = getMagazineCargo _vehicle;
_vehWeapons = getWeaponCargo _vehicle;
_vehBackpacks = getBackpackCargo _vehicle;
_cargo = [_vehItems,_vehMags,_vehWeapons,_vehBackpacks];
// Keep it clean!
if (((_vehItems select 0) isEqualTo []) && ((_vehMags select 0) isEqualTo []) && ((_vehWeapons select 0) isEqualTo []) && ((_vehBackpacks select 0) isEqualTo [])) then {_cargo = [];};
_cargo = [_cargo] call HC_fnc_mresArray;
_query = format ["UPDATE vehicles SET gear='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate,_cargo];
_thread = [_query,1] call HC_fnc_asyncCall;
};
case 2: {
_resourceItems = LIFE_SETTINGS(getArray,"save_vehicle_items");
_trunk = _vehicle getVariable ["Trunk",[[],0]];
_totalweight = 0;
_items = [];
{
if ((_x select 0) in _resourceItems) then {
_items pushBack [(_x select 0),(_x select 1)];
_weight = (ITEM_WEIGHT(_x select 0)) * (_x select 1);
_totalweight = _weight + _totalweight;
};
}forEach (_trunk select 0);
_trunk = [_items,_totalweight];
_trunk = [_trunk] call HC_fnc_mresArray;
_query = format ["UPDATE vehicles SET inventory='%3' WHERE pid='%1' AND plate='%2'",_uid,_plate,_trunk];
_thread = [_query,1] call HC_fnc_asyncCall;
};
};