Files
DayZ-Epoch/SQF/dayz_code/actions/AdvancedTrading/functions/DZE_deleteTradedVehicle.sqf
A Man e72394d6da Remove ObjectID and ObjectUID from PVDZ_obj_Destroy calls
This is just the first commit for the removel of all global set ObjectIDs and ObjectUIDs.
Also objects will no longer be send over the network. Only the netID will. The actual object can be resolved with the netID on the server.
2022-03-24 17:17:45 +01:00

69 lines
2.3 KiB
Plaintext

private ["_localResult2","_VehKey2","_keyArr","_deleteRet","_vehicle","_delType","_containerFindKey"];
_VehKey2 = (_this select 0) select 0;
_delType = _this select 1;
_containerFindKey = {
private ["_keys","_weapTypes"];
_keys = [];
_weapTypes = (_this select 1) select 0;
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == (_this select 0)) then {
_keys set [count _keys, _x];
};
};
} forEach _weapTypes;
_keys;
};
if ((count _VehKey2) > 0) then {
if ((_VehKey2 select 0) == "0" || _delType in DZE_tradeVehicleKeyless || DZE_keepVehicleKey) then {
_localResult2 = 1;
} else {
{
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in DZE_itemKeys) then {
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == (_VehKey2 select 0)) then {
_localResult2 = [player,_x,1] call BIS_fnc_invRemove;
};
};
} forEach (items player);
if ((typeOf (unitBackPack player)) != "") then {
_keyArr = [(_VehKey2 select 0), (getWeaponCargo (unitBackpack player))] call _containerFindKey;
_deleteRet = [unitBackpack player,[],_keyArr,[]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
if (isNil "_localResult2") then {
_localResult2 = ((_deleteRet select 1) select 0);
} else {
if (_localResult2 == 0) then {
_localResult2 = ((_deleteRet select 1) select 0);
};
};
};
_vehicle = DZE_myVehicle;
if (count _this > 2 && {isNull _vehicle}) then {
_vehicle = _this select 2;
};
if (!isNull _vehicle) then {
_keyArr = [(_VehKey2 select 0), (getWeaponCargo _vehicle)] call _containerFindKey;
_deleteRet = [_vehicle,[],_keyArr,[]] call ZUPA_fnc_removeWeaponsAndMagazinesCargo;
if (isNil "_localResult2") then {
_localResult2 = ((_deleteRet select 1) select 0);
} else {
if (_localResult2 == 0) then {
_localResult2 = ((_deleteRet select 1) select 0);
};
};
};
if (!DZE_SaleRequiresKey) then {_localResult2 = 1;};
};
if (isNil "_localResult2") then {
_localResult2 = 0;
} else {
PVDZ_obj_Destroy = [netID player,netID (_VehKey2 select 1),dayz_authKey];
publicVariableServer "PVDZ_obj_Destroy";
//deleteVehicle (_VehKey2 select 1);
};
} else {
_localResult2 = 0;
};
_localResult2;