Move server_getDiff to missionNameSpace

Vanilla commits:

dc984fd219

d82f430c28
This commit is contained in:
ebayShopper
2017-11-25 12:47:25 -05:00
parent 90487cde10
commit 1e65d5d324
8 changed files with 43 additions and 60 deletions

View File

@@ -91,6 +91,8 @@ if (_characterID != "?") then {
[_playerUID,_characterID,3,_playerName,(_playerPos call fa_coor2str)] call dayz_recordLogin;
};
missionNamespace setVariable [_playerUID,nil];
if (alive _playerObj) then {
_playerObj call sched_co_deleteVehicle;
};

View File

@@ -32,13 +32,11 @@ if (_characterID != "0") then {
_key call server_hiveWrite;
};
#ifdef PLAYER_DEBUG
diag_log format ["Player UID#%3 CID#%4 %1 as %5 died at %2",
_newObject call fa_plr2str, _pos call fa_coor2str,
_playerID, _characterID,
typeOf _newObject
];
#endif
// DEATH MESSAGES
_suicide = ((_sourceName == _playerName) or (_method == "suicide"));

View File

@@ -134,7 +134,7 @@ if (count _medical > 0) then {
};
if (count _stats > 0) then {
//register stats
//register stats Global
_playerObj setVariable ["zombieKills",(_stats select 0),true];
_playerObj setVariable ["headShots",(_stats select 1),true];
_playerObj setVariable ["humanKills",(_stats select 2),true];
@@ -150,15 +150,7 @@ if (count _stats > 0) then {
_score = score _playerObj;
_playerObj addScore ((_stats select 0) - _score);
//record for Server JIP checks
_playerObj setVariable ["zombieKills_CHK",(_stats select 0)];
_playerObj setVariable ["headShots_CHK",(_stats select 1)];
if (count _stats > 4) then {
if !(_stats select 3) then {_playerObj setVariable ["selectSex",true,true];};
} else {
_playerObj setVariable ["selectSex",true,true];
};
missionNamespace setVariable [_playerID,[_humanity,(_stats select 0),(_stats select 1),(_stats select 2),(_stats select 3)]];
} else {
//register stats
_playerObj setVariable ["zombieKills",0,true];
@@ -170,9 +162,7 @@ if (count _stats > 0) then {
_playerObj setVariable ["ConfirmedHumanKills",0,true];
_playerObj setVariable ["ConfirmedBanditKills",0,true];
//record for Server JIP checks
_playerObj setVariable ["zombieKills_CHK",0];
_playerObj setVariable ["headShots_CHK",0];
missionNamespace setVariable [_playerID,[_humanity,0,0,0,0]];
};
if (_randomSpot) then {
@@ -220,7 +210,6 @@ if (_randomSpot) then {
//record player pos locally for server checking
_playerObj setVariable ["characterID",_characterID,true];
_playerObj setVariable ["humanity",_humanity,true];
_playerObj setVariable ["humanity_CHK",_humanity];
_playerObj setVariable ["lastPos",getPosATL _playerObj];
_clientID = owner _playerObj;

View File

@@ -1,8 +1,10 @@
#include "\z\addons\dayz_server\compile\server_toggle_debug.hpp"
private ["_distanceFoot","_playerPos","_lastPos","_playerGear","_medical","_currentModel","_currentAnim",
"_currentWpn","_muzzles","_array","_coins","_key","_globalCoins","_bankCoins","_playerBackp","_exitReason",
"_backpack","_kills","_killsB","_killsH","_headShots","_humanity","_lastTime","_timeGross","_timeSince",
"_timeLeft","_config","_onLadder","_isTerminal","_modelChk","_temp","_currentState","_character",
"_magazines","_characterID","_charPos","_isInVehicle","_name","_inDebug","_newPos","_count","_maxDist","_relocate","_playerUID"];
"_magazines","_characterID","_charPos","_isInVehicle","_name","_inDebug","_newPos","_count","_maxDist","_relocate","_playerUID","_statsDiff"];
//[player,array]
_character = _this select 0;
@@ -45,17 +47,13 @@ _lastTime = _character getVariable ["lastTime",-1];
_modelChk = _character getVariable ["model_CHK",""];
_temp = round (_character getVariable ["temperature",100]);
_lastMagazines = _character getVariable ["ServerMagArray",[[],""]];
/*
Check previous stats against what client had when they logged in
this helps prevent JIP issues, where a new player wouldn't have received
the old players updates. Only valid for stats where clients could have
be recording results from their local objects (such as agent zombies)
*/
_kills = ["zombieKills",_character] call server_getDiff;
_killsB = ["banditKills",_character] call server_getDiff;
_killsH = ["humanKills",_character] call server_getDiff;
_headShots = ["headShots",_character] call server_getDiff;
_humanity = ["humanity",_character] call server_getDiff2;
//Get difference between current stats and stats at last sync
_statsDiff = [_character,_playerUID] call server_getStatsDiff;
_humanity = _statsDiff select 0;
_kills = _statsDiff select 1;
_headShots = _statsDiff select 2;
_killsH = _statsDiff select 3;
_killsB = _statsDiff select 4;
_charPosLen = count _charPos;
@@ -225,8 +223,9 @@ _key = if (Z_SingleCurrency) then {
str formatText["CHILD:201:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:",_characterID,_playerPos,_playerGear,_playerBackp,_medical,false,false,_kills,_headShots,_distanceFoot,_timeSince,_currentState,_killsH,_killsB,_currentModel,_humanity]
};
//diag_log str formatText["INFO - %2(UID:%3) PlayerSync, %1",_key,_name,_playerUID];
#ifdef PLAYER_DEBUG
diag_log str formatText["INFO - %2(UID:%4,CID:%3) PlayerSync, %1",_key,_name,_characterID,_playerUID];
#endif
_key call server_hiveWrite;
if (Z_SingleCurrency) then { //update global coins

View File

@@ -12,7 +12,7 @@ Please request permission to use/alter/distribute from project leader (R4Z0R49)
//#define OBJECT_DEBUG
// comment this out if you don't want any PLAYER (WORLDSPACE/INVENTORY/ETC) related debug
#define PLAYER_DEBUG
//#define PLAYER_DEBUG
// comment this out if you don't want any misc SERVER (ZOMBIE, LOOT, CLEANUP) related debug
//#define SERVER_DEBUG