From 1697af97147c919647f9e3554c57ad0ef784cfd1 Mon Sep 17 00:00:00 2001 From: AirwavesMan Date: Sun, 15 Nov 2020 17:49:33 +0100 Subject: [PATCH] Fix weapon on back dupe --- SQF/dayz_code/actions/pickupActions/object_pickup.sqf | 2 +- SQF/dayz_code/actions/pzombie/pz_feed.sqf | 2 +- SQF/dayz_code/compile/player_forceSave.sqf | 2 +- SQF/dayz_code/system/player_spawn_2.sqf | 4 ++-- SQF/dayz_server/compile/server_onPlayerDisconnect.sqf | 2 +- SQF/dayz_server/compile/server_playerSync.sqf | 7 +++---- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/SQF/dayz_code/actions/pickupActions/object_pickup.sqf b/SQF/dayz_code/actions/pickupActions/object_pickup.sqf index 2ec55def4..4bf10b9d8 100644 --- a/SQF/dayz_code/actions/pickupActions/object_pickup.sqf +++ b/SQF/dayz_code/actions/pickupActions/object_pickup.sqf @@ -53,7 +53,7 @@ if (_classname isKindOf "Bag_Base_EP1") exitWith { waitUntil { !isNull (unitBackpack player) }; uiSleep 0.03; - PVDZ_plr_Save = [player,nil,false]; + PVDZ_plr_Save = [player,nil,dayz_onBack]; publicVariableServer "PVDZ_plr_Save"; }; diff --git a/SQF/dayz_code/actions/pzombie/pz_feed.sqf b/SQF/dayz_code/actions/pzombie/pz_feed.sqf index ccf610fc0..5cd6cf9cb 100644 --- a/SQF/dayz_code/actions/pzombie/pz_feed.sqf +++ b/SQF/dayz_code/actions/pzombie/pz_feed.sqf @@ -63,7 +63,7 @@ if !(alive _item) then { dayz_lastMeal = time; dayz_hunger = 0; - PVDZ_plr_Save = [player,nil,true]; + PVDZ_plr_Save = [player,nil,dayz_onBack]; publicVariableServer "PVDZ_plr_Save"; [player,"eat",0,false] call dayz_zombieSpeak; diff --git a/SQF/dayz_code/compile/player_forceSave.sqf b/SQF/dayz_code/compile/player_forceSave.sqf index 279aaff30..59a9ecdef 100644 --- a/SQF/dayz_code/compile/player_forceSave.sqf +++ b/SQF/dayz_code/compile/player_forceSave.sqf @@ -7,7 +7,7 @@ Opens player inventory to save _magazineArray = [] call player_countMagazines; if ((count _magazineArray) > 0) then { - PVDZ_plr_Save = [player, if (player isKindOf "PZombie_VB") then {nil} else {[_magazineArray,dayz_onBack]}]; + PVDZ_plr_Save = [player, if (player isKindOf "PZombie_VB") then {nil} else {_magazineArray},dayz_onBack]; publicVariableServer "PVDZ_plr_Save"; }; diff --git a/SQF/dayz_code/system/player_spawn_2.sqf b/SQF/dayz_code/system/player_spawn_2.sqf index 54ff15a6a..435938eb7 100644 --- a/SQF/dayz_code/system/player_spawn_2.sqf +++ b/SQF/dayz_code/system/player_spawn_2.sqf @@ -240,7 +240,7 @@ while {1 == 1} do { player setVariable ["USEC_lowBlood",true,true]; }; } else { - if (_lowBlood && {!r_player_injured}) then { + if (_lowBlood && !r_player_injured) then { player setVariable ["USEC_lowBlood",false,true]; r_player_lowblood = false; }; @@ -260,7 +260,7 @@ while {1 == 1} do { if (dayz_unsaved || {(diag_ticktime - dayz_lastSave) > 300}) then { if ((diag_ticktime - dayz_lastSave) > _saveTime) then { - PVDZ_plr_Save = [player,nil,false]; + PVDZ_plr_Save = [player,nil,dayz_onBack]; publicVariableServer "PVDZ_plr_Save"; dayz_unsaved = false; dayz_lastSave = diag_ticktime; diff --git a/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf b/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf index 6eb546e86..b812ac3f9 100644 --- a/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf +++ b/SQF/dayz_server/compile/server_onPlayerDisconnect.sqf @@ -59,7 +59,7 @@ if (_characterID != "?") then { //if player object is alive lets sync the player and remove the body and if ghosting is active add the player id to the array if (alive _playerObj) then { // High priority. Sync must finish fast before player object isNull - [_playerObj,nil,true,[],_inCombat] call server_playerSync; + [_playerObj,nil,"",[],_inCombat] call server_playerSync; /* Low priority code below this point where diff --git a/SQF/dayz_server/compile/server_playerSync.sqf b/SQF/dayz_server/compile/server_playerSync.sqf index 8f09f7b11..c85032263 100644 --- a/SQF/dayz_server/compile/server_playerSync.sqf +++ b/SQF/dayz_server/compile/server_playerSync.sqf @@ -9,6 +9,7 @@ private ["_distanceFoot","_playerPos","_lastPos","_playerGear","_medical","_curr _character = _this select 0; _magazines = _this select 1; +local _dayz_onBack = _this select 2; _characterID = _character getVariable ["characterID","0"]; _playerUID = getPlayerUID _character; _charPos = getPosATL _character; @@ -58,10 +59,8 @@ _killsB = _statsDiff select 4; _charPosLen = count _charPos; if (!isNil "_magazines") then { - if (typeName _magazines == "ARRAY") then { - _playerGear = [weapons _character,_magazines select 0,_magazines select 1]; - _character setVariable["ServerMagArray",_magazines, false]; - }; + _playerGear = [weapons _character,_magazines,_dayz_onBack]; + _character setVariable["ServerMagArray",[_magazines,_dayz_onBack], false]; } else { //check Magazines everytime they aren't sent by player_forceSave _magTemp = (_lastMagazines select 0);