From 52a881b20dea6475fed8b6f0ff0d4d95ae377ac7 Mon Sep 17 00:00:00 2001 From: Mikeeeyy Date: Sun, 5 Apr 2015 19:05:12 +0100 Subject: [PATCH 1/4] [FIX] Inventory wiping dayz_Magazines isn't always set before syncing the character, and especially considering this is just on a loop makes it very unreliable. If you input an empty array to the server_playerSync then it will wipe your backpack and weapons aswell. Noticed this bug when players were complaining about it since I switched completely over to extDB. I've taken a look at the HiveExt.dll source and I'm pretty sure I found a check in there to see if the array is empty, which is still a hacky fix for this. I honestly wonder what the devs of DayZ were doing when they made this mod, honestly the coding is horrendous. I honestly just feel like making my own version of it from scratch sometimes. Rant over... sorry lol. Back on topic, using magazines player won't record the clip count in a magazine, but the only time that actually seems to be saved is when the gear dialog is closed because that's the only time you can record it using the gearIDC commands. --- SQF/dayz_code/system/player_spawn_2.sqf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 6f38f5b1a..2e220977f 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -206,11 +206,10 @@ while {true} do { //Save Checker if (dayz_unsaved) then { if ((time - dayz_lastSave) > DZE_SaveTime) then { - PVDZE_plr_Save = [player,dayz_Magazines,false,false]; + PVDZE_plr_Save = [player,magazines player,false,false]; publicVariableServer "PVDZE_plr_Save"; dayz_unsaved = false; dayz_lastSave = time; - dayz_Magazines = []; }; }; From fb189ddca2d825ceea27cad61ea73381dd1c34ea Mon Sep 17 00:00:00 2001 From: Mikeeeyy Date: Mon, 6 Apr 2015 00:47:33 +0100 Subject: [PATCH 2/4] Update player_spawn_2.sqf --- SQF/dayz_code/system/player_spawn_2.sqf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 2e220977f..1c45522df 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -1,4 +1,4 @@ -private ["_refObj","_size","_vel","_speed","_hunger","_thirst","_result","_factor","_distance","_lastTemp","_rnd","_listTalk","_id","_messTimer","_combatdisplay","_combatcontrol","_timeleft","_inVehicle","_lastUpdate","_foodVal","_thirstVal","_lowBlood","_startcombattimer","_combattimeout","_isPZombie","_outsideMap","_radsound","_bloodloss","_radTimer","_currentBlood","_wpnType"]; +private ["_refObj","_size","_vel","_speed","_hunger","_thirst","_result","_factor","_distance","_lastTemp","_rnd","_listTalk","_id","_messTimer","_combatdisplay","_combatcontrol","_timeleft","_inVehicle","_lastUpdate","_foodVal","_thirstVal","_lowBlood","_startcombattimer","_combattimeout","_isPZombie","_outsideMap","_radsound","_bloodloss","_radTimer","_currentBlood","_wpnType","_dayzMags"]; disableSerialization; _messTimer = 0; @@ -206,10 +206,12 @@ while {true} do { //Save Checker if (dayz_unsaved) then { if ((time - dayz_lastSave) > DZE_SaveTime) then { - PVDZE_plr_Save = [player,magazines player,false,false]; + _dayzMags = if (count dayz_Magazines > 0) then {dayz_Magazines} else {magazines player}; + PVDZE_plr_Save = [player,_dayzMags,false,false]; publicVariableServer "PVDZE_plr_Save"; dayz_unsaved = false; dayz_lastSave = time; + dayz_Magazines = []; }; }; From 6827f393dbff6cbec9e1a28a2fb30a54dd06753b Mon Sep 17 00:00:00 2001 From: Mikeeeyy Date: Tue, 7 Apr 2015 19:04:42 +0100 Subject: [PATCH 3/4] Fix undefined error Sanitize the variable before using it. --- SQF/dayz_code/system/player_spawn_2.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 1c45522df..28f66c0cb 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -206,7 +206,7 @@ while {true} do { //Save Checker if (dayz_unsaved) then { if ((time - dayz_lastSave) > DZE_SaveTime) then { - _dayzMags = if (count dayz_Magazines > 0) then {dayz_Magazines} else {magazines player}; + _dayzMags = if (!isNil "dayz_Magazines" && {typeName dayz_Magazines} == "ARRAY" && {count dayz_Magazines > 0}) then {dayz_Magazines} else {magazines player}; PVDZE_plr_Save = [player,_dayzMags,false,false]; publicVariableServer "PVDZE_plr_Save"; dayz_unsaved = false; From b6784a645de6563f62a493c7bf7d656fb403953d Mon Sep 17 00:00:00 2001 From: Mikeeeyy Date: Tue, 7 Apr 2015 19:30:57 +0100 Subject: [PATCH 4/4] Update player_spawn_2.sqf --- SQF/dayz_code/system/player_spawn_2.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 28f66c0cb..3b7fd8347 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -206,7 +206,7 @@ while {true} do { //Save Checker if (dayz_unsaved) then { if ((time - dayz_lastSave) > DZE_SaveTime) then { - _dayzMags = if (!isNil "dayz_Magazines" && {typeName dayz_Magazines} == "ARRAY" && {count dayz_Magazines > 0}) then {dayz_Magazines} else {magazines player}; + _dayzMags = if (!isNil "dayz_Magazines" && {typeName dayz_Magazines == "ARRAY"} && {count dayz_Magazines > 0}) then {dayz_Magazines} else {magazines player}; PVDZE_plr_Save = [player,_dayzMags,false,false]; publicVariableServer "PVDZE_plr_Save"; dayz_unsaved = false;