diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf
index b2d5eba7b..31ca345d9 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_allowBuying.sqf
@@ -1,7 +1,8 @@
private ["_selection","_return","_toBuyWeaps","_toBuyMags","_toBuyBags","_toolsToBuy","_sidearmToBuy","_primaryToBuy","_currentPrimarys"
,"_currentSecondarys","_currentSec","_currentPrim","_currentTool","_p","_s","_b","_check0","_check1","_check2","_check3","_check4","_mags","_weaps","_bags"
,"_normalBags","_normalMags","_normalWeaps","_allowedMags","_allowedPrimary","_allowedTools","_allowedSidearm","_allowedWeapons","_allowedBackpacks"
-,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3"
+,"_totalSpace","_totalNewSpace","_counter","_parentClasses","_alreadyInBackpack","_kinds","_kinds2","_kinds3","_ammmounts","_ammmounts2","_ammmounts3",
+"_actualMags"
];
_selection = Z_SellingFrom;
_return = false;
@@ -19,7 +20,8 @@ if (_vehiclesToBuy > 0) then {
};
if(_selection == 2) then{ //gear
- _allowedMags = 20 - count(magazines player);
+ _actualMags = {!(_x in MeleeMagazines)} count (magazines player);
+ _allowedMags = 20 - _actualMags;
_currentPrimarys = 0;
diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf
index e7584d1bc..c711c09d5 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_calculateFreeSpace.sqf
@@ -1,11 +1,12 @@
private["_selection","_returnArray","_allowedMags","_allowedWeapons","_allowedBackpacks","_allowedTools","_allowedPrimary","_allowedSidearm","_formattedText","_pic"
-,"_backpack","_backpackAmount","_vehicleWeapons","_vehicleMagazines","_vehicleBackpacks","_tempWeaponsArray","_tempBackpackArray","_tempMagazinesArray"];
+,"_backpack","_backpackAmount","_vehicleWeapons","_vehicleMagazines","_vehicleBackpacks","_tempWeaponsArray","_tempBackpackArray","_tempMagazinesArray","_actualMags"];
#include "defines.sqf";
_selection = _this select 0;
_returnArray = [0,0,0];
if(_selection == 2) then{ //gear
- _allowedMags = 20 - count(magazines player);
+ _actualMags = {!(_x in MeleeMagazines)} count (magazines player);
+ _allowedMags = 20 - _actualMags;
_allowedWeapons = 14 - count(weapons player);
_pic = getText (configFile >> 'CfgVehicles' >> (typeOf player) >> 'picture');
diff --git a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf
index d62041e22..e20c02df9 100644
--- a/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf
+++ b/SQF/dayz_code/actions/AdvancedTrading/functions/z_at_getGearItems.sqf
@@ -21,7 +21,7 @@ if (!isNil '_pic' && _pic == "") then {
};
_formattedText = format [
- " %2 "
+ "%1 %2"
, _pic, localize "STR_UI_GEAR"
];
diff --git a/SQF/dayz_code/actions/player_Constructionitem.sqf b/SQF/dayz_code/actions/player_Constructionitem.sqf
index 6f9816ccd..c4fd9ddc3 100644
--- a/SQF/dayz_code/actions/player_Constructionitem.sqf
+++ b/SQF/dayz_code/actions/player_Constructionitem.sqf
@@ -51,6 +51,8 @@ _hasInput = true;
} forEach (_input + _required);
if (_hasInput) then {
+ //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
+ {player removeMagazines _x} count MeleeMagazines;
_freeSlots = [player] call BIS_fnc_invSlotsEmpty;
{
_item = _x select 0;
diff --git a/SQF/dayz_code/actions/player_buildingDowngrade.sqf b/SQF/dayz_code/actions/player_buildingDowngrade.sqf
index 3d0dfb374..651558ca4 100644
--- a/SQF/dayz_code/actions/player_buildingDowngrade.sqf
+++ b/SQF/dayz_code/actions/player_buildingDowngrade.sqf
@@ -84,6 +84,8 @@ if ((count _upgrade) > 0) then {
_abortInvAdd = false;
_i = 0;
_addedItems = [];
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
{
_itemOut = _x select 0;
diff --git a/SQF/dayz_code/actions/player_craftItemVanilla.sqf b/SQF/dayz_code/actions/player_craftItemVanilla.sqf
index 0ec6ee735..1b11d3d35 100644
--- a/SQF/dayz_code/actions/player_craftItemVanilla.sqf
+++ b/SQF/dayz_code/actions/player_craftItemVanilla.sqf
@@ -87,6 +87,8 @@ if(!r_drag_sqf and !r_player_unconscious and !_onLadder) then {
} forEach (_input);
if (_hasInput) then {
+ //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
+ {player removeMagazines _x} count MeleeMagazines;
_freeSlots = [player] call BIS_fnc_invSlotsEmpty;
{
_item = _x select 0;
diff --git a/SQF/dayz_code/actions/player_craftitemGUI.sqf b/SQF/dayz_code/actions/player_craftitemGUI.sqf
index bab4b4bf0..ab7b8ded7 100644
--- a/SQF/dayz_code/actions/player_craftitemGUI.sqf
+++ b/SQF/dayz_code/actions/player_craftitemGUI.sqf
@@ -76,6 +76,8 @@ if (count _nearByPile > 0) then {
} forEach (_input + _required);
if (_hasInput) then {
+ //Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
+ {player removeMagazines _x} count MeleeMagazines;
_freeSlots = [player] call BIS_fnc_invSlotsEmpty;
{
_item = _x select 0;
diff --git a/SQF/dayz_code/actions/player_harvestPlant.sqf b/SQF/dayz_code/actions/player_harvestPlant.sqf
index 2c17464c6..4b244c1ba 100644
--- a/SQF/dayz_code/actions/player_harvestPlant.sqf
+++ b/SQF/dayz_code/actions/player_harvestPlant.sqf
@@ -93,7 +93,8 @@ if (count(_findNearestTree) >= 1) then {
};
if (_proceed) then {
-
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
_invResult = false;
_i = 0;
for "_x" from 1 to _countOut do {
diff --git a/SQF/dayz_code/actions/player_removeAttachment.sqf b/SQF/dayz_code/actions/player_removeAttachment.sqf
index 68ef2f5cf..23b3dc7ff 100644
--- a/SQF/dayz_code/actions/player_removeAttachment.sqf
+++ b/SQF/dayz_code/actions/player_removeAttachment.sqf
@@ -26,6 +26,8 @@ _weapon = _this select 1;
_newWeapon = _this select 2;
//check that player has enough room in inventory
+//Remove melee magazines (BIS_fnc_invAdd and BIS_fnc_invSlotsEmpty fix)
+{player removeMagazines _x} count MeleeMagazines;
if ((([player] call BIS_fnc_invSlotsEmpty) select 4) < 1) exitWith
{
closeDialog 0;
diff --git a/SQF/dayz_code/actions/player_tearClothes.sqf b/SQF/dayz_code/actions/player_tearClothes.sqf
index 2ddaadda1..5a4b62c37 100644
--- a/SQF/dayz_code/actions/player_tearClothes.sqf
+++ b/SQF/dayz_code/actions/player_tearClothes.sqf
@@ -31,6 +31,8 @@ switch (_rounded) do {
};
};
+//Remove melee magazines (BIS_fnc_invAdd fix)
+{player removeMagazines _x} count MeleeMagazines;
_i = 0;
while {_i < _rounded} do {
_i = _i + 1;
diff --git a/SQF/dayz_code/actions/plotManagement/maintain_areaSC.sqf b/SQF/dayz_code/actions/plotManagement/maintain_areaSC.sqf
index 497358451..32d3dc777 100644
--- a/SQF/dayz_code/actions/plotManagement/maintain_areaSC.sqf
+++ b/SQF/dayz_code/actions/plotManagement/maintain_areaSC.sqf
@@ -63,9 +63,7 @@ switch _option do {
[player,_range,true,(getPosATL player)] spawn player_alertZombies;
player setVariable["cashMoney",_newWealth,true];
-
- PVDZ_plr_Save = [player,(magazines player),true,true];
- publicVariableServer "PVDZ_plr_Save";
+ call player_forceSave;
PVDZE_maintainArea = [player,1,_target];
publicVariableServer "PVDZE_maintainArea";
diff --git a/SQF/dayz_code/actions/salvage.sqf b/SQF/dayz_code/actions/salvage.sqf
index 80c588246..2d374235e 100644
--- a/SQF/dayz_code/actions/salvage.sqf
+++ b/SQF/dayz_code/actions/salvage.sqf
@@ -44,6 +44,8 @@ if (_hasToolbox) then {
r_doLoop = false;
if (_finished) then {
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
_damage = [_vehicle,_hitpoint] call object_getHit;
if (_damage < 0.10) then {
_BreakableParts = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitLGlass","HitRGlass","HitEngine","HitFuel","HitHRotor"];
@@ -55,10 +57,7 @@ if (_hasToolbox) then {
_isOK = [player,_part] call BIS_fnc_invAdd;
_brokenPart = false;
};
- } else {
- //Remove melee ammo due to the way ammo is working.
- {player removeMagazines _x} count MeleeMagazines;
-
+ } else {
_isOK = [player,_part] call BIS_fnc_invAdd;
_brokenPart = false;
};
diff --git a/SQF/dayz_code/actions/trade_any_boat.sqf b/SQF/dayz_code/actions/trade_any_boat.sqf
index bc02a472e..a1728f93f 100644
--- a/SQF/dayz_code/actions/trade_any_boat.sqf
+++ b/SQF/dayz_code/actions/trade_any_boat.sqf
@@ -128,7 +128,9 @@ if (_finished) then {
_keySelected = format["ItemKey%1%2",_keyColor,_keyNumber];
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
-
+
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
diff --git a/SQF/dayz_code/actions/trade_any_boat_old.sqf b/SQF/dayz_code/actions/trade_any_boat_old.sqf
index a3709ee0c..65726995a 100644
--- a/SQF/dayz_code/actions/trade_any_boat_old.sqf
+++ b/SQF/dayz_code/actions/trade_any_boat_old.sqf
@@ -109,6 +109,8 @@ if (_qty >= _qty_in) then {
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"};
diff --git a/SQF/dayz_code/actions/trade_any_vehicle.sqf b/SQF/dayz_code/actions/trade_any_vehicle.sqf
index 33c324a7f..1f0eb396c 100644
--- a/SQF/dayz_code/actions/trade_any_vehicle.sqf
+++ b/SQF/dayz_code/actions/trade_any_vehicle.sqf
@@ -127,7 +127,9 @@ if (_finished) then {
_keySelected = format["ItemKey%1%2",_keyColor,_keyNumber];
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
-
+
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
diff --git a/SQF/dayz_code/actions/trade_any_vehicle_old.sqf b/SQF/dayz_code/actions/trade_any_vehicle_old.sqf
index 7e830e513..b9609b7d8 100644
--- a/SQF/dayz_code/actions/trade_any_vehicle_old.sqf
+++ b/SQF/dayz_code/actions/trade_any_vehicle_old.sqf
@@ -116,6 +116,8 @@ if (_qty >= _qty_in) then {
_isKeyOK = isClass(configFile >> "CfgWeapons" >> _keySelected);
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
_config = _keySelected;
_isOk = [player,_config] call BIS_fnc_invAdd;
waitUntil {!isNil "_isOk"};
diff --git a/SQF/dayz_code/actions/trade_items.sqf b/SQF/dayz_code/actions/trade_items.sqf
index dae790b59..9221b9c36 100644
--- a/SQF/dayz_code/actions/trade_items.sqf
+++ b/SQF/dayz_code/actions/trade_items.sqf
@@ -1,4 +1,4 @@
-private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_activatingPlayer","_traderID","_done"];
+private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_bos","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_activatingPlayer","_traderID","_done","_actualMags"];
// [part_out,part_in, qty_out, qty_in,];
if (DZE_ActionInProgress) exitWith {localize "str_epoch_player_103" call dayz_rollingMessages;};
@@ -29,8 +29,8 @@ while {r_autoTrade} do {
_removed = 0;
// check if current magazine count is greater than 20
-
- if ((count (magazines player)) > 20) exitWith {localize "str_player_24" call dayz_rollingMessages; r_autoTrade = false};
+ _actualMags = {!(_x in MeleeMagazines)} count (magazines player);
+ if (_actualMags > 20) exitWith {localize "str_player_24" call dayz_rollingMessages; r_autoTrade = false};
_canAfford = false;
if(_bos == 1) then {
diff --git a/SQF/dayz_code/compile/fn_addDuplicateTool.sqf b/SQF/dayz_code/compile/fn_addDuplicateTool.sqf
index 0fcf51c24..ab305c368 100644
--- a/SQF/dayz_code/compile/fn_addDuplicateTool.sqf
+++ b/SQF/dayz_code/compile/fn_addDuplicateTool.sqf
@@ -34,6 +34,9 @@ if (_this in items player) then {
_this call _dropOnFloor;
};
} else {
+ //Remove melee magazines (BIS_fnc_invAdd fix)
+ {player removeMagazines _x} count MeleeMagazines;
+
if !([player,_this] call BIS_fnc_invAdd) then {
systemChat localize "str_epoch_player_107";
_this call _dropOnFloor;