This reverts commit 4bbb3ac609, reversing
changes made to 96f1d40a71.
This commit is contained in:
seelenapparat
2021-08-24 15:32:43 +02:00
parent 4bbb3ac609
commit 109ec5c9a3
145 changed files with 629 additions and 9202 deletions

View File

@@ -2,7 +2,8 @@
local _character = _this select 0;
local _magazines = _this select 1;
local _dayz_onBack = _character getVariable ["dayz_onBack",""];
local _dayz_onBack = _this select 2;
local _weaponsPlayer = _this select 3;
local _characterID = _character getVariable ["characterID","0"];
local _playerUID = getPlayerUID _character;
local _charPos = getPosATL _character;
@@ -40,7 +41,7 @@ local _usec_Dead = _character getVariable ["USEC_isDead",false];
local _lastTime = _character getVariable ["lastTime",-1];
local _modelChk = _character getVariable ["model_CHK",""];
local _temp = round (_character getVariable ["temperature",100]);
local _lastMagazines = _character getVariable ["ServerMagArray",[]];
local _lastMagazines = _character getVariable ["ServerMagArray",[[],"",[]]];
//Get difference between current stats and stats at last sync
local _statsDiff = [_character,_playerUID] call server_getStatsDiff;
_humanity = _statsDiff select 0;
@@ -53,12 +54,17 @@ local _charPosLen = count _charPos;
local _magTemp = [];
if (!isNil "_magazines") then {
_playerGear = [weapons _character,_magazines,_dayz_onBack];
_character setVariable["ServerMagArray",_magazines, false];
_playerGear = [_weaponsPlayer,_magazines,_dayz_onBack];
_character setVariable["ServerMagArray",[_magazines,_dayz_onBack,_weaponsPlayer], false];
} else {
//check Magazines everytime they aren't sent by player_forceSave
_magTemp = _lastMagazines;
_magTemp = (_lastMagazines select 0);
if (isNil "_dayz_onBack") then {
_dayz_onBack = _lastMagazines select 1;
};
if (isNil "_weaponsPlayer") then {
_weaponsPlayer = _lastMagazines select 2;
};
if (count _magTemp > 0) then {
_magazines = [(magazines _character),20] call array_reduceSize;
{
@@ -67,7 +73,7 @@ if (!isNil "_magazines") then {
_class = _x select 0;
};
if (_class in _magazines) then {
local _MatchedCount = {local _compare = if (typeName _x == "ARRAY") then {_x select 0;} else {_x}; _compare == _class} count _magTemp;
local _MatchedCount = {_compare = if (typeName _x == "ARRAY") then {_x select 0;} else {_x}; _compare == _class} count _magTemp;
local _CountedActual = {_x == _class} count _magazines;
if (_MatchedCount > _CountedActual) then {
_magTemp set [_forEachIndex, "0"];
@@ -75,15 +81,16 @@ if (!isNil "_magazines") then {
} else {
_magTemp set [_forEachIndex, "0"];
};
} forEach _lastMagazines;
} forEach (_lastMagazines select 0);
_magazines = _magTemp - ["0"];
_magazines = [_magazines,_dayz_onBack,_weaponsPlayer];
_character setVariable["ServerMagArray",_magazines, false];
_playerGear = [weapons _character,_magazines,_dayz_onBack];
_playerGear = [_magazines select 2,_magazines select 0,_magazines select 1];
} else {
_magazines = _magTemp;
_magazines = [_magTemp,_dayz_onBack,_weaponsPlayer];
};
_character setVariable["ServerMagArray",_magazines, false];
_playerGear = [weapons _character,_magazines,_dayz_onBack];
_playerGear = [_magazines select 2,_magazines select 0,_magazines select 1];
};
//Check if update is requested