Jump to content

[FIX] cashmoney & bankmoney loss after skinchange/humanity morph


Recommended Posts

Edits required in compiles.sqf in your mission pbo or whatever file you use for redirecting mod files.

Redirect player_wearClothes.sqf back to mod folder directory and delete the file in your mission folder.

player_wearClothes =		compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";

Get player_switchModel.sqf from "dayz_code\compile" in the epoch mod pbo and then redirect it to your mission folder.

In the line below you can see that i have a folder structure "dayz_code\compile" in my mission root

if yours is different make shure the path is changed to whatever your folder structure is.

player_switchModel =		compile preprocessFileLineNumbers "dayz_code\compile\player_switchModel.sqf";

Then in player_switchModel.sqf find this:

_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;

And add these 2 after it:

For my update to single currency:

_cashMoney = player getVariable["cashMoney",0];
_bankMoney = player getVariable["bankMoney",0];

For Zupa's v1.0 & 1.1 release:

_cashMoney = player getVariable["headShots",0];
_bankMoney = player getVariable["bank",0];

You dont need both of the above, just for what version of this single currency mod you are using.

Warning: This might change with release version 2.

 

Then find this part:

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

Add above:

For my update to single currency:

player setVariable ["cashMoney",_cashMoney,true];
player setVariable ["bankMoney",_bankMoney];

For Zupa's v1.0 & 1.1 release:

player setVariable["headShots",_cashMoney,true];
player setVariable["bank",_bankMoney];

You dont need both of the above, just for what version of this single currency mod you are using.

Warning: This might change with release version 2.

Link to comment
Share on other sites

 

For Zupa's v1.0 & 1.1 release:

player setVariable["headShots",_cashMoney,true];
player setVariable["bank",_bankMoney];

is that right? Shouldn't it be _bank and _headShots?

 

 

no cause few edits up in the same file i pulled the data in those variables with getVariable so you just do as the tutorial instructs and it will work.

Link to comment
Share on other sites

Edits required in compiles.sqf in your mission pbo or whatever file you use for redirecting mod files.

Redirect player_wearClothes.sqf back to mod folder directory and delete the file in your mission folder.

player_wearClothes =		compile preprocessFileLineNumbers "\z\addons\dayz_code\actions\player_wearClothes.sqf";

Get player_switchModel.sqf from "dayz_code\compile" in the epoch mod pbo and then redirect it to your mission folder.

In the line below you can see that i have a folder structure "dayz_code\compile" in my mission root

if yours is different make shure the path is changed to whatever your folder structure is.

player_switchModel =		compile preprocessFileLineNumbers "dayz_code\compile\player_switchModel.sqf";

Then in player_switchModel.sqf find this:

_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;

And add these 2 after it:

For my update to single currency:

_cashMoney = player getVariable["cashMoney",0];
_bankMoney = player getVariable["bankMoney",0];

For Zupa's v1.0 & 1.1 release:

_cashMoney = player getVariable["headShots",0];
_bankMoney = player getVariable["bank",0];

You dont need both of the above, just for what version of this single currency mod you are using.

Warning: This might change with release version 2.

 

Then find this part:

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

Add above:

For my update to single currency:

player setVariable ["cashMoney",_cashMoney,true];
player setVariable ["bankMoney",_bankMoney];

For Zupa's v1.0 & 1.1 release:

player setVariable["headShots",_cashMoney,true];
player setVariable["bank",_bankMoney];

You dont need both of the above, just for what version of this single currency mod you are using.

Warning: This might change with release version 2.

Excellent, thanks for sharing.

Link to comment
Share on other sites

PLEASE IGNORE THIS. I GOT MY ANSWER (at the very bottom).

 

---

This worked fine without any reported issues for 2 days but today I've received several reports of an issue. Tested with some players it appears it is consistent on my server, running "Zupa's coins 999 version 1.1" along with the fix above.

 

Reproduction steps:

1. Player change skin [for example's sake let's say he has 50 gold on him & 100 in bank, he is in location 1 <== and let's call this gear+cash/bank+location "playerstate 1"].

2. Player lose HUD money & bank balance display. [he still has 50 gold on him & 100 in bank - he just can't see it]

3. Player is now somehow disconnected from the database if he relogs now, he will jump back to playerstate 1. He can now go and do whatever he wants without any persistent (save-to-database) consequences because he has a cosy revert-to point which is playerstate 1.

4. When he's done messing about, player relogs and reverts back to state 1.

 

Anyone else experiencing the issue above? Any known fixes?

 

Thanks

 

 

EDIT1: I am aware of "Force goldcoins update onplayerDisconnect" @ and it is implemented and set to true on my server and it is still an issue.

 

EDIT2: I've just became aware of another report of the same issue ( ) and Zupa's official response on it ( ) I guess we got some more work to do tomorrow :)

Link to comment
Share on other sites

that seems to me like its not saving on your server...

Do you think it's happening because of server load then?

Current plan is, I'll switch to your custom hive and will see if it's still an issue. I don't know what else to try. I hope that'll fix it...

Link to comment
Share on other sites

  • 3 weeks later...

I'm about to install this, Soul can you please confirm - Is this till relevant - are there any updates to it somewhere else?

I had a few scripts installed only to learn later that they were not needed anymore so just checking in advance...

 

Thanks

Link to comment
Share on other sites

  • 4 months later...

So having never read this before until now, I recently put the old player_wearClothes.sqf in my mission file and called it because I dont want players to be able to change clothes while wearing a backpack. Recently Ive been having issues with players complaining about money in the bank disappearing or negative money on their character, which I've never had before. Could this be why? Is there something in the player_wearClothes.sqf that could cause this issue?

 

player_wearClothes.sqf

/*
_item spawn player_wearClothes;
Added Female skin changes - DayZ Epoch - vbawol
*/
private ["_item","_onLadder","_hasclothesitem","_config","_text","_myModel","_itemNew","_currentSex","_newSex","_model","_playerNear"];

if(DZE_ActionInProgress) exitWith { cutText [(localize "str_epoch_player_83") , "PLAIN DOWN"] };
DZE_ActionInProgress = true;

_item = _this;
call gear_ui_init;

_onLadder =        (getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> (animationState player) >> "onLadder")) == 1;
if (_onLadder) exitWith {DZE_ActionInProgress = false; cutText [(localize "str_player_21") , "PLAIN DOWN"]};

_hasclothesitem = _this in magazines player;
_config = configFile >> "CfgMagazines";
_text = getText (_config >> _item >> "displayName");

if (!_hasclothesitem) exitWith { DZE_ActionInProgress = false; cutText [format[(localize "str_player_31"),_text,"wear"] , "PLAIN DOWN"]};

if (vehicle player != player) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_85"), "PLAIN DOWN"]};

if (!isNull (unitBackpack player)) exitWith { DZE_ActionInProgress = false; cutText  [("You must remove your backpack to change clothes"), "PLAIN DOWN"] };

if ("CSGAS" in (magazines player)) exitWith { DZE_ActionInProgress = false; cutText [(localize "STR_EPOCH_ACTIONS_10"), "PLAIN DOWN"] };

_myModel = (typeOf player);
_itemNew = "Skin_" + _myModel;

//diag_log ("Debug Clothes: model In: " + str(_itemNew) + " Out: " + str(_item));

if ( (isClass(_config >> _itemNew)) ) then {
    if ( (isClass(_config >> _item)) ) then {
        // Current sex of player skin
        
        _currentSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _itemNew >> "sex");
        // Sex of new skin
        _newSex = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "sex");
        //diag_log ("Debug Clothes: sex In: " + str(_currentSex) + " Out: " + str(_newSex));

        if(_currentSex == _newSex) then {
            // Get model name from config
            _model = getText (configFile >> "CfgSurvival" >> "Skins" >> _item >> "playerModel");
            if (_model != _myModel) then {
                if(([player,_item] call BIS_fnc_invRemove) == 1) then {
                    player addMagazine _itemNew;
                    [dayz_playerUID,dayz_characterID,_model] spawn player_humanityMorph;
                };
            };

        } else {
            cutText [(localize "str_epoch_player_86"), "PLAIN DOWN"];
        };
    };
};
DZE_ActionInProgress = false;

Link to comment
Share on other sites

  • 3 weeks later...

I'm a bit confused as to why we need to pull out player_wearClothes, put it in our mission folder, and change the reference to point to the new location, when you don't have us edit anything inside it? If its the same file as whats in the server pbo, why increase my mission file with a file that has no changes?

 

EDIT: Looks like i misread the instructions. I guess it is saying to delete your custom wearClothes from your mission PBO and change the reference to point back to the @dayz_epoch folder, and instead use switchmodel.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...