Jump to content
  • 0

Sometimes character stops updating after skin change


f3cuk

Question

Since updating to 1051 several people have been complaining that sometimes their character seemed to go back in time after they had logged in. Untill today I couldn't pinpoint what was happening but now i think i found it. Sometimes when a player changes skin, his or her character stops updating from that point on. Resulting in progress loss when they logout and log back in, even simply going in and out the lobby will "reset" their character to the state they were in just before they changed clothes.

 

One user even reported that he died » ragequit » after logging back in a few hours later, was alive and had most of his gear back. He asked me if i did a rollback on the database, which we did not. It did not make sense to me but now i'm figuring he had probably just changed skins before and got reset to that.
 

Could anyone confirm this issue? Or did i mess it up all by myself :P

Link to comment
Share on other sites

Recommended Posts

  • 0

Ok in my tiredness this morning I seemed to have missed a step.

 

I went and redid all the original instructions.

 

Inventory state is now correctly persisting through a relog so there is no roll back, but you do log in next to a dead version of yourself and can dupe all the gear from it.

 

I then tried removing

 

private["_charidchanged","_charID"];

 

from player_switchModel.sqf as suggested and it now seems to work perfectly. I'll keep playing around on my test server to make sure before making it live.

 

All I need to do now is figure out a way to make Group Manager work. The required changes as below don't work with the new player_switchModel.sqf.

 

In player_switchModel.sqf:

Find this: _oldUnit = player;
Add below: _oldGroup = group player;

Find this: selectPlayer _newUnit;
Add below: if ((count units _oldGroup > 1) && (!isNil "PVDZE_plr_LoginRecord")) then {[player] join _oldGroup;}; 
 

Edit: Still having the corpse issue. When logging in near where I changed clothes I still see the 'old character'. I'll PM you with my server and mission PBO's so you can have a look. I've gone over it quite a few times now but I don't think I've missed anything.

 

Link to comment
Share on other sites

  • 0

Ok in my tiredness this morning I seemed to have missed a step.

 

I went and redid all the original instructions.

 

Inventory state is now correctly persisting through a relog so there is no roll back, but you do log in next to a dead version of yourself and can dupe all the gear from it.

 

I then tried removing

 

private["_charidchanged","_charID"];

 

from player_switchModel.sqf as suggested and it now seems to work perfectly. I'll keep playing around on my test server to make sure before making it live.

 

All I need to do now is figure out a way to make Group Manager work. The required changes as below don't work with the new player_switchModel.sqf.

 

In player_switchModel.sqf:

Find this: _oldUnit = player;
Add below: _oldGroup = group player;

Find this: selectPlayer _newUnit;
Add below: if ((count units _oldGroup > 1) && (!isNil "PVDZE_plr_LoginRecord")) then {[player] join _oldGroup;}; 
 

Edit: Still having the corpse issue. When logging in near where I changed clothes I still see the 'old character'. I'll PM you with my server and mission PBO's so you can have a look. I've gone over it quite a few times now but I don't think I've missed anything.

 

Hmm the corpse issue seems like something easily fixable. Only read this part properly today, will look into the files you send.

Link to comment
Share on other sites

  • 0

Other then it working fine for me not really. I don't know why it isn't working for others.

 

These are my latest player_switchModel.sqf and player_humanityMorph.sqf

 

player_switchModel.sqf

private ["_meleeNum","_magType","_oldUnit","_idc","_charidchanged","_charID","_weapons","_backpackWpn","_backpackMag","_currentWpn","_isWeapon","_backpackWpnTypes","_backpackWpnQtys","_countr","_model","_position","_dir","_currentAnim","_tagSetting","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_group","_newUnit","_melee"];

if (gear_done) then { disableUserInput true; };

_model             = _this select 0;

if(count _this > 1) then {
    _charID            = _this select 1;
    _charidchanged     = true;
} else {
    _charidchanged     = false;
};

_position         = getPosATL player;
_dir             = getDir player;
_currentAnim     = animationState player;
_tagSetting     = player getVariable["DZE_display_name",false];
_playerUID         = getPlayerUID player;
_weapons         = weapons player;
_countMags         = call player_countMagazines;
_magazines         = _countMags select 0;
_backpackMag    = [];

if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};

_primweapon    = primaryWeapon player;
_secweapon    = secondaryWeapon player;

if(!(_primweapon in _weapons) && _primweapon != "") then {
    _weapons set [(count _weapons), _primweapon];
};

if(!(_secweapon in _weapons) && _secweapon != "") then {
    _weapons set [(count _weapons), _secweapon];
};

//BackUp Backpack
dayz_myBackpack = unitBackpack player;
_newBackpackType = (typeOf dayz_myBackpack);
if(_newBackpackType != "") then {
    _backpackWpn = getWeaponCargo unitBackpack player;
    _backpackMag = _countMags select 1;
};

//Get Muzzle
_currentWpn = currentWeapon player;
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");

//Secure Player for Transformation
player setPosATL dayz_spawnPos;

_oldUnit = player;

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group         = createGroup WEST;
_newUnit     = _group createUnit [_model,dayz_spawnPos,[],0,"NONE"];

_newUnit     setPosATL _position;
_newUnit     setDir _dir;

//Clear New Character
{_newUnit removeMagazine _x;} count  magazines _newUnit;
removeAllWeapons _newUnit;    

//Equip New Charactar
{
    if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
} count _magazines;

{
    _newUnit addWeapon _x;
} count _weapons;

//Check && Compare it
if(str(_weapons) != str(weapons _newUnit)) then {
    //Get Differecnce
    {
        _weapons = _weapons - [_x];
    } count (weapons _newUnit);
    
    //Add the Missing
    {
        _newUnit addWeapon _x;
    } count _weapons;
};

if(_primweapon !=  (primaryWeapon _newUnit)) then {
    _newUnit addWeapon _primweapon;        
};
if (_primweapon == "MeleeCrowbar") then {
    _newUnit addMagazine 'crowbar_swing';
};
if (_primweapon == "MeleeSledge") then {
    _newUnit addMagazine 'sledge_swing';
};
if (_primweapon == "MeleeHatchet_DZE") then {
    _newUnit addMagazine 'Hatchet_Swing';
};
if (_primweapon == "MeleeMachete") then {
    _newUnit addMagazine 'Machete_swing';
};
if (_primweapon == "MeleeFishingPole") then {
    _newUnit addMagazine 'Fishing_Swing';
};

if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
    _newUnit addWeapon _secweapon;        
};

//Add && Fill BackPack
if ((!isNil "_newBackpackType") && (_newBackpackType != "")) then {

    _newUnit         addBackpack _newBackpackType;

    //Weapons
    _backpackWpnTypes     = [];
    _backpackWpnQtys     = [];

    if (count _backpackWpn > 0) then {
        _backpackWpnTypes = _backpackWpn select 0;
        _backpackWpnQtys = _backpackWpn select 1;
    };
        
    addSwitchableUnit        _newUnit;
    setPlayable             _newUnit;
    selectPlayer             _newUnit;
    
    if(_charidchanged) then {
        player setVariable["CharacterID",_charID,true];
        player setVariable["inTransit",true,true];
    };

    if (gear_done) then {sleep 0.001;};
    ["1"] call gearDialog_create;
    if (gear_done) then {sleep 0.001;};
        
    //magazines
    _countr = 0;
    {
        if ((typeName _x) != "STRING") then {
            _isWeapon = (isClass(configFile >> "CfgWeapons" >> (_x select 0)));
        } else {
            _isWeapon = (isClass(configFile >> "CfgWeapons" >> _x));
        };
        
        if (!_isWeapon) then {
            _countr = _countr + 1;
            if ((typeName _x) != "STRING") then {
                (unitBackpack player) addMagazineCargoGlobal [(_x select 0), 1];
                _idc = (4999 + _countr);
                _idc setIDCAmmoCount (_x select 1);
            } else {
                (unitBackpack player) addMagazineCargoGlobal [_x, 1];
            };
        };
    } count _backpackMag;
        
    (findDisplay 106) closeDisplay 0;
    
    if (gear_done) then {
        sleep 0.001;
        disableUserInput false;
    };
        
    _countr = 0;
    {
        (unitBackpack player) addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
        _countr = _countr + 1;
    } count _backpackWpnTypes;
        
} else {

    addSwitchableUnit        _newUnit;
    setPlayable             _newUnit;
    selectPlayer             _newUnit;
    
    if(_charidchanged) then {
        player setVariable["CharacterID",_charID,true];
        player setVariable["inTransit",true,true];
    };
    
    if (gear_done) then {
        sleep 0.001;
        disableUserInput false;
    };

};

removeSwitchableUnit _oldUnit;
removeAllWeapons _oldUnit;
{
    _oldUnit removeMagazine _x;
} count  magazines _oldUnit;
deleteVehicle _oldUnit;
 
if (count _muzzles > 1) then {
    player selectWeapon (_muzzles select 0);
} else {
    player selectWeapon _currentWpn;
};

[objNull, player, rSwitchMove,_currentAnim] call RE;

player disableConversation true;

if (_tagSetting) then {
    DZE_ForceNameTags = true;
};

if(_primweapon != "") then {
    _melee = (gettext (configFile >> "CfgWeapons" >> _primweapon >> "melee"));
    
    if (_melee == "true") then {        
        _magType = ([] + getArray (configFile >> "CfgWeapons" >> _primweapon >> "magazines")) select 0;
        _meleeNum = ({_x == _magType} count magazines player);
        if (_meleeNum < 1) then {
            player addMagazine _magType;
        };
        
    };
};

{
    player reveal _x
} count (nearestObjects [getPosATL player, dayz_reveal, 50]);

 

player_humanityMorph.sqf

private ["_updates","_playerUID","_charID","_humanity","_worldspace","_model","_friendlies","_fractures","_old","_medical","_zombieKills","_headShots","_humanKills","_banditKills","_tagList"];

_playerUID     = _this select 0;
_charID     = _this select 1;
_model         = _this select 2;

if (typeOF player == _model) exitWith {cutText ['You already wear this Skin!', 'PLAIN'];};

player allowDamage false;

player removeEventHandler ["FiredNear",eh_player_killed];
player removeEventHandler ["HandleDamage",mydamage_eh1];
player removeEventHandler ["Killed",mydamage_eh3];
player removeEventHandler ["Fired",mydamage_eh2];

_updates = player getVariable["updatePlayer",[false,false,false,false,false]];
_updates set [0,true];
player setVariable["updatePlayer",_updates,true];
dayz_unsaved = true;

//Logout
_humanity        = player getVariable["humanity",0];
_medical         = player call player_sumMedical;
_worldspace     = [round(direction player),getPosATL player];
_zombieKills     = player getVariable ["zombieKills",0];
_headShots         = player getVariable ["headShots",0];
_humanKills     = player getVariable ["humanKills",0];
_banditKills     = player getVariable ["banditKills",0];
_friendlies        = player getVariable ["friendlies",[]];
_tagList        = player getVariable ["tagList",[]];

//Switch
    [_model,_charID] call player_switchModel;    

//set medical values
if (count _medical > 0) then {
    player setVariable["USEC_isDead",(_medical select 0),true];
    player setVariable["NORRN_unconscious", (_medical select 1), true];
    player setVariable["USEC_infected",(_medical select 2),true];
    player setVariable["USEC_injured",(_medical select 3),true];
    player setVariable["USEC_inPain",(_medical select 4),true];
    player setVariable["USEC_isCardiac",(_medical select 5),true];
    player setVariable["USEC_lowBlood",(_medical select 6),true];
    player setVariable["USEC_BloodQty",(_medical select 7),true];
    player setVariable["unconsciousTime",(_medical select 10),true];
    player setVariable["messing",(_medical select 11),true];
    
    //Add Wounds
    {
        player setVariable[_x,true,true];
        usecBleed = [player,_x,0];
        publicVariable "usecBleed";
    } count (_medical select 8);
    
    //Add fractures
    _fractures = (_medical select 9);
    [player,"legs", (_fractures select 0)] call object_setHit;
    [player,"hands", (_fractures select 1)] call object_setHit;
} else {
    //Reset Fractures
    player setVariable ["hit_legs",0,true];
    player setVariable ["hit_hands",0,true];
    player setVariable ["USEC_injured",false,true];
    player setVariable ["USEC_inPain",false,true];    
};


//General Stats
player setVariable["humanity",_humanity,true];
player setVariable["zombieKills",_zombieKills,true];
player setVariable["headShots",_headShots,true];
player setVariable["humanKills",_humanKills,true];
player setVariable["banditKills",_banditKills,true];
player setVariable["worldspace",_worldspace,true];
player setVariable["friendlies",_friendlies,true];
player setVariable["tagList",_tagList,true];
player setVariable["inTransit",nil,true];

call dayz_resetSelfActions;

eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;} ];

[player] call fnc_usec_damageHandle;

player allowDamage true;
player addWeapon "Loot";
player addWeapon "Flare";
    
sleep 0.1;

Link to comment
Share on other sites

  • 0

I firmly believe this bug has chance of happening when the server tries to update a player during him switching clothes. I changed two things on our server, the first one is making sure that a player is never without a characterID and the second one is preventing a player from being updated whilst changing clothes. After a few weeks of testing i can safely say this has completely resolved the issue for us and even made performance a little better (which has to do with rewriting some stuff inside the switchmodel).

Link to comment
Share on other sites

  • 0

I firmly believe this bug has chance of happening when the server tries to update a player during him switching clothes. I changed two things on our server, the first one is making sure that a player is never without a characterID and the second one is preventing a player from being updated whilst changing clothes. After a few weeks of testing i can safely say this has completely resolved the issue for us and even made performance a little better (which has to do with rewriting some stuff inside the switchmodel).

 

 

So... you going to post it? :)

 

good job. and yes, please we want it too :)

Link to comment
Share on other sites

  • 0

good job. and yes, please we want it too :)

 

lol.

 

Haven't i told this alot of times already? ^^

//BackUp Player Object
_oldUnit = player;
_cId = player getVariable["CharacterID",0]; // or : _oldUnit getVariable["CharacterID",0]; 

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group 		= createGroup west;
_newUnit 	= _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];

_newUnit 	setPosATL _position;
_newUnit 	setDir _dir;

_newUnit setVariable ["CharacterID",_cId,true];


That CharacterId is added, and is the only thing u need to change of default epoch code.

 

A second issue can be that your DAYZ GROUP MANAGEMENT makes your friendly array <NULL>

 

solve that with this in your init.sqf somewhere with the other configs:

DZE_FriendlySaving = false;
Link to comment
Share on other sites

  • 0

 

lol.

 

Haven't i told this alot of times already? ^^

//BackUp Player Object
_oldUnit = player;
_cId = player getVariable["CharacterID",0]; // or : _oldUnit getVariable["CharacterID",0]; 

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group 		= createGroup west;
_newUnit 	= _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];

_newUnit 	setPosATL _position;
_newUnit 	setDir _dir;

_newUnit setVariable ["CharacterID",_cId,true];


That CharacterId is added, and is the only thing u need to change of default epoch code.

 

A second issue can be that your DAYZ GROUP MANAGEMENT makes your friendly array <NULL>

 

solve that with this in your init.sqf somewhere with the other configs:

DZE_FriendlySaving = false;

 

 

Zupa,

 

Thanks for responding. Did you give the fix (quoted above) to f3cuk too - are you sure he's talking about the same fix?

 

Also can you please elaborate on this fix you posted:

1. Is this (what you posted above) the only fix needed?

2. Or do we need to have the same files what f3cuk posted above in post #86 () and add your small fix on top of that?

3. Also sorry but not experienced is tackling this particular issue. Where do we add this code you posted exactly?

 

I'm aware there's an issue that needs to be fixed by I'm still running default Epoch 1.0.5.1 files - I did not change anything on this issue (yet).

Link to comment
Share on other sites

  • 0

The problems seems to be that characterId doesnt get transferred.

 

So the only thing you need to do, is set the characterId when the new guy gets created. , And quickly reading his code, it's the same issues.

 

But setting it there should fix the issue.

 

So you only need a custom "player_switchmodel.sqf" ( is already in single currency 2.0). look for the following code

//BackUp Player Object
_oldUnit = player;

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group 		= createGroup west;
_newUnit 	= _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];

_newUnit 	setPosATL _position;
_newUnit 	setDir _dir;

change that with

//BackUp Player Object
_oldUnit = player;
_cId = player getVariable["CharacterID",0]; // or : _oldUnit getVariable["CharacterID",0]; 

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group 		= createGroup west;
_newUnit 	= _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];

_newUnit 	setPosATL _position;
_newUnit 	setDir _dir;

_newUnit setVariable ["CharacterID",_cId,true];
Link to comment
Share on other sites

  • 0

2nd question is, DOES everyone has the SAME errors, it's possible some poeple jsut have another issue somewhere, and then ofcourse this doesnt fix your issue completely.

 

Posting rpt/log can clearify issies.

 

If it says cannot sync, characterid missiing, that this is it

Link to comment
Share on other sites

  • 0

 

The problems seems to be that characterId doesnt get transferred.

 

So the only thing you need to do, is set the characterId when the new guy gets created. , And quickly reading his code, it's the same issues.

 

But setting it there should fix the issue.

 

So you only need a custom "player_switchmodel.sqf" ( is already in single currency 2.0). look for the following code

//BackUp Player Object
_oldUnit = player;

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group 		= createGroup west;
_newUnit 	= _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];

_newUnit 	setPosATL _position;
_newUnit 	setDir _dir;

change that with

//BackUp Player Object
_oldUnit = player;
_cId = player getVariable["CharacterID",0]; // or : _oldUnit getVariable["CharacterID",0]; 

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group 		= createGroup west;
_newUnit 	= _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];

_newUnit 	setPosATL _position;
_newUnit 	setDir _dir;

_newUnit setVariable ["CharacterID",_cId,true];

 

 

2nd question is, DOES everyone has the SAME errors, it's possible some poeple jsut have another issue somewhere, and then ofcourse this doesnt fix your issue completely.

 

Posting rpt/log can clearify issies.

 

If it says cannot sync, characterid missiing, that this is it

 

 

Excellent! We definitely have cannot sync so hopefully this will solve our problems. Can't wait to get home and put this up. Cheers!

Link to comment
Share on other sites

  • 0

Zupa's fix addresses the out of sync issue (which is also patched in the files i supplied earlier), but i don't think it keeps the backpack from sometimes being emptied or the script from hanging, the only thing that seems to counter that is prevent the player from updating altogether whilst changing clothes. On top of that i did some code changes which seemingly are less error-prone.

The clarify, Zupa's proposed fix was already in the files i posted earlier.

I'll post a decent howto tonight.

Link to comment
Share on other sites

  • 0

Zupa's fix addresses the out of sync issue (which is also patched in the files i supplied earlier), but i don't think it keeps the backpack from sometimes being emptied or the script from hanging, the only thing that seems to counter that is prevent the player from updating altogether whilst changing clothes. On top of that i did some code changes which seemingly are less error-prone.

The clarify, Zupa's proposed fix was already in the files i posted earlier.

I'll post a decent howto tonight.

 

Awesome! Looking forward to it.

Link to comment
Share on other sites

  • 0

Other then it working fine for me not really. I don't know why it isn't working for others.

 

These are my latest player_switchModel.sqf and player_humanityMorph.sqf

 

player_switchModel.sqf

private ["_meleeNum","_magType","_oldUnit","_idc","_charidchanged","_charID","_weapons","_backpackWpn","_backpackMag","_currentWpn","_isWeapon","_backpackWpnTypes","_backpackWpnQtys","_countr","_model","_position","_dir","_currentAnim","_tagSetting","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_group","_newUnit","_melee"];

if (gear_done) then { disableUserInput true; };

_model             = _this select 0;

if(count _this > 1) then {
    _charID            = _this select 1;
    _charidchanged     = true;
} else {
    _charidchanged     = false;
};

_position         = getPosATL player;
_dir             = getDir player;
_currentAnim     = animationState player;
_tagSetting     = player getVariable["DZE_display_name",false];
_playerUID         = getPlayerUID player;
_weapons         = weapons player;
_countMags         = call player_countMagazines;
_magazines         = _countMags select 0;
_backpackMag    = [];

if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};

_primweapon    = primaryWeapon player;
_secweapon    = secondaryWeapon player;

if(!(_primweapon in _weapons) && _primweapon != "") then {
    _weapons set [(count _weapons), _primweapon];
};

if(!(_secweapon in _weapons) && _secweapon != "") then {
    _weapons set [(count _weapons), _secweapon];
};

//BackUp Backpack
dayz_myBackpack = unitBackpack player;
_newBackpackType = (typeOf dayz_myBackpack);
if(_newBackpackType != "") then {
    _backpackWpn = getWeaponCargo unitBackpack player;
    _backpackMag = _countMags select 1;
};

//Get Muzzle
_currentWpn = currentWeapon player;
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");

//Secure Player for Transformation
player setPosATL dayz_spawnPos;

_oldUnit = player;

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group         = createGroup WEST;
_newUnit     = _group createUnit [_model,dayz_spawnPos,[],0,"NONE"];

_newUnit     setPosATL _position;
_newUnit     setDir _dir;

//Clear New Character
{_newUnit removeMagazine _x;} count  magazines _newUnit;
removeAllWeapons _newUnit;    

//Equip New Charactar
{
    if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
} count _magazines;

{
    _newUnit addWeapon _x;
} count _weapons;

//Check && Compare it
if(str(_weapons) != str(weapons _newUnit)) then {
    //Get Differecnce
    {
        _weapons = _weapons - [_x];
    } count (weapons _newUnit);
    
    //Add the Missing
    {
        _newUnit addWeapon _x;
    } count _weapons;
};

if(_primweapon !=  (primaryWeapon _newUnit)) then {
    _newUnit addWeapon _primweapon;        
};
if (_primweapon == "MeleeCrowbar") then {
    _newUnit addMagazine 'crowbar_swing';
};
if (_primweapon == "MeleeSledge") then {
    _newUnit addMagazine 'sledge_swing';
};
if (_primweapon == "MeleeHatchet_DZE") then {
    _newUnit addMagazine 'Hatchet_Swing';
};
if (_primweapon == "MeleeMachete") then {
    _newUnit addMagazine 'Machete_swing';
};
if (_primweapon == "MeleeFishingPole") then {
    _newUnit addMagazine 'Fishing_Swing';
};

if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
    _newUnit addWeapon _secweapon;        
};

//Add && Fill BackPack
if ((!isNil "_newBackpackType") && (_newBackpackType != "")) then {

    _newUnit         addBackpack _newBackpackType;

    //Weapons
    _backpackWpnTypes     = [];
    _backpackWpnQtys     = [];

    if (count _backpackWpn > 0) then {
        _backpackWpnTypes = _backpackWpn select 0;
        _backpackWpnQtys = _backpackWpn select 1;
    };
        
    addSwitchableUnit        _newUnit;
    setPlayable             _newUnit;
    selectPlayer             _newUnit;
    
    if(_charidchanged) then {
        player setVariable["CharacterID",_charID,true];
        player setVariable["inTransit",true,true];
    };

    if (gear_done) then {sleep 0.001;};
    ["1"] call gearDialog_create;
    if (gear_done) then {sleep 0.001;};
        
    //magazines
    _countr = 0;
    {
        if ((typeName _x) != "STRING") then {
            _isWeapon = (isClass(configFile >> "CfgWeapons" >> (_x select 0)));
        } else {
            _isWeapon = (isClass(configFile >> "CfgWeapons" >> _x));
        };
        
        if (!_isWeapon) then {
            _countr = _countr + 1;
            if ((typeName _x) != "STRING") then {
                (unitBackpack player) addMagazineCargoGlobal [(_x select 0), 1];
                _idc = (4999 + _countr);
                _idc setIDCAmmoCount (_x select 1);
            } else {
                (unitBackpack player) addMagazineCargoGlobal [_x, 1];
            };
        };
    } count _backpackMag;
        
    (findDisplay 106) closeDisplay 0;
    
    if (gear_done) then {
        sleep 0.001;
        disableUserInput false;
    };
        
    _countr = 0;
    {
        (unitBackpack player) addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
        _countr = _countr + 1;
    } count _backpackWpnTypes;
        
} else {

    addSwitchableUnit        _newUnit;
    setPlayable             _newUnit;
    selectPlayer             _newUnit;
    
    if(_charidchanged) then {
        player setVariable["CharacterID",_charID,true];
        player setVariable["inTransit",true,true];
    };
    
    if (gear_done) then {
        sleep 0.001;
        disableUserInput false;
    };

};

removeSwitchableUnit _oldUnit;
removeAllWeapons _oldUnit;
{
    _oldUnit removeMagazine _x;
} count  magazines _oldUnit;
deleteVehicle _oldUnit;
 
if (count _muzzles > 1) then {
    player selectWeapon (_muzzles select 0);
} else {
    player selectWeapon _currentWpn;
};

[objNull, player, rSwitchMove,_currentAnim] call RE;

player disableConversation true;

if (_tagSetting) then {
    DZE_ForceNameTags = true;
};

if(_primweapon != "") then {
    _melee = (gettext (configFile >> "CfgWeapons" >> _primweapon >> "melee"));
    
    if (_melee == "true") then {        
        _magType = ([] + getArray (configFile >> "CfgWeapons" >> _primweapon >> "magazines")) select 0;
        _meleeNum = ({_x == _magType} count magazines player);
        if (_meleeNum < 1) then {
            player addMagazine _magType;
        };
        
    };
};

{
    player reveal _x
} count (nearestObjects [getPosATL player, dayz_reveal, 50]);

 

player_humanityMorph.sqf

private ["_updates","_playerUID","_charID","_humanity","_worldspace","_model","_friendlies","_fractures","_old","_medical","_zombieKills","_headShots","_humanKills","_banditKills","_tagList"];

_playerUID     = _this select 0;
_charID     = _this select 1;
_model         = _this select 2;

if (typeOF player == _model) exitWith {cutText ['You already wear this Skin!', 'PLAIN'];};

player allowDamage false;

player removeEventHandler ["FiredNear",eh_player_killed];
player removeEventHandler ["HandleDamage",mydamage_eh1];
player removeEventHandler ["Killed",mydamage_eh3];
player removeEventHandler ["Fired",mydamage_eh2];

_updates = player getVariable["updatePlayer",[false,false,false,false,false]];
_updates set [0,true];
player setVariable["updatePlayer",_updates,true];
dayz_unsaved = true;

//Logout
_humanity        = player getVariable["humanity",0];
_medical         = player call player_sumMedical;
_worldspace     = [round(direction player),getPosATL player];
_zombieKills     = player getVariable ["zombieKills",0];
_headShots         = player getVariable ["headShots",0];
_humanKills     = player getVariable ["humanKills",0];
_banditKills     = player getVariable ["banditKills",0];
_friendlies        = player getVariable ["friendlies",[]];
_tagList        = player getVariable ["tagList",[]];

//Switch
    [_model,_charID] call player_switchModel;    

//set medical values
if (count _medical > 0) then {
    player setVariable["USEC_isDead",(_medical select 0),true];
    player setVariable["NORRN_unconscious", (_medical select 1), true];
    player setVariable["USEC_infected",(_medical select 2),true];
    player setVariable["USEC_injured",(_medical select 3),true];
    player setVariable["USEC_inPain",(_medical select 4),true];
    player setVariable["USEC_isCardiac",(_medical select 5),true];
    player setVariable["USEC_lowBlood",(_medical select 6),true];
    player setVariable["USEC_BloodQty",(_medical select 7),true];
    player setVariable["unconsciousTime",(_medical select 10),true];
    player setVariable["messing",(_medical select 11),true];
    
    //Add Wounds
    {
        player setVariable[_x,true,true];
        usecBleed = [player,_x,0];
        publicVariable "usecBleed";
    } count (_medical select 8);
    
    //Add fractures
    _fractures = (_medical select 9);
    [player,"legs", (_fractures select 0)] call object_setHit;
    [player,"hands", (_fractures select 1)] call object_setHit;
} else {
    //Reset Fractures
    player setVariable ["hit_legs",0,true];
    player setVariable ["hit_hands",0,true];
    player setVariable ["USEC_injured",false,true];
    player setVariable ["USEC_inPain",false,true];    
};


//General Stats
player setVariable["humanity",_humanity,true];
player setVariable["zombieKills",_zombieKills,true];
player setVariable["headShots",_headShots,true];
player setVariable["humanKills",_humanKills,true];
player setVariable["banditKills",_banditKills,true];
player setVariable["worldspace",_worldspace,true];
player setVariable["friendlies",_friendlies,true];
player setVariable["tagList",_tagList,true];
player setVariable["inTransit",nil,true];

call dayz_resetSelfActions;

eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;} ];

[player] call fnc_usec_damageHandle;

player allowDamage true;
player addWeapon "Loot";
player addWeapon "Flare";
    
sleep 0.1;

 

I also tried applying these along with the files you posted previously. Doesn't seem to work for me. Just get stuck in the loading screen. I tried stripping the code down a little and took out parts that I thought weren't supposed to be there, but that didn't help. Your player_switchModel.sqf is just so drastically different from the original one from DayZ_Epoch. So I took the original files and only applied the inTransit method to it along with Zupa's posted CharacterUID fix. I can now finally join the game and I get no RPT errors at first glance. So I'ma run this through on my public server and see how it goes.

Link to comment
Share on other sites

  • 0

I also tried applying these along with the files you posted previously. Doesn't seem to work for me. Just get stuck in the loading screen. I tried stripping the code down a little and took out parts that I thought weren't supposed to be there, but that didn't help. Your player_switchModel.sqf is just so drastically different from the original one from DayZ_Epoch. So I took the original files and only applied the inTransit method to it along with Zupa's posted CharacterUID fix. I can now finally join the game and I get no RPT errors at first glance. So I'ma run this through on my public server and see how it goes.

 

Yeah the current fix i posted is overly complicated, but there is no part you should leave out. I'll do a new - more simple - one tonight. It only involves changing 4 files (player_wearclothes.sqf, player_humanitymorph and player_switchmodel.sqf and server_playersync.sqf). I'll use the default 1051 files as a reference.

Link to comment
Share on other sites

  • 0

Yeah the current fix i posted is overly complicated, but there is no part you should leave out. I'll do a new - more simple - one tonight. It only involves changing 4 files (player_wearclothes.sqf, player_humanitymorph and player_switchmodel.sqf and server_playersync.sqf). I'll use the default 1051 files as a reference.

 

Okay looking forward to that. Meanwhile I noticed I got undefined variable error for _inTransit in server_playerSync.sqf. Did you define it somewhere else as well? I added a isNil check for it, that cleared the error for now.

Link to comment
Share on other sites

  • 0

Just noticed that the inTransit method is blocking the sync quite often:

19:04:13 "NOTICE: Cannot update ROCU[], player is in transit"
19:04:13 "NOTICE: Cannot update ROCU[], player is in transit"
19:04:43 "NOTICE: Cannot update ROCU[], player is in transit"
19:04:53 "NOTICE: Cannot update ROCU[], player is in transit"
19:04:59 "NOTICE: Cannot update ROCU[], player is in transit"
19:05:09 "NOTICE: Cannot update ROCU[], player is in transit"
19:05:28 "NOTICE: Cannot update ROCU[], player is in transit"

In this current session I haven't changed my skin or anything like that. Just logged in and walked around a little. 

Isn't it supposed to cancel sync only when the system is trying to sync at the exact moment when you're in the middle of changing models?

Link to comment
Share on other sites

  • 0

server_playerSync.sqf

private ["_cashMoney","_empty","_name","_playerwasNearby","_character","_magazines","_force","_characterID","_charPos","_isInVehicle","_timeSince","_humanity","_debug","_distance","_isNewMed","_isNewPos","_isNewGear","_playerPos","_playerGear","_playerBackp","_medical","_distanceFoot","_lastPos","_backpack","_kills","_killsB","_killsH","_headShots","_lastTime","_timeGross","_timeLeft","_currentWpn","_currentAnim","_config","_onLadder","_isTerminal","_currentModel","_modelChk","_muzzles","_temp","_currentState","_array","_key","_pos","_forceGear","_friendlies"];

_character = 	_this select 0;
_magazines = 	_this select 1;
_force = 		_this select 2;
_forceGear =	_this select 3;
_playerwasNearby = false;
//_force =	true;
if ((count _this) > 4) then {
	_playerwasNearby =	_this select 4;
};

if (isNull _character) exitWith {
	diag_log ("Player is Null FAILED: Exiting, player sync: " + str(_character));
};

_characterID =	_character getVariable ["CharacterID","0"];
_charPos = 		getPosATL _character;
_isInVehicle = 	vehicle _character != _character;
_timeSince = 	0;
_humanity =		0;
_inTransit = _character getVariable ["inTransit", false];

_name = if (alive _character) then { name _character; } else { "Dead Player"; };

if (_character isKindOf "Animal") exitWith {
	diag_log ("ERROR: Cannot Sync Character " + (_name) + " is an Animal class");
};

if (isnil "_characterID") exitWith {
	diag_log ("ERROR: Cannot Sync Character " + (_name) + " has nil characterID");	
};

if (_characterID == "0") exitWith {
	diag_log ("ERROR: Cannot Sync Character " + (_name) + " as no characterID");
};

if (!isNil "_inTransit") then {
	if (_inTransit) exitWith {
		diag_log ("NOTICE: Cannot update " + (_name) + ", player is in transit");
	};
};

private["_debug","_distance"];
_debug = getMarkerpos "respawn_west";
_distance = _debug distance _charPos;

if (_distance < 2000) exitWith { 
	diag_log format["ERROR: server_playerSync: Cannot Sync Player %1 [%2]. Position in debug! %3",_name,_characterID,_charPos];
};

//Check for server initiated updates
_isNewMed =		_character getVariable["medForceUpdate",false];		//Med Update is forced when a player receives some kind of med incident
_isNewPos =		_character getVariable["posForceUpdate",false];		//Med Update is forced when a player receives some kind of med incident
_isNewGear =	((count _magazines) > 0);

//Check for player initiated updates
if (_characterID != "0") then {
	_playerPos =	[];
	_playerGear =	[];
	_playerBackp =	[];
	_medical =		[];
	_distanceFoot =	0;
	
	//Check if update is requested
	if (_isNewPos || _force) then {
		if (((_charPos select 0) == 0) && ((_charPos select 1) == 0)) then {
			//Zero Position
		} else {
			//diag_log ("getting position..."); sleep 0.05;
			_playerPos = [round(direction _character),_charPos];
			_lastPos = _character getVariable["lastPos",_charPos];
			if (count _lastPos > 2 && count _charPos > 2) then {
				if (!_isInVehicle) then {
					_distanceFoot = round(_charPos distance _lastPos);
				};
				_character setVariable["lastPos",_charPos];
			};
			if (count _charPos < 3) then {
				_playerPos =	[];
			};
			//diag_log ("position = " + str(_playerPos)); sleep 0.05;
		};
		_character setVariable ["posForceUpdate",false,true];
	};
	if (_isNewGear || _forceGear) then {
		_playerGear = [weapons _character,_magazines];
		_backpack = unitBackpack _character;
		if(_playerwasNearby) then {
			_empty = [[],[]];
			_playerBackp = [typeOf _backpack,_empty,_empty];
		} else {
			_playerBackp = [typeOf _backpack,getWeaponCargo _backpack,getMagazineCargo _backpack];
		};
	};
	if (_isNewMed || _force) then {
		if (!(_character getVariable["USEC_isDead",false])) then {
			_medical = _character call player_sumMedical;
		};
		_character setVariable ["medForceUpdate",false,true];
	};
	
	//Process update
	if (_characterID != "0") then {		
		//Record stats while we're here		
		/*
			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;
		//_humanity = 	_character getVariable ["humanity",0];
		_cashMoney = 	["cashMoney",_character] call server_getDiff2;
		_character addScore _kills;		
		/*
			Assess how much time has passed, for recording total time on server
		*/
		_lastTime = 	_character getVariable["lastTime",time];
		if (isNil "_lastTime") then {_lastTime = time;};
		_timeGross = 	(time - _lastTime);
		_timeSince = 	floor(_timeGross / 60);
		_timeLeft =		(_timeGross - (_timeSince * 60));
		/*
			Get character state details
		*/
		_currentWpn = 	currentMuzzle _character;
		_currentAnim =	animationState _character;
		_config = 		configFile >> "CfgMovesMaleSdr" >> "States" >> _currentAnim;
		_onLadder =		(getNumber (_config >> "onLadder")) == 1;
		_isTerminal = 	(getNumber (_config >> "terminal")) == 1;
		//_wpnDisabled =	(getNumber (_config >> "disableWeapons")) == 1;
		_currentModel = typeOf _character;
		_modelChk = 	_character getVariable ["model_CHK",""];
		if (isNil "_modelChk") then {_modelChk = "";};
		if (_currentModel == _modelChk) then {
			_currentModel = "";
		} else {
			_currentModel = _currentModel;
			_character setVariable ["model_CHK",typeOf _character];
		};
		
		if (_onLadder || _isInVehicle || _isTerminal) then {
			_currentAnim = "";
			//If position to be updated, make sure it is at ground level!
			if ((count _playerPos > 0) && !_isTerminal) then {
				_charPos set [2,0];
				_playerPos set[1,_charPos];					
			};
		};
		if (_isInVehicle) then {
			_currentWpn = "";
		} else {
			if ( typeName(_currentWpn) == "STRING" ) then {
				_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
				if (count _muzzles > 1) then {
					_currentWpn = currentMuzzle _character;
				};	
			} else {
				//diag_log ("DW_DEBUG: _currentWpn: " + str(_currentWpn));
				_currentWpn = "";
			};
		};
		_temp = round(_character getVariable ["temperature",100]);
		if (isNil "_temp") then {_temp = 100;};
		_currentState = [_currentWpn,_currentAnim,_temp];
		if(DZE_FriendlySaving) then {
			// save only last/most recent 5 entrys as we only have 200 chars in db field && weapon + animation names are sometimes really long 60-70 chars.
            _arrayToSave = (_character getVariable ["friendlies",[]]);
            if (isNil "_arrayToSave") then {_arrayToSave = [];};
            _friendlies = [_arrayToSave,5] call array_reduceSizeReverse;
            _currentState set [(count _currentState),_friendlies];
		};
		/*
			Everything is ready, now publish to HIVE
		*/
		if (count _playerPos > 0) then {
			_array = [];
			{
				if (_x > dayz_minpos && _x < dayz_maxpos) then {
					_array set [count _array,_x];
				};
			} count (_playerPos select 1);
			_playerPos set [1,_array];
		};
		if (!isNull _character) then {
			if (alive _character) then {
				//Wait for HIVE to be free
				//Send request
				_key = format["CHILD:201:%1:%2:%3:%4:%5:%6:%7:%8:%9:%10:%11:%12:%13:%14:%15:%16:%17:",_characterID,_playerPos,_playerGear,_playerBackp,_medical,false,false,_kills,_headShots,_distanceFoot,_timeSince,_currentState,_killsH,_killsB,_currentModel,_humanity,_cashMoney];
				//diag_log ("HIVE: WRITE: "+ str(_key) + " / " + _characterID);
				_key call server_hiveWrite;							
			};
		};

		// If player is in a vehicle, keep its position updated
		if (vehicle _character != _character) then {
			//[vehicle _character, "position"] call server_updateObject;
			if (!(vehicle _character in needUpdate_objects)) then {
				//diag_log format["DEBUG: Added to NeedUpdate=%1",vehicle _character];
				needUpdate_objects set [count needUpdate_objects, vehicle _character];
			};
		};
		
		// Force gear updates for nearby vehicles/tents
		
		{
			[_x, "gear"] call server_updateObject;
		} count (nearestObjects [_charPos, dayz_updateObjects, 10]);
		//[_charPos] call server_updateNearbyObjects;

		//Reset timer
		if (_timeSince > 0) then {
			_character setVariable ["lastTime",(time - _timeLeft)];
		};
	};
}; 

 

player_switchModel.sqf

private ["_weapons","_backpackWpn","_backpackMag","_currentWpn","_backpackWpnTypes","_backpackWpnQtys","_countr","_class","_position","_dir","_currentAnim","_tagSetting","_playerUID","_countMags","_magazines","_primweapon","_secweapon","_newBackpackType","_muzzles","_oldUnit","_group","_newUnit","_playerObjName","_wpnType","_ismelee"];

_class 			= _this;
_position 		= getPosATL player;
_dir 			= getDir player;
_currentAnim 	= animationState player;
_tagSetting = player getVariable["DZE_display_name",false];
_playerUID = getPlayerUID player;
_weapons 	= weapons player;
_countMags = call player_countMagazines; 
_magazines = _countMags select 0;
_cashMoney = player getVariable["cashMoney",0];
_bankMoney = player getVariable["bankMoney",0];

if ((_playerUID == dayz_playerUID) && (count _magazines == 0) && (count (magazines player) > 0 )) exitWith {cutText [(localize "str_epoch_player_17"), "PLAIN DOWN"]};

_primweapon	= primaryWeapon player;
_secweapon	= secondaryWeapon player;

if(!(_primweapon in _weapons) && _primweapon != "") then {
	_weapons = _weapons + [_primweapon];
};

if(!(_secweapon in _weapons) && _secweapon != "") then {
	_weapons = _weapons + [_secweapon];
};

//BackUp Backpack
dayz_myBackpack = unitBackpack player;
_newBackpackType = (typeOf dayz_myBackpack);
if(_newBackpackType != "") then {
	_backpackWpn = getWeaponCargo unitBackpack player;
	_backpackMag = _countMags select 1;
};

//Get Muzzle
_currentWpn = currentWeapon player;
_muzzles = getArray(configFile >> "cfgWeapons" >> _currentWpn >> "muzzles");
if (count _muzzles > 1) then {
	_currentWpn = currentMuzzle player;
};

//Secure Player for Transformation
player setPosATL dayz_spawnPos;

//BackUp Player Object
_oldUnit = player;
_cId = player getVariable["CharacterID",0]; // or : _oldUnit getVariable["CharacterID",0]; 

/**********************************/
//DONT USE player AFTER THIS POINT//
/**********************************/

//Create New Character
_group = createGroup WEST;
_newUnit = _group createUnit [_class,dayz_spawnPos,[],0,"NONE"];
_newUnit setPosATL _position;
_newUnit setDir _dir;
[_newUnit] joinSilent createGroup WEST;
_newUnit setVariable ["CharacterID",_cId,true];

//Soul start: SC Edit >>> readding variables used by single currency mod.
_newUnit setVariable ["cashMoney",_cashMoney,true];
_newUnit setVariable ["bankMoney",_bankMoney];
//Soul end: SC Edit

//Clear New Character
{_newUnit removeMagazine _x;} count  magazines _newUnit;
removeAllWeapons _newUnit;	

//Equip New Charactar
{
	if (typeName _x == "ARRAY") then {if ((count _x) > 0) then {_newUnit addMagazine [(_x select 0), (_x select 1)]; }; } else { _newUnit addMagazine _x; };
} count _magazines;

{
	_newUnit addWeapon _x;
} count _weapons;

//Check && Compare it
if(str(_weapons) != str(weapons _newUnit)) then {
	//Get Differecnce
	{
		_weapons = _weapons - [_x];
	} count (weapons _newUnit);
	
	//Add the Missing
	{
		_newUnit addWeapon _x;
	} count _weapons;
};

if(_primweapon !=  (primaryWeapon _newUnit)) then {
	_newUnit addWeapon _primweapon;		
};
if (_primweapon == "MeleeCrowbar") then {
	_newUnit addMagazine 'crowbar_swing';
};
if (_primweapon == "MeleeSledge") then {
	_newUnit addMagazine 'sledge_swing';
};
if (_primweapon == "MeleeHatchet_DZE") then {
	_newUnit addMagazine 'Hatchet_Swing';
};
if (_primweapon == "MeleeMachete") then {
	_newUnit addMagazine 'Machete_swing';
};
if (_primweapon == "MeleeFishingPole") then {
	_newUnit addMagazine 'Fishing_Swing';
};

if(_secweapon != (secondaryWeapon _newUnit) && _secweapon != "") then {
	_newUnit addWeapon _secweapon;		
};
_switchUnit = {
	addSwitchableUnit _newUnit;
	setPlayable _newUnit;
	selectPlayer _newUnit;
	
	player setVariable["inTransit",true,true];
	
	removeAllWeapons _oldUnit;
	{_oldUnit removeMagazine _x;} count  magazines _oldUnit;
	deleteVehicle _oldUnit;
	if(_currentWpn != "") then {_newUnit selectWeapon _currentWpn;};
};
//Add && Fill BackPack
if (!isNil "_newBackpackType") then {
	if (_newBackpackType != "") then {
		_newUnit addBackpack _newBackpackType;
		dayz_myBackpack = unitBackpack _newUnit;
		//Weapons
		_backpackWpnTypes = [];
		_backpackWpnQtys = [];
		if (count _backpackWpn > 0) then {
			_backpackWpnTypes = _backpackWpn select 0;
			_backpackWpnQtys = _backpackWpn select 1;
		};
		[] call _switchUnit;
		if (gear_done) then {sleep 0.001;};
		["1"] call gearDialog_create;
		//magazines
		_countr = 0;
		{
			if (!(isClass(configFile >> "CfgWeapons" >> _x))) then {
				_countr = _countr + 1;
				if ((typeName _x) != "STRING") then {
					(unitBackpack player) addMagazineCargoGlobal [(_x select 0), 1];
					_idc = 4999 + _countr;
					_idc setIDCAmmoCount (_x select 1);
				} else {
					(unitBackpack player) addMagazineCargoGlobal [_x, 1];
				};
			};
		} count _backpackMag;
		(findDisplay 106) closeDisplay 0;
		_countr = 0;
		{
			(unitBackpack player) addWeaponCargoGlobal [_x,(_backpackWpnQtys select _countr)];
			_countr = _countr + 1;
		} count _backpackWpnTypes;
	} else { [] call _switchUnit; };
} else { [] call _switchUnit; };
[objNull, player, rSwitchMove,_currentAnim] call RE;
player disableConversation true;

//player setVariable ["bodyName",dayz_playerName,true]; //Outcommit (Issue #991) - Also removed in DayZ Mod 1.8

if (_tagSetting) then {
	DZE_ForceNameTags = true;
};

_playerUID = getPlayerUID player;
_playerObjName = format["PVDZE_player%1",_playerUID];
call compile format["%1 = player;",_playerObjName];
publicVariableServer _playerObjName; //Outcommit in DayZ 1.8 No clue for what this is - Skaronator

//melee check
_wpnType = primaryWeapon player;
_ismelee = (gettext (configFile >> "CfgWeapons" >> _wpnType >> "melee"));
if (_ismelee == "true") then {
	call dayz_meleeMagazineCheck; 
};

//reveal the same objects we do on login
{player reveal _x} count (nearestObjects [getPosATL player, dayz_reveal, 50]); 

 

player_humanityMorph.sqf

private ["_updates","_playerUID","_charID","_humanity","_worldspace","_model","_friendlies","_fractures","_old","_medical","_zombieKills","_headShots","_humanKills","_banditKills","_tagList","_display"];
_playerUID 	= _this select 0;
_charID 	= _this select 1;
_model 		= _this select 2;

if (typeOF player == _model) exitWith {cutText ['You already wear this Skin!', 'PLAIN'];};


_old = player;
player allowDamage false;

player removeEventHandler ["FiredNear",eh_player_killed];
player removeEventHandler ["HandleDamage",mydamage_eh1];
player removeEventHandler ["Killed",mydamage_eh3];
player removeEventHandler ["Fired",mydamage_eh2];

_updates = 		player getVariable["updatePlayer",[false,false,false,false,false]];
_updates set [0,true];
player setVariable["updatePlayer",_updates,true];
dayz_unsaved = true;
//Logout
_humanity		= player getVariable["humanity",0];
_medical 		= player call player_sumMedical;
_worldspace 	= [round(direction player),getPosATL player];
_zombieKills 	= player getVariable ["zombieKills",0];
_headShots 		= player getVariable ["headShots",0];
_humanKills 	= player getVariable ["humanKills",0];
_banditKills 	= player getVariable ["banditKills",0];
_friendlies		= player getVariable ["friendlies",[]];
_tagList		= player getVariable ["tagList",[]];

//Switch
	_model call player_switchModel;

//Login

//set medical values
if (count _medical > 0) then {
	player setVariable["USEC_isDead",(_medical select 0),true];
	player setVariable["NORRN_unconscious", (_medical select 1), true];
	player setVariable["USEC_infected",(_medical select 2),true];
	player setVariable["USEC_injured",(_medical select 3),true];
	player setVariable["USEC_inPain",(_medical select 4),true];
	player setVariable["USEC_isCardiac",(_medical select 5),true];
	player setVariable["USEC_lowBlood",(_medical select 6),true];
	player setVariable["USEC_BloodQty",(_medical select 7),true];
	player setVariable["unconsciousTime",(_medical select 10),true];
	
	//Add Wounds
	{
		player setVariable[_x,true,true];
		//["usecBleed",[player,_x,_hit]] call broadcastRpcCallAll;
		usecBleed = [player,_x,0];
		publicVariable "usecBleed";
	} count (_medical select 8);
	
	//Add fractures
	_fractures = (_medical select 9);
//	player setVariable ["hit_legs",(_fractures select 0),true];
//	player setVariable ["hit_hands",(_fractures select 1),true];
	[player,"legs", (_fractures select 0)] call object_setHit;
	[player,"hands", (_fractures select 1)] call object_setHit;
} else {
	//Reset Fractures
	player setVariable ["hit_legs",0,true];
	player setVariable ["hit_hands",0,true];
	player setVariable ["USEC_injured",false,true];
	player setVariable ["USEC_inPain",false,true];	
};


//General Stats
player setVariable["humanity",_humanity,true];
player setVariable["zombieKills",_zombieKills,true];
player setVariable["headShots",_headShots,true];
player setVariable["humanKills",_humanKills,true];
player setVariable["banditKills",_banditKills,true];
player setVariable["CharacterID",_charID,true];
player setVariable["worldspace",_worldspace,true];
player setVariable["friendlies",_friendlies,true];
player setVariable["tagList",_tagList,true];
player setVariable["inTransit",nil,true];

//code for this on the server is missing
//["PVDZE_plr_Morph",[_charID,player,_playerUID,[_zombieKills,_headShots,_humanKills,_banditKills],_humanity]] call callRpcProcedure;

call dayz_resetSelfActions;

eh_player_killed = player addeventhandler ["FiredNear",{_this call player_weaponFiredNear;} ];

[player] call fnc_usec_damageHandle;
player allowDamage true;

player addWeapon "Loot";
player addWeapon "Flare";

//melee check
	_wpnType = primaryWeapon player;
	_ismelee = (gettext (configFile >> "CfgWeapons" >> _wpnType >> "melee"));
		if (_ismelee == "true") then {
        		call dayz_meleeMagazineCheck;
		};

sleep 0.1;

if (!isNull _old) then {
	// this should not be needed as player is deleted in player_switchModel?
	deleteVehicle _old;
};

sleep 0.1; 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...