From 979751d3028c8a787379c7caf8cfb6ea57d7d883 Mon Sep 17 00:00:00 2001 From: AirwavesMan Date: Mon, 8 Mar 2021 15:07:13 +0100 Subject: [PATCH] Update PVDZ_plr_Save to prevent dayz_onBack dupe Thx to mmrsz from discord. PVDZ_plr_Save sends the current weapons from the player too now. This is needed to prevent the dayz_onBack dupe if the server has low fps. --- SQF/dayz_code/compile/player_forceSave.sqf | 4 ++-- SQF/dayz_code/compile/player_regularSave.sqf | 4 ++-- SQF/dayz_server/compile/server_playerSync.sqf | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SQF/dayz_code/compile/player_forceSave.sqf b/SQF/dayz_code/compile/player_forceSave.sqf index 59a9ecdef..8259f8ba5 100644 --- a/SQF/dayz_code/compile/player_forceSave.sqf +++ b/SQF/dayz_code/compile/player_forceSave.sqf @@ -7,10 +7,10 @@ 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,weapons player]; publicVariableServer "PVDZ_plr_Save"; }; //diag_log format["Player_forceSave with magazines: %1",_magazineArray]; - + dayz_lastSave = diag_tickTime; diff --git a/SQF/dayz_code/compile/player_regularSave.sqf b/SQF/dayz_code/compile/player_regularSave.sqf index f0605d789..1f63a5bca 100644 --- a/SQF/dayz_code/compile/player_regularSave.sqf +++ b/SQF/dayz_code/compile/player_regularSave.sqf @@ -4,7 +4,7 @@ Email: N/A Creation date: 2020-12-30 17:20:00 - Last modified time: 2020-12-30 17:34:00 + Last modified time: 2021-03-08 14:04:00 Description: Requests a simple save for the player object. Example: @@ -13,5 +13,5 @@ Nothing */ -PVDZ_plr_Save = [player,nil,dayz_onBack]; +PVDZ_plr_Save = [player,nil,dayz_onBack,weapons player]; publicVariableServer "PVDZ_plr_Save"; \ No newline at end of file diff --git a/SQF/dayz_server/compile/server_playerSync.sqf b/SQF/dayz_server/compile/server_playerSync.sqf index 3ae756a3d..1ef129ebb 100644 --- a/SQF/dayz_server/compile/server_playerSync.sqf +++ b/SQF/dayz_server/compile/server_playerSync.sqf @@ -3,6 +3,7 @@ local _character = _this select 0; local _magazines = _this select 1; local _dayz_onBack = _this select 2; +local _weapons = _this select 3; local _characterID = _character getVariable ["characterID","0"]; local _playerUID = getPlayerUID _character; local _charPos = getPosATL _character; @@ -53,7 +54,7 @@ local _charPosLen = count _charPos; local _magTemp = []; if (!isNil "_magazines") then { - _playerGear = [weapons _character,_magazines,_dayz_onBack]; + _playerGear = [_weapons,_magazines,_dayz_onBack]; _character setVariable["ServerMagArray",[_magazines,_dayz_onBack], false]; } else { //check Magazines everytime they aren't sent by player_forceSave @@ -78,7 +79,7 @@ if (!isNil "_magazines") then { _magazines = _magTemp - ["0"]; _magazines = [_magazines, (_lastMagazines select 1)]; _character setVariable["ServerMagArray",_magazines, false]; - _playerGear = [weapons _character,_magazines select 0,_magazines select 1]; + _playerGear = [_weapons,_magazines select 0,_magazines select 1]; }; };