Jump to content

[Release] Single currency (Souls 2.0) With Fixes All In One And More (v0.5)


Recommended Posts

  • 4 weeks later...

For some reason the coins are only saved on players and not on banks. 
The only major change I did was implementing P4L. Can anyone point me in the right direction?


Just tried it with only the files delivered by this mod but the outcome is still the same

Edited by Nekuan
Link to comment
Share on other sites

  • 5 weeks later...

For people who have problems with the check wallet that your players go into minus just dont let them pick it up then .

You can change this in check_wallet.sqf .

private ["_body", "_hisMoney", "_myMoney", "_killsH", "_test2", "_headShots", "_test","_playeridke","_humanity"];

_body = _this select 3;

// Add This to not let players pick up over 999999
_hisMoney = _body getVariable ["cashMoney",0];
if(_hisMoney > 999999) exitWith {
		cutText ["This player has to many coins you cant pick it up it will bug your cash", "PLAIN DOWN"];
    };
// Add This to not let players pick up over 999999

_PlayerNear = _body call dze_isnearest_player;
if (_PlayerNear) exitWith {cutText [localize "str_pickup_limit_4", "PLAIN DOWN"]};

_name = _body getVariable ["bodyName","unknown"];
_hisMoney = _body getVariable ["cashMoney",0];
_myMoney = player getVariable ["cashMoney",0];
_myMoney = _myMoney + _hisMoney;
_body setVariable ["cashMoney", 0 , true];

player setVariable ["cashMoney", _myMoney , true];

systemChat format ['You took %1 coins, ID says %2 !',_hisMoney,_name];
sleep 2;

_cid =	player getVariable ["CharacterID","0"];
_cashMoney = player getVariable ["cashMoney",0];

if(_cashMoney > 0) then{

} else {

_cashMoney = 0;

};	

 

Link to comment
Share on other sites

  • 2 weeks later...

Installed this, whenever a player relogs/server restarts the coins on their character + back don't save. Other than that everything works the coins just won't save.


Have you replaced the DLL files and unblocked them if necessary?

Link to comment
Share on other sites

Right click on one of the DLL files and you'll see at the bottom it says "This file came from another computer and might be blocked to help protect this computer". You then need to check off the Unblock and hit Apply.

d0d3f80809.png

Link to comment
Share on other sites

Right click on one of the DLL files and you'll see at the bottom it says "This file came from another computer and might be blocked to help protect this computer". You then need to check off the Unblock and hit Apply.

d0d3f80809.png

EDIT: Would I do this on my computer before I upload them to my server or would I do it after they have been uploaded? Also if it's the second, how would I do that with filezilla?

Edited by Pavillin
Link to comment
Share on other sites

  • 2 weeks later...

What was the error? I'm having the same problem now after I moved from no bank to bank.

I forgot to merge a few files in the dayz_server.pbo in the compile folder, I did every other file but forgot a couple in that folder. Also I had to add the banks not saving for new players fix. After that everything was working properly.

http://epochmod.com/forum/index.php?/topic/15924-issue-banking_data-not-saving-for-new-players-fixed/

Edited by Pavillin
Link to comment
Share on other sites

CashMoney is being saved in Character_DATA but the banking_data remains empty when I deposit cash. 
What am I missing?

I assume that you're merging this with an existing server... As silly as it may sound, I believe that you're missing something from one of the files in the compile folder. I had the SC working fine but only had bank issues, and it was because I missed files in the dayz_server.pbo Once I compared files specifically in the compile folder I noticed I was missing some code. Made the changes and everything started working. So I would say your problem hides in the server pbo.

Edited by Pavillin
Link to comment
Share on other sites

I assume that you're merging this with an existing server... As silly as it may sound, I believe that you're missing something from one of the files in the compile folder. I had the SC working fine but only had bank issues, and it was because I missed files in the dayz_server.pbo Once I compared files specifically in the compile folder I noticed I was missing some code. Made the changes and everything started working. So I would say your problem hides in the server pbo.

I replaced all the files in the compiles folder with the one included in the SC 3.0 package. The only thing I've changed in the dayz_server.pbo is the #include bit that goes in the server_functions.

Edit: Tried using the premade pbo files but the same error occured. Any special visual c++ version required?

Edited by bFe
Link to comment
Share on other sites

I replaced all the files in the compiles folder with the one included in the SC 3.0 package. The only thing I've changed in the dayz_server.pbo is the #include bit that goes in the server_functions.
Edit: Tried using the premade pbo files but the same error occured. Any special visual c++ version required?

Not that I'm aware of

Link to comment
Share on other sites

This is due to currencies over a million liking to save to the database in scientific notation, ie 1.2E+06. Read this thread: http://epochmod.com/forum/index.php?/topic/15975-issue-players-get-negative-sums-in-cashmoney-across-restarts/

This will still cause errors when converted it to a decimal. Ideally you want it to save to the DB without the decimal.

If you get the CBA pack for Arma2 and find the formatNumbers function, change a few things to get it so it will work client side, you can format the number without decimals. I can post the function I use when I get home if you're unsure what I am saying.

Link to comment
Share on other sites

Global message:

Formatting numbers is only for displaying the value in the way you want it.

Negative money is a known bug. Never really pinpointed the issue myself. I blame lag in the saving process with the dll or a wrong parse in the dll/sql connection.

Link to comment
Share on other sites

Global message:

Formatting numbers is only for displaying the value in the way you want it.

Negative money is a known bug. Never really pinpointed the issue myself. I blame lag in the saving process with the dll or a wrong parse in the dll/sql connection.

After I started saving numbers into the database as a string, the problem went away.

Link to comment
Share on other sites

  • 2 weeks later...

Sure,

I removed the Community Base Addons format number function from the PBO and modified so it would work for this purpose:

Save this as "cba_number.sqf" somewhere in your mission file

private ["_integerPart", "_string", "_numIntegerDigits", "_decimalPoint","_thousandsSeparator", "_basePlaces"];
    _number = _this select 0;
    _integerWidth = _this select 1;
    _decimalPlaces = _this select 2;
    _separateThousands = _this select 3;
    _decimalPoint = ".";
    _thousandsSeparator = ",";

    if (_decimalPlaces > 0) then {
            _basePlaces = 10 ^ _decimalPlaces;
            _number = round(_number * _basePlaces) / _basePlaces;
            _integerPart = floor (abs _number);
        } else {
        _integerPart = round (abs _number);
    };

    _string = "";
    _numIntegerDigits = 0;

while {_integerPart > 0} do {
    if ((_numIntegerDigits > 0) and ((_numIntegerDigits mod 3) == 0) and _separateThousands) then {
        _string = _thousandsSeparator + _string;
    };
    _string =  (str (_integerPart mod 10)) + _string;
    _numIntegerDigits = _numIntegerDigits + 1;
    _integerPart = floor (_integerPart / 10);
};

while {_numIntegerDigits < _integerWidth} do {
    if ((_numIntegerDigits > 0) and ((_numIntegerDigits mod 3) == 0) and _separateThousands) then {
        _string = _thousandsSeparator + _string;
    };
    _string = "0" + _string;
    _numIntegerDigits = _numIntegerDigits + 1;
};

if (_number < 0) then {
    _string = "-" + _string;
};

if (_decimalPlaces > 0) then {
    private ["_digit", "_multiplier", "_i"];
    _string = _string + _decimalPoint;
    _multiplier = 10;
    
    for "_i" from 1 to _decimalPlaces do {
    _digit = floor ((_number * _multiplier) mod 10);
        if (not (finite _digit)) exitWith {
            private "_j";
                for "_j" from _i to _decimalPlaces do {
                    _string = _string + "0";
                };
            };
            _string = _string + (str _digit);
            _multiplier = _multiplier * 10;
        };
    };
_string;

Put this in your compiles.sqf (change path)

CBA_fnc_formatNumber =			compile preprocessFileLineNumbers "path\to\file\cba_number.sqf";

Finally, in your server_playerSync.sqf add (and also _cashMoneyCBA at the end declaring private variables):

_cashMoneyCBA = [_cashMoney,0,0,false] call CBA_fnc_formatNumber;

under

_cashMoney = ["cashMoney",_character] call server_getDiff2;

and change the _cashMoney to _cashMoneyCBA here (line 192 for me)

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

What this does is converts _cashMoney to a string before writing it to the hive. I take back what I said though: coins will still very rarely go negative, but you won't have the write to hive errors. What I do is run this every restart:

-- Non negative cashMoney
UPDATE `character_data` SET `cashMoney` = 0
	WHERE `cashMoney` < 0;

 

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
  • Advertisement
×
×
  • Create New...