Server Done I Think

This commit is contained in:
icomrade
2016-02-29 00:29:23 -05:00
parent b96cd2d971
commit 58acf95dc7
37 changed files with 3919 additions and 1200 deletions

View File

@@ -3,10 +3,11 @@ _playerUID = _this select 0;
_playerName = _this select 1;
_playerObj = nil;
_playerPos = [];
{
_PUID = [_x] call FNC_GetPlayerUID;
if (_PUID == _playerUID) exitWith {_playerObj = _x;};
} count playableUnits;
if (_PUID == _playerUID) exitWith { _playerObj = _x; _playerPos = getPosATL _playerObj;};
} count playableUnits;
if (isNil "_playerObj") then {
diag_log format["nil player object attempting PV, :%1", _this];
@@ -21,12 +22,23 @@ if (isNil "_playerObj") exitWith {
_PUID = [_playerObj] call FNC_GetPlayerUID;
diag_log format["get: %1 (%2), sent: %3 (%4)",typeName _PUID, _PUID, typeName _playerUID, _playerUID];
if (!isNull _playerObj) then {
_characterID = _playerObj getVariable["characterID", "?"];
_lastDamage = _playerObj getVariable["noatlf4",0];
_Sepsis = _playerObj getVariable["USEC_Sepsis",false];
if (_characterID != "?") exitwith {
_playerPos = getPosATL _playerObj;
_characterID = _playerObj getVariable ["CharacterID","0"];
//_characterID = _playerObj getVariable ["CharacterID","0"];
_timeout = _playerObj getVariable["combattimeout",0];
//If the player has sepsis before logging off lets give them infected status.
if (_Sepsis) then {
_playerObj setVariable["USEC_infected",true,true];
};
//Record Player Login/LogOut
[_playerUID,_characterID,2] call dayz_recordLogin;
_invehicle = false;
if (vehicle _playerObj != _playerObj) then {
@@ -53,20 +65,42 @@ if (!isNull _playerObj) then {
_id = [_playerUID,_characterID,2] spawn dayz_recordLogin;
if (alive _playerObj) then {
//[_playerObj,nil,true] call server_playerSync;
_isplayernearby = (DZE_BackpackGuard && !_invehicle && ({(isPlayer _x) && (alive _x)} count (_playerPos nearEntities ["AllVehicles", 5]) > 1));
// prevent saving more than 20 magazine items
_magazines = [(magazines _playerObj),20] call array_reduceSize;
[_playerObj,_magazines,true,true,_isplayernearby] call server_playerSync;
if (dayz_enableGhosting) then {
//diag_log format["GhostPlayers: %1, ActivePlayers: %2",dayz_ghostPlayers,dayz_activePlayers];
if (!(_playerUID in dayz_ghostPlayers)) then {
dayz_ghostPlayers set [count dayz_ghostPlayers, _playerUID];
dayz_activePlayers set [count dayz_activePlayers, [_playerUID,diag_ticktime]];
//diag_log format["playerID %1 added to ghost list",_playerUID];
};
};
// remove player
_playerObj call dayz_removePlayerOnDisconnect;
} else {
//Update Vehicle
{
[_x,"gear"] call server_updateObject;
} count (nearestObjects [_playerPos, dayz_updateObjects, 10]);
};
//Update Vehicle
{
[_x,"gear"] call server_updateObject;
} count (nearestObjects [_playerPos, DayZ_GearedObjects, 10]);
};
if (isNull _playerObj) then { diag_log("Player Object does not esist"); };
//Lets remove the object.
if (!isNull _playerObj) then {
_myGroup = group _playerObj;
deleteVehicle _playerObj;
deleteGroup _myGroup;
};