Fix weapon dupe with server_playerSync

This reverts all the last changes to server_playerSync and creates a new global variable for dayz_onBack. This should be the best way to save the gear correct and still get dayz_onBack if the player leaves the server. This change removes the constant sending of the whole player inventory over the network from force or regluar_save. It should no longer be needed since the server does the counting now.
This commit is contained in:
A Man
2021-08-19 16:46:06 +02:00
parent 032e09c03e
commit 9852778ba9
14 changed files with 44 additions and 50 deletions

View File

@@ -8,7 +8,7 @@ That will interrupt actions like shooting. For loops use player_regularSave but
local _magazineArray = [] call player_countMagazines;
PVDZ_plr_Save = [player, if (player isKindOf "PZombie_VB") then {nil} else {_magazineArray},dayz_onBack,weapons player];
PVDZ_plr_Save = [player, if (player isKindOf "PZombie_VB") then {nil} else {_magazineArray}];
publicVariableServer "PVDZ_plr_Save";
//diag_log format["Player_forceSave with magazines: %1",_magazineArray];

View File

@@ -5,6 +5,7 @@ if (count _inventory > 0) then {
_mags = _inventory select 1;
dayz_onBack = if (count _inventory > 2) then { _inventory select 2 } else { "" };
player setVariable ["dayz_onBack",dayz_onBack,true];
//Add inventory
{

View File

@@ -28,6 +28,7 @@ local _ConfirmedBanditKills = player getVariable ["ConfirmedBanditKills",0];
local _friendlies = player getVariable ["friendlies",[]];
local _tagSetting = player getVariable ["DZE_display_name",false];
local _radiostate = player getVariable ["radiostate",false];
local _dayz_onBack = player getVariable ["dayz_onBack",""];
local _coins = 0;
local _bankCoins = 0;
local _globalCoins = 0;
@@ -97,6 +98,7 @@ player setVariable ["ConfirmedBanditKills",_ConfirmedBanditKills,true];
player setVariable ["friendlies",_friendlies,true];
player setVariable ["DZE_display_name",_tagSetting,true];
player setVariable ["radiostate",_radiostate];
player setVariable ["dayz_onBack",_dayz_onBack,true];
if (Z_SingleCurrency) then {
player setVariable ["cashMoney",_coins,true];

View File

@@ -15,5 +15,5 @@
local _magazineArray = (magazines player) - ["CSGAS","Hatchet_Swing","Crowbar_Swing","Machete_Swing","Bat_Swing","BatBarbed_Swing","BatNails_Swing","Fishing_Swing","Sledge_Swing"];
PVDZ_plr_Save = [player,_magazineArray,dayz_onBack,weapons player];
PVDZ_plr_Save = [player,_magazineArray];
publicVariableServer "PVDZ_plr_Save";