mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-14 04:02:37 +03:00
Fix keys not deleting
Should work fine, but more validation is always good, I tested selling from all inventories with DZE_SaleRequiresKey true and false.
This commit is contained in:
@@ -6,27 +6,24 @@
|
||||
Author:
|
||||
Zupa 2014-09-30
|
||||
---------------------------------------------------------------------------- */
|
||||
private ["_unit","_items","_weaps","_normalItems","_normalWeaps","_unit_allItems","_unit_allItems_types","_unit_allItems_count","_bags","_vehInfo","_keyID","_counter","_normalBagss","_inCargo","_deleteVeh","_normalBags","_unit_allWeaps","_unit_allWeaps_types","_unit_allWeaps_count","_unit_allBags","_unit_allBags_types","_unit_allBags_count","_returnVar","_returnMag","_returnWeap","_returnBag"];
|
||||
private ["_bags","_vehInfo","_forEachIndex","_counter","_normalBagss","_inCargo","_unit","_items","_weaps","_normalItems","_normalWeaps","_normalBags","_unit_allItems","_unit_allItems_types","_unit_allItems_count","_unit_allWeaps","_unit_allWeaps_types","_unit_allWeaps_count","_unit_allBags","_unit_allBags_types","_unit_allBags_count","_returnVar","_returnMag","_returnWeap","_returnBag"];
|
||||
|
||||
_unit = _this select 0;
|
||||
_items = _this select 1;
|
||||
_weaps = _this select 2;
|
||||
_bags = [];
|
||||
_vehInfo = [];
|
||||
_keyID = 0;
|
||||
_deleteVeh = false;
|
||||
|
||||
if(count _this > 3) then {
|
||||
if (count (_this select 3) > 0) then {
|
||||
if (typeName ((_this select 3) select 0) == "STRING") then {
|
||||
_bags = _this select 3;
|
||||
} else {
|
||||
_vehInfo = (_this select 3) select 0;
|
||||
_keyID = _vehInfo select 0;
|
||||
_vehInfo = _this select 3;
|
||||
};
|
||||
};
|
||||
if (count _this == 5) then {
|
||||
_vehInfo = (_this select 4) select 0;
|
||||
_keyID = _vehInfo select 0;
|
||||
_vehInfo = _this select 4;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -106,30 +103,11 @@ _normalItems = _normalItems - ["soldItem"];
|
||||
_unit addBackpackCargoGlobal [_x, 1];
|
||||
}count _normalBags;
|
||||
|
||||
|
||||
if (count _vehInfo > 0) then {
|
||||
if (!((_vehInfo select 4) in ["trade_any_bicycle", "trade_any_bicycle_old", "trade_any_vehicle_free"])) then {
|
||||
{
|
||||
if (configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]) then {
|
||||
if (str(getNumber(configFile >> "CfgWeapons" >> _x >> "keyid")) == _keyID) then {
|
||||
_weaps set [count _weaps, _x];
|
||||
_deleteVeh = True;
|
||||
};
|
||||
};
|
||||
} count _normalWeaps;
|
||||
if (_keyID == "0" || !DZE_SaleRequiresKey) then {_deleteVeh = True;};
|
||||
} else {
|
||||
_deleteVeh = True;
|
||||
};
|
||||
};
|
||||
|
||||
{
|
||||
_inCargo = _normalWeaps find _x;
|
||||
if(_inCargo > -1)then{
|
||||
_normalWeaps set [_inCargo, "soldItem"];
|
||||
if (!_deleteVeh && {(!(configName(inheritsFrom(configFile >> "CfgWeapons" >> _x)) in ["ItemKeyYellow","ItemKeyBlue","ItemKeyRed","ItemKeyGreen","ItemKeyBlack"]))}) then {
|
||||
_returnWeap set [count(_returnWeap),1];
|
||||
};
|
||||
_returnWeap set [count(_returnWeap),1];
|
||||
}else{
|
||||
_returnWeap set [count(_returnWeap),0];
|
||||
};
|
||||
@@ -141,15 +119,15 @@ _normalWeaps = _normalWeaps - ["soldItem"];
|
||||
}count _normalWeaps;
|
||||
_normalWeaps = _normalWeaps - ["soldItem"];
|
||||
|
||||
if (count _vehInfo > 0) then {
|
||||
_sell = [_vehInfo, ((_vehInfo select 0) select 4), _unit] call DZE_deleteTradedVehicle;
|
||||
if (_sell > 0) then {
|
||||
_returnVar set [3,[1]];
|
||||
};
|
||||
};
|
||||
|
||||
_returnVar set [0,_returnMag];
|
||||
_returnVar set [1,_returnWeap];
|
||||
_returnVar set [2,_returnBag];
|
||||
|
||||
if (_deleteVeh) then {
|
||||
_returnVar set [3,[1]];
|
||||
PVDZ_obj_Destroy = [(_vehInfo select 2),(_vehInfo select 3),player];
|
||||
publicVariableServer "PVDZ_obj_Destroy";
|
||||
deleteVehicle (_vehInfo select 1);
|
||||
};
|
||||
|
||||
_returnVar;
|
||||
Reference in New Issue
Block a user