Jump to content

[Issue] Players get negative sums in cashMoney across restarts


Recommended Posts

 

I should probably add it does not always happen. 70% time its all fine.. and I am running the SC2 stuff.

 

HiveExt.dll ver 0.9.4.14

Database.dll 0.9.9.0

DatabaseMySql.dll 0.9.14.0

tbb.dll 4.1.2012.718

tbbmalloc.dll 4.1.2012.718

 

You haven't put the MDC_fnc_numbertoString function in compiles.sqf, I reckon.

Link to comment
Share on other sites

For the negative currency issue would something like this fix it in the player setup? The negative currency issue is happening about 4% of the time but its still an issue.

if (_cashMoney == 0) then {
diag_log format["Player %1 loging in with %2 money.",_playerName,_cashMoney];
} else {
if (_cashMoney > 0) then {
diag_log format["Player %1 loging in with %2 money.",_playerName,_cashMoney];
};
if (_cashMoney < 0) then {
diag_log format["Player %1 loging in with %2 money.",_playerName,_cashMoney];
_cashMoney = abs _cashMoney;
diag_log format["Player %1 fixing currency %2 .",_playerName,_cashMoney];
};
};
Link to comment
Share on other sites

&nbsp; &nbsp;

You haven't put the MDC_fnc_numbertoString function in compiles.sqf, I reckon.

I did put it there and I am having the same issue. Randomly when players receive money either from trading or picking up from corpses it bugs and dsiplays they have 0 coins, and the RPT spams the above error. I checked and triple checked that everything is placed correctly. Please check this if you have time. Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

 

2014/11/22,  5:22:44 Strange convex component278 in warehouse\models\warehouse.p3d:geometryView

2014/11/22,  5:22:46 Warning: looped for animation: ca\anims\characters\data\anim\sdr\mov\erc\wlk\non\non\amovpercmwlksnonwnondf.rtm differs (looped now 0)! MoveName: amovpercmstpsnonwnondnon_amovpercmstpsraswpstdnon
2014/11/22,  5:22:46 Warning: looped for animation: ca\anims\characters\data\anim\sdr\mov\erc\wlk\non\non\amovpercmwlksnonwnondf.rtm differs (looped now 1)! MoveName: amovpercmrunsnonwbindf_rfl
2014/11/22,  5:22:47 "DayZ Epoch: PRELOAD Functions\init [[<No group>:0 (FunctionsManager)],any]"
2014/11/22,  5:22:47 "DayZ Epoch: MPframework inited"
2014/11/22,  5:22:47 Warning Message: Script z\addons\dayz_server\init\server_functions.sqf not found
2014/11/22,  5:22:47 Warning Message: Script z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\dynamic_vehicle.sqf not found
2014/11/22,  5:22:47 Warning Message: Script z\addons\dayz_server\missions\DayZ_Epoch_11.Chernarus\mission.sqf not found
2014/11/22,  5:22:47 "Res3tting B!S effects..."
2014/11/22,  5:22:47 Warning Message: Script z\addons\dayz_server\system\server_monitor.sqf not found

 

Hey mdc

I used yor fix server not started

any idea why?

Link to comment
Share on other sites

2014/11/22,  5:22:47 Warning Message: Script z\addons\dayz_server\init\server_functions.sqf not found
 
Looks like you re-packed the PBO incorrectly mate; nothing in my fix would've caused that :P
Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...

Aloha Everyone.

I have repeating problem of negative values in cashmoney. 
HiveExt.log revealed this:

 

2015-02-24 05:37:59 HiveExt: [information] Method: 201 Params: 3902:[265,[15508.4,13228,0.001]]:[[itemFlashlightRed,ItemMap,ItemRadio,ItemKnife,NVGoggles,M9SD,M4A1_AIM_SD_camo],[itemBandage,ItemBandage,ItemMorphine,ItemPainkiller,ItemWaterbottleBoiled,FoodSteakCooked,FoodCanBakedBeans,FoodCanSardines,ItemBandage,15Rnd_9x19_M9SD,15Rnd_9x19_M9SD,15Rnd_9x19_M9SD,15Rnd_9x19_M9SD,15Rnd_9x19_M9SD,30Rnd_556x45_StanagSD,30Rnd_556x45_StanagSD,vil_10Rnd_SVDK,FHQ_rem_30Rnd_680x43_ACR,FHQ_rem_30Rnd_680x43_ACR_SD]]:[DZ_Backpack_EP1,[[],[]],[[FHQ_rem_5Rnd_300Win_XM2010_NT,gms_k98_mag,RH_20Rnd_9x19_M93,vil_20Rnd_762x51_G3,RH_13Rnd_9x19_bhp,RH_20Rnd_762x51_SD_hk417,FHQ_rem_7Rnd_338Lapua_MSR_NT_SD,20Rnd_762x51_DMR,30Rnd_556x45_Stanag,100Rnd_762x51_M240],[1,1,1,1,1,1,1,1,1,1]]]:[false,false,false,false,false,false,false,12000,[],[0,0],0,[698.766,684.367]]:false:false:0:0:0:1:[,ainvpknlmstpsnonwnondnon_amovpknlmstpsraswpstdnon,42,[]]:0:0::0:14962.5:

2015-02-24 05:37:59 HiveExt: [Error] Error executing |CHILD:201:3902:[265,[15508.4,13228,0.00136375]]:[["ItemFlashlightRed","ItemMap","ItemRadio","ItemKnife","NVGoggles","M9SD","M4A1_AIM_SD_camo"],["ItemBandage","ItemBandage","ItemMorphine","ItemPainkiller","ItemWaterbottleBoiled","FoodSteakCooked","FoodCanBakedBeans","FoodCanSardines","ItemBandage","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","15Rnd_9x19_M9SD","30Rnd_556x45_StanagSD","30Rnd_556x45_StanagSD","vil_10Rnd_SVDK","FHQ_rem_30Rnd_680x43_ACR","FHQ_rem_30Rnd_680x43_ACR_SD"]]:["DZ_Backpack_EP1",[[],[]],[["FHQ_rem_5Rnd_300Win_XM2010_NT","gms_k98_mag","RH_20Rnd_9x19_M93","vil_20Rnd_762x51_G3","RH_13Rnd_9x19_bhp","RH_20Rnd_762x51_SD_hk417","FHQ_rem_7Rnd_338Lapua_MSR_NT_SD","20Rnd_762x51_DMR","30Rnd_556x45_Stanag","100Rnd_762x51_M240"],[1,1,1,1,1,1,1,1,1,1]]]:[false,false,false,false,false,false,false,12000,[],[0,0],0,[698.766,684.367]]:false:false:0:0:0:1:["","ainvpknlmstpsnonwnondnon_amovpknlmstpsraswpstdnon",42,[]]:0:0::0:14962.500000:|

 

We are using SC2.0 + 999 hive
Question is, how did that decimal value got there, on the cashmoney param.?
To be honest i haven't had problem of negative values since i aplied MDC's conversion function... 
Strangely, issue considers only one player at the moment, is it possible that he is using "fake" compiles sqf somehow?
 

Link to comment
Share on other sites

For now i have cut of the decimal part of the number from MDC's convert function. Anyway this function only converts numbers to strings for the purpose of single coins... and single coins shouldnt have decimal part because cash money field in database is int type. Even if there is a wrong value of cash on player on runtime it anyway should be cutoff when passing to db. I see it that way.

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...
On 10/24/2014 at 10:37 AM, Rocu said:

 

Seems like this indeed does work. Haven't tested it 100% but at first glance it seems like it fixed the main issue.

Great find. Kudos for you!

 

You should prob. make a pull request on Zupa's GitHub for this since it's quite the issue. Or at very least it should be included in the library.

 

 

And just to make things easier here's the step-by-step of what mdc did to his files:

 

 

 

 

Open server_playerSync.sqf from your server's PBO.

 

 

Find:


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

Add below:


_cashMoneyStr = _cashMoney call MDC_fnc_numberToString;

Find:


,_cashMoney];

Replace it with:


,_cashMoneyStr];

Open your custom compiles.sqf from your mission PBO.

 

At the very top, add:


MDC_fnc_numberToString = {
	_number = _this;
	_str = "";
	if (_number == 0) then {
		_str = "0";
	} else {
		_negative = false;
		if (_number < 0) then {
			_number = abs _number;
			_negative = true;
		};
		if (_number % 1 == 0) then {
			while { _number > 0 } do {
				_digit = floor (_number % 10);
				_str = (str _digit) + _str;
				_number = floor (_number / 10);
			};
		} else {
			_decimals = _number % 1;
			_decimals = _decimals * 1000000;
			_number = floor _number;
			_str = _number call MDC_fnc_numberToString;
			_str = _str + "." + str _decimals;
		};
		if (_negative) then { _str = "-" + _str; };
	};
	_str;
};

I Applied this fix but I still have players with a negative coin amount after restart. 

Any more ideas?   

I'm using this - http://epochmod.com/forum/topic/17675-release-single-currency-souls-20-with-fixes-all-in-one-and-more-v05/

 

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
  • Discord

×
×
  • Create New...