Jump to content

Recommended Posts

do you have

 

Traders Are broken. I can't talk to them at all. This is my RTP error

 

Error Undefined variable in expression: servertraders


File mpmissions\__CUR_MP.Tavi\Compile\fn_selfActions.sqf, line 608
Error in expression if (s_givemoney_d>
Error position: if (s_givemoney_d>

))>

 

This is line 608 of selfactions

//Player Deaths code above

 

 

// Zupa- SC - Give Money - Line 607
if (_isMan and _isAlive and !_isZombie and !_isAnimal and !(_traderType in serverTraders)) then {
if (s_givemoney_dialog < 0) then {
s_givemoney_dialog = player addAction [format["Give Money to %1", (name _cursorTarget)], "gold\give_player_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
};
} else {
player removeAction s_givemoney_dialog;
s_givemoney_dialog = -1;

 

//Fuel Pump
};

 

Any solutions? I had Zupa's traders working.

I'm also running this on Taviana. Linked all the trader tilds to my own category cfg trader

 

It seems u dont have a server_traders.sqf ?

 

Or dont u call it in your init.sqf ?

call compile preprocessFileLineNumbers "server_traders.sqf";				//Compile trader configs
progressLoadingScreen 1.0;

OR MOST LIKELY

 

TYPO in your server_traders.sqf, look up in the rpt and see if there is another error in server_traders.sqf

Link to comment
Share on other sites

Yea I have no idea how to fix it, it doesn't save the coins... Correct?

 

 

Anyone else getting this error on the RPT?

13:00:12 "EPOCH SERVERTRADE: Player: Name (xxxxxxxxxxxxx) bought a  in/at trader city Klen for 2000x Gold Coins"
13:00:12 Error in expression <for %5", _name, (getPlayerUID _player), _classname, _traderCity, _price];
} else>
13:00:12   Error position: <_classname, _traderCity, _price];
} else>
13:00:12   Error Undefined variable in expression: _classname
13:00:12 File z\addons\dayz_server\compile\server_tradeObject.sqf, line 15

 

 

Yea I have no idea how to fix it, it doesn't save the coins... Correct?

 

that error has got nothing to do with the single currency mod, its just logging to rpt who bought what where

Link to comment
Share on other sites

Yup more errors, can't get money to save for players.

(Yes I've added this: )

Anyone got any ideas?

Not sure why the server is doing this. I've no ideas at all..

 

What do you mean by money not saving for players? Do you have similiar issue like I did when occasionally it didn't save and some people lost their money? Or like literally it doesn't save at all? (Sorry if I haven't read up on your issue)

Link to comment
Share on other sites

What do you mean by money not saving for players? Do you have similiar issue like I did when occasionally it didn't save and some people lost their money? Or like literally it doesn't save at all? (Sorry if I haven't read up on your issue)

Okay, i'll explain my situation.

I got a new server, so my first thought was to add the single currency script, so I did that.

I found that after adding the scripts and also the DLL files of which were needed i found that the script was working perfectly.

Until someone on my server got themselves some money (I also tested this myself and It proved not to work) and then for them to back out or disconnect once they reconnected they had no money when in fact they actually should.

So pretty much players were losing money on restart / player disconnect.

Link to comment
Share on other sites

Okay, i'll explain my situation.

I got a new server, so my first thought was to add the single currency script, so I did that.

I found that after adding the scripts and also the DLL files of which were needed i found that the script was working perfectly.

Until someone on my server got themselves some money (I also tested this myself and It proved not to work) and then for them to back out or disconnect once they reconnected they had no money when in fact they actually should.

So pretty much players were losing money on restart / player disconnect.

can you reproduce that and get the hiveext.log file for that session please and please use pastebin for the log.

Link to comment
Share on other sites

can you reproduce that and get the hiveext.log file for that session please and please use pastebin for the log.

Yeah... Pastebin wouldn't allow it... So here's a dropbox of it instead: https://www.dropbox.com/s/4twvqhifvhtskyz/HiveExt.txt?dl=0

Right so the problem is:

Players can get money on the server well, no problems.

But once they log out, It gets removed.

Link to comment
Share on other sites

Yeah... Pastebin wouldn't allow it... So here's a dropbox of it instead: https://www.dropbox.com/s/4twvqhifvhtskyz/HiveExt.txt?dl=0

Right so the problem is:

Players can get money on the server well, no problems.

But once they log out, It gets removed.

Here's a video on what im trying to explain:

https://www.youtube.com/watch?v=7m0TUim6feg

Link to comment
Share on other sites

I see an error pop up in your logs occasionally:

HiveExt: [Error] Invalid method id: 999

I belive the issue is that you don't have the 999 dll but the script is trying to update using 999 call. If you use Soul's dll (that doesn't support 999) make sure you also update all the server & mission files.

Link to comment
Share on other sites

I see an error pop up in your logs occasionally:

HiveExt: [Error] Invalid method id: 999

I belive the issue is that you don't have the 999 dll but the script is trying to update using 999 call. If you use Soul's dll (that doesn't support 999) make sure you also update all the server & mission files.

Haha, I got called out on that in the group chat Zupa just pulled me in :D Thanks for your help man!

 

Link to comment
Share on other sites

Hey I'm getting an issue where the bank amount is not saving after players log off the server and rejoin, I was able to get the amount saved on the player itself but not in the bank any ideas and I'm not getting any errors in my RPT?

 

EDIT: I found the following error in my RPT 

23:52:21 Error in expression < for %5",_name, (getPlayerUID _player), _classname, _traderCity, _price];

};
 
if>
23:52:21   Error position: <_classname, _traderCity, _price];
};
 
if>
Link to comment
Share on other sites

The gold\trade_* files seem to be quite buggy and lacking some features compared to the original ones. When buying new weapons it doesn't check if you have something in your hand already or not so if you buy a weapon you suddenly have 2 primary weapons in your primary weapon slot. Logs aren't echoed properly, etc etc.

 

For me the faulty logs were most annoying because I couldn't keep track of who's selling what. The buying logs are created correctly but when you sell certain items you get something like:

Player: Rocu (xxx) sold a Coins in/at trader city Branibor for 1x Coins"

To fix this open up your trade_weapons.sqf

 

Find:

PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_out,inTraderCity];

Replace it with:

if (_bos == 1) then {
	// Selling
	PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_in,inTraderCity,CurrencyName,_qty_out];
} else {
	// Buying
	PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_out,inTraderCity,CurrencyName,_qty_in];
};

You can do this to the other trade files aswell. Trade_items for example doesn't have logging at all. Sooo yeah there's that...

I'd fix the files myself but have currently more prioritized issues in my server that require my attention.

Link to comment
Share on other sites

Awesome that u posted that. :D Thanks!

 

Any idea on the Unknown tradercity stuff? Im getting it for all my tradercities... 

 

Unknown trader cities I believe can be random vendors that aren't in trader cities like wholesaler etc. Not sure about this tho, just guessing.

Other then that, if you have custom made trader cities that can be the cause as well.

Link to comment
Share on other sites

Have some players duping coins by logging out straight after they deposit coins into their bank. Basically having the amount added to bank but not subtracted from wallet.

Can anyone confirm this?

I have been able to replicate the result.

 

EDIT: Sorry! you have to add '.1' to the end of the deposit amount. eg. 100000.1

Link to comment
Share on other sites

The gold\trade_* files seem to be quite buggy and lacking some features compared to the original ones. When buying new weapons it doesn't check if you have something in your hand already or not so if you buy a weapon you suddenly have 2 primary weapons in your primary weapon slot. Logs aren't echoed properly, etc etc.

 

For me the faulty logs were most annoying because I couldn't keep track of who's selling what. The buying logs are created correctly but when you sell certain items you get something like:

Player: Rocu (xxx) sold a Coins in/at trader city Branibor for 1x Coins"

To fix this open up your trade_weapons.sqf

 

Find:

PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_out,inTraderCity];

Replace it with:

if (_bos == 1) then {
	// Selling
	PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_in,inTraderCity,CurrencyName,_qty_out];
} else {
	// Buying
	PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_out,inTraderCity,CurrencyName,_qty_in];
};

You can do this to the other trade files aswell. Trade_items for example doesn't have logging at all. Sooo yeah there's that...

I'd fix the files myself but have currently more prioritized issues in my server that require my attention.

 

Rocu,

 

Thanks for sharing the fix which worked for you. I applied this, I think there's some improvement but it hasn't resolved my issue 100%.

The first trade transaction below is selling a briefcase to auto dealer.

Second trade transaction is purchasing a motorbike from him.

 

None of the transactions gave me trade item name and the trade city name properly.

This is a custom trade city I've added from scratch - could it be the reason? What can I do to fix this?

2014/09/08, 20:07:12 "EPOCH SERVERTRADE: Player: Player1 (76561198142412345) bought a Unknown Vehicle in/at Unknown Trader City for <null>x <null>"
2014/09/08, 20:07:12 Error in expression <urrency =    _this select 5;
_qty =        _this select 6;
_clientID =     owner _player;
_p>
2014/09/08, 20:07:12   Error position: <select 6;
_clientID =     owner _player;
_p>
2014/09/08, 20:07:12   Error Zero divisor
2014/09/08, 20:07:12 File z\addons\dayz_server\compile\server_tradeObject.sqf, line 9
2014/09/08, 20:07:34 "EPOCH SERVERTRADE: Player: Player1 (76561198142412345) sold a [374f90c0# 1056478: tt650.p3d] in/at Unknown Trader City for <null>x <null>"
2014/09/08, 20:07:34 Error in expression <urrency =    _this select 5;
_qty =        _this select 6;
_clientID =     owner _player;
_p>
2014/09/08, 20:07:34   Error position: <select 6;
_clientID =     owner _player;
_p>
2014/09/08, 20:07:34   Error Zero divisor
2014/09/08, 20:07:34 File z\addons\dayz_server\compile\server_tradeObject.sqf, line 9
Link to comment
Share on other sites

Here are couple of my logs from today:

23:16:15 "EPOCH SERVERTRADE: Player: vihane (765xxxxxxxxxxxxxx) sold a vil_FnMag in/at trader city Sabina for 10000x Coins"
23:19:39 "EPOCH SERVERTRADE: Player: Lovvi (765xxxxxxxxxxxxxx) bought a ATV_US_EP1 in/at trader city Sabina for 2000x Coins"
23:22:09 "EPOCH SERVERTRADE: Player: Kodu (765xxxxxxxxxxxxxx) bought a 350z_ruben in/at trader city Sabina for 15000x Coins"
23:34:47 "EPOCH SERVERTRADE: Player: Risto (765xxxxxxxxxxxxxx) sold a FHQ_ACR_BLK_G33_GL in/at trader city Sabina for 5300x Coins"

and so on..

That's how it should look like. I don't think your issue is custom trader city.

 

Can you show me the trade files? If you bought a vehicle then trade_any_vehicles.sqf and trade_items.sqf for briefcase I belive.

Link to comment
Share on other sites

Here are couple of my logs from today:

23:16:15 "EPOCH SERVERTRADE: Player: vihane (765xxxxxxxxxxxxxx) sold a vil_FnMag in/at trader city Sabina for 10000x Coins"
23:19:39 "EPOCH SERVERTRADE: Player: Lovvi (765xxxxxxxxxxxxxx) bought a ATV_US_EP1 in/at trader city Sabina for 2000x Coins"
23:22:09 "EPOCH SERVERTRADE: Player: Kodu (765xxxxxxxxxxxxxx) bought a 350z_ruben in/at trader city Sabina for 15000x Coins"
23:34:47 "EPOCH SERVERTRADE: Player: Risto (765xxxxxxxxxxxxxx) sold a FHQ_ACR_BLK_G33_GL in/at trader city Sabina for 5300x Coins"

and so on..

That's how it should look like. I don't think your issue is custom trader city.

 

Can you show me the trade files? If you bought a vehicle then trade_any_vehicles.sqf and trade_items.sqf for briefcase I belive.

 

Here's how it looks on our server:

2014/09/08, 23:35:40 "EPOCH SERVERTRADE: Player: Tak3R (76561197984212345) sold a Mk_48_DZ in/at Unknown Trader City for 10000x Gold Coins"
2014/09/08, 23:35:59 "EPOCH SERVERTRADE: Player: Steep (76561198068012345) sold a [3e04f040# 1062663: lada.p3d REMOTE] in/at Unknown Trader City for <null>x <null>"
2014/09/08, 23:36:09 "EPOCH SERVERTRADE: Player: =ws= Wonkes  (76561197998812345) sold a VSS_vintorez in/at Unknown Trader City for 2500x Gold Coins"
2014/09/08, 23:36:19 "EPOCH SERVERTRADE: Player: Steep (76561198068012345) bought a Unknown Vehicle in/at Unknown Trader City for <null>x <null>"
2014/09/08, 23:36:19 Error in expression <urrency =    _this select 5;
_qty =        _this select 6;
_clientID =     owner _player;
_p>
2014/09/08, 23:36:19   Error position: <select 6;
_clientID =     owner _player;
_p>
2014/09/08, 23:36:19   Error Zero divisor
2014/09/08, 23:36:19 File z\addons\dayz_server\compile\server_tradeObject.sqf, line 9
2014/09/08, 23:36:20 "PUBLISH: Attempt 3ead0100# 1062707: arrow_down_large_ep1.p3d REMOTE"

So,

for some items it has no idea about item's name ("Unknown Vehicle").

for some other trade items it's using a weird name ("3e04f040# 1062663: lada.p3d REMOTE")

for the ones it's aware of trade item name, (Mk_48_DZ) it's still failing to produce a perfect log entry => sold a Mk_48_DZ in/at Unknown Trader City for 10000x Gold Coins".

 

A lot of problems... Any ideas how to fix this?

 

 

 

EDIT - copied below are my files:

 

trade_any_vehicles.sqf

private ["_veh","_location","_isOk","_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_obj","_objectID","_objectUID","_bos","_started","_finished","_animState","_isMedic","_dir","_helipad","_removed","_keyColor","_keyNumber","_keySelected","_isKeyOK","_config","_damage","_tireDmg","_tires","_okToSell","_hitpoints","_needed","_activatingPlayer","_textPartIn","_textPartOut","_traderID","_playerNear"];

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

// Test cannot lock while another player is nearby
//_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
//if(_playerNear) exitWith { DZE_ActionInProgress = false; cutText [(localize "str_epoch_player_104") , "PLAIN DOWN"];  };

// [part_out,part_in, qty_out, qty_in, loc];

_activatingPlayer = player;

_part_out = (_this select 3) select 0;
_part_in = (_this select 3) select 1;
_qty_out = (_this select 3) select 2;
_qty_in = (_this select 3) select 3;
_buy_o_sell = (_this select 3) select 4;
_textPartIn = (_this select 3) select 5;
_textPartOut = (_this select 3) select 6;
_traderID = (_this select 3) select 7;
_bos = 0;

if(_buy_o_sell == "buy") then {
	//_qty = {_x == _part_in} count magazines player;
	_qty = player getVariable ["cashMoney",0]; // get your money variable	
} else {

	if (_part_in isKindOf "Air") then {
		_obj = nearestObjects [(getPosATL player), [_part_in], dayz_sellDistance_air];
	} else {
		_obj = nearestObjects [(getPosATL player), [_part_in], dayz_sellDistance_vehicle];
	};
	_qty = count _obj;
	_bos = 1;
};

if (_qty >= _qty_in) then {

	cutText [(localize "str_epoch_player_105"), "PLAIN DOWN"];
	 
	[1,1] call dayz_HungerThirst;
	// force animation 
	player playActionNow "Medic";

	r_interrupt = false;
	_animState = animationState player;
	r_doLoop = true;
	_started = false;
	_finished = false;
	
	while {r_doLoop} do {
		_animState = animationState player;
		_isMedic = ["medic",_animState] call fnc_inString;
		if (_isMedic) then {
			_started = true;
		};
		if (_started and !_isMedic) then {
			r_doLoop = false;
			_finished = true;
		};
		if (r_interrupt) then {
			r_doLoop = false;
		};
		sleep 0.1;
	};
	r_doLoop = false;

	if (!_finished) exitWith { 
		r_interrupt = false;
		if (vehicle player == player) then {
			[objNull, player, rSwitchMove,""] call RE;
			player playActionNow "stop";
		};
		cutText [(localize "str_epoch_player_106") , "PLAIN DOWN"];
	};

	if (_finished) then {

		// Double check for items
		if(_buy_o_sell == "buy") then {
			//_qty = {_x == _part_in} count magazines player;
				_qty = player getVariable ["cashMoney",0]; // get your money variable
		} else {
			if (_part_in isKindOf "AIR") then {
				_obj = nearestObjects [(getPosATL player), [_part_in], dayz_sellDistance_air];
			} else {
				_obj = nearestObjects [(getPosATL player), [_part_in], dayz_sellDistance_vehicle];
			};
			_qty = count _obj;	
		};

		if (_qty >= _qty_in) then {

			//["PVDZE_obj_Trade",[_activatingPlayer,_traderID,_bos]] call callRpcProcedure;
			if (isNil "_obj") then { _obj = "Unknown Vehicle" };
			if (isNil "inTraderCity") then { inTraderCity = "Unknown Trader City" };
			PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_obj,inTraderCity];
			publicVariableServer  "PVDZE_obj_Trade";
	
			//diag_log format["DEBUG Starting to wait for answer: %1", PVDZE_obj_Trade];

			waitUntil {!isNil "dayzTradeResult"};

			//diag_log format["DEBUG Complete Trade: %1", dayzTradeResult];

			if(dayzTradeResult == "PASS") then {

				if(_buy_o_sell == "buy") then {	

					// First select key color
					_keyColor = ["Green","Red","Blue","Yellow","Black"] call BIS_fnc_selectRandom;

					// then select number from 1 - 2500
					_keyNumber = (floor(random 2500)) + 1;

					// Combine to key (eg.ItemKeyYellow2494) classname
					_keySelected = format[("ItemKey%1%2"),_keyColor,_keyNumber];	

					_isKeyOK = 	isClass(configFile >> "CfgWeapons" >> _keySelected);
					
					_config = _keySelected;
					_isOk = [player,_config] call BIS_fnc_invAdd;
					waitUntil {!isNil "_isOk"};
					if (_isOk and _isKeyOK) then {
					
						//_removed = ([player,_part_in,_qty_in] call BIS_fnc_invRemove);
						
						_qtychange = _qty - _qty_in;
					player setVariable ["cashMoney", _qtychange , true];	
					_newM = player getVariable ["cashMoney",0];
					//_removed = ([player,_part_in,_qty_in] call BIS_fnc_invRemove);
					
					_removed = _qty - _newM; // 
					
						systemChat format ['Payed %1 %3. %2 incoming!',_removed,_part_out,CurrencyName];
						
						if(_removed == _qty_in) then {
							_dir = round(random 360);

							_helipad = nearestObjects [player, ["HeliHCivil","HeliHempty"], 100];
							if(count _helipad > 0) then {
								_location = (getPosATL (_helipad select 0));
							} else {
								_location = [(position player),0,20,1,0,2000,0] call BIS_fnc_findSafePos;
							};
	
							//place vehicle spawn marker (local)
							_veh = createVehicle ["Sign_arrow_down_large_EP1", _location, [], 0, "CAN_COLLIDE"];

							_location = (getPosATL _veh);

							//["PVDZE_veh_Publish",[_veh,[_dir,_location],_part_out,false,_keySelected]] call callRpcProcedure;
							PVDZE_veh_Publish2 = [_veh,[_dir,_location],_part_out,false,_keySelected,_activatingPlayer];
							publicVariableServer  "PVDZE_veh_Publish2";
						
							cutText [format[("Bought %3 for %1 %2, key added to toolbelt."),_qty_in,_textPartIn,_textPartOut], "PLAIN DOWN"];
						} else {
							player removeMagazine _keySelected;
						};
					} else {
						cutText [(localize "str_epoch_player_107"), "PLAIN DOWN"];
					};
				} else {
					
					_obj = _obj select 0;

					//check to make sure vehicle has no more than 75% average tire damage
					_hitpoints = _obj call vehicle_getHitpoints;
					_okToSell = true;

					// count parts
					_tires = 0; 

					// total damage 
					_tireDmg = 0;

					_damage = 0;
					{					
						if(["Wheel",_x,false] call fnc_inString) then {		
							_damage = [_obj,_x] call object_getHit;
							_tireDmg = _tireDmg + _damage;
							_tires = _tires + 1;
						};
					} forEach _hitpoints;

					// find average tire damage
					if(_tireDmg > 0 and _tires > 0) then {
						if((_tireDmg / _tires) > 0.75) then {
							_okToSell = false;
						};
					};

					if(local _obj and !isNull _obj and alive _obj) then {

						if(_okToSell) then {

							//for "_x" from 1 to _qty_out do {
							//	player addMagazine _part_out;
							//};
							
							_myMoney = player getVariable ["cashMoney",0];
								_myMoney = _myMoney + _qty_out;
								player setVariable ["cashMoney", _myMoney , true];

							_objectID 	= _obj getVariable ["ObjectID","0"];
							_objectUID	= _obj getVariable ["ObjectUID","0"];

							PVDZE_obj_Delete = [_objectID,_objectUID,_activatingPlayer];
							publicVariableServer "PVDZE_obj_Delete";

							deleteVehicle _obj; 

							cutText [format[(localize "str_epoch_player_181"),_qty_in,_textPartIn,_qty_out,_textPartOut], "PLAIN DOWN"];
							
						} else {
							cutText [format[(localize "str_epoch_player_182"),_textPartIn] , "PLAIN DOWN"];
						};
					} else {
						cutText [(localize "str_epoch_player_245"), "PLAIN DOWN"];
					};
					
				};
	
				{player removeAction _x} forEach s_player_parts;s_player_parts = [];
				s_player_parts_crtl = -1;

			} else {
				cutText [format[(localize "str_epoch_player_183"),_textPartOut] , "PLAIN DOWN"];
			};
			dayzTradeResult = nil;
		};
	};

} else {
	_needed =  _qty_in - _qty;
	if(_buy_o_sell == "buy") then {
		cutText [format["You need %1 %2",_needed,_textPartIn] , "PLAIN DOWN"]; // edited so it says, You need 5000 coins or you need 1 engine.
	} else {
		cutText [format[(localize "str_epoch_player_185"),_textPartIn] , "PLAIN DOWN"];
	};	
};

DZE_ActionInProgress = false;

 

trade_items.sqf

private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_tradeCounter","_next_highest_bar","_third_highest_bar","_next_highest_conv","_third_highest_conv","_third_parts_out_raw","_third_parts_out","_remainder","_next_parts_out_raw","_next_parts_out","player","_traderID","_total_trades"];

if(DZE_ActionInProgress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

// Test cannot lock while another player is nearby
//_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
//if(_playerNear) exitWith { DZE_ActionInProgress = false; cutText ["Cannot trade while another player is nearby." , "PLAIN DOWN"];  };

_buy_o_sell = (_this select 3) select 4;



if(_buy_o_sell == "buy") then {
	
_finish_trade = {
	{player removeAction _x} forEach s_player_parts;s_player_parts = [];
	s_player_parts_crtl = -1;
	DZE_ActionInProgress = false;
	dayzTradeResult = nil;
};

_name = (_this select 3) select 0;
_textPart = (_this select 3) select 6;
_price = (_this select 3) select 3;
_traderID = (_this select 3) select 7;

_player_headShots = player getVariable ["cashMoney",0];

_emptySlots = [player] call BIS_fnc_invSlotsEmpty;
_free_magazine_slots = _emptySlots select 4;

_tradeCounter = 0;

if(_free_magazine_slots < 1) exitWith { 
	_needed =  _qty_in - _qty;
	cutText ["You have no room in your inventory.", "PLAIN DOWN"];
	DZE_ActionInProgress = false;
};

_total_trades = floor(_player_headShots / _price);
if (_total_trades < 1) exitWith {
	_needed =  _price - _player_headShots;
	cutText [format["You need another %1 %2",_needed,CurrencyName] , "PLAIN DOWN"];
	call _finish_trade;
};
if (_total_trades > _free_magazine_slots) then {
	_total_trades = _free_magazine_slots;
};

_abort = false;

// perform number of total trades
for "_x" from 1 to _total_trades do {
	_tradeCounter = _tradeCounter + 1;

	// cutText ["Starting trade, stand still to complete.", "PLAIN DOWN"];
	if(_total_trades == 1) then { 
		cutText [format["Starting trade, stand still to complete trade.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	} else {
		cutText [format["Starting trade, stand still to complete trade %1 of %2.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	};
	player playActionNow "Medic";

	r_interrupt = false;
	_animState = animationState player;
	r_doLoop = true;
	_started = false;
	_finished = false;
	
	while {r_doLoop} do {
		_animState = animationState player;
		_isMedic = ["medic",_animState] call fnc_inString;
		if (_isMedic) then {
			_started = true;
		};
		if (_started and !_isMedic) then {
			r_doLoop = false;
			_finished = true;
		};
		if (r_interrupt) then {
			r_doLoop = false;
		};
		sleep 0.1;
	};
	r_doLoop = false;

	if (!_finished) exitWith { 
		r_interrupt = false;
		if (vehicle player == player) then {
			[objNull, player, rSwitchMove,""] call RE;
			player playActionNow "stop";
		};
		cutText ["Canceled Trade." , "PLAIN DOWN"];
	};

	if (_finished) then {
		_player_headShots = player getVariable ["cashMoney",0];
		if (_player_headShots >= _price) then {
				player setVariable["cashMoney",(_player_headShots - _price),true];
				player addMagazine _name;
				_abort = false;
				cutText [format["Traded %1 %2 for %3",_price,CurrencyName,_textPart], "PLAIN DOWN"];
				PVDZE_plr_Save = [player,(magazines player),true,true] ;
				publicVariableServer "PVDZE_plr_Save";
		} else {
			_needed =  _price - _player_headShots;
			cutText [format["You need another %1 %2",_needed,CurrencyName] , "PLAIN DOWN"];
			_abort = true;
		};
	};
	sleep 1;

	if(_abort) exitWith {};
};
DZE_ActionInProgress = false;

} else {
	
	private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_tradeCounter","_next_highest_bar","_third_highest_bar","_next_highest_conv","_third_highest_conv","_third_parts_out_raw","_third_parts_out","_remainder","_next_parts_out_raw","_next_parts_out","player","_traderID","_total_trades"];

_finish_trade = {
	{player removeAction _x} forEach s_player_parts;s_player_parts = [];
	s_player_parts_crtl = -1;
	DZE_ActionInProgress = false;
	dayzTradeResult = nil;
};


_name = (_this select 3) select 1;
_textPart = (_this select 3) select 5;
_price = (_this select 3) select 2;
_traderID = (_this select 3) select 7;


_player_headShots = player getVariable ["cashMoney",0];

_qty = {_x == _name} count magazines player;

_removed = 0;
_tradeCounter = 0;



_total_trades = _qty;
if (_total_trades < 1) exitWith {
	cutText [format["You do not have a %1", _textPart], "PLAIN DOWN"];
	call _finish_trade;
};



_abort = false;

// perform number of total trades
for "_x" from 1 to _total_trades do {
	_tradeCounter = _tradeCounter + 1;


	// cutText ["Starting trade, stand still to complete.", "PLAIN DOWN"];
	if(_total_trades == 1) then { 
		cutText [format["Starting trade, stand still to complete trade.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	} else {
		cutText [format["Starting trade, stand still to complete trade %1 of %2.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	};
	player playActionNow "Medic";

	r_interrupt = false;
	_animState = animationState player;
	r_doLoop = true;
	_started = false;
	_finished = false;
	
	while {r_doLoop} do {
		_animState = animationState player;
		_isMedic = ["medic",_animState] call fnc_inString;
		if (_isMedic) then {
			_started = true;
		};
		if (_started and !_isMedic) then {
			r_doLoop = false;
			_finished = true;
		};
		if (r_interrupt) then {
			r_doLoop = false;
		};
		sleep 0.1;
	};
	r_doLoop = false;

	if (!_finished) exitWith { 
		r_interrupt = false;
		if (vehicle player == player) then {
			[objNull, player, rSwitchMove,""] call RE;
			player playActionNow "stop";
		};
		cutText ["Cancelled Trade." , "PLAIN DOWN"];
	};

	if (_finished) then {
	
		_removed = ([player,_name,1] call BIS_fnc_invRemove);
		if (_removed > 0) then {
			_player_headShots = player getVariable ["cashMoney",0];	
				player setVariable["cashMoney",(_player_headShots + _price),true];
				cutText [format[("Traded %1 for %2 %3"),_textPart,_price,CurrencyName], "PLAIN DOWN"];
				PVDZE_plr_Save = [player,(magazines player),true,true] ;
				publicVariableServer "PVDZE_plr_Save";
		} else {
			cutText [format["Something went wrong. Could not remove %1 from inventory", _name], "PLAIN DOWN"];
			_abort = true;
		};
	};
	sleep 1;

	if(_abort) exitWith {};
};
DZE_ActionInProgress = false;
	
};

DZE_ActionInProgress = false;
private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_tradeCounter","_next_highest_bar","_third_highest_bar","_next_highest_conv","_third_highest_conv","_third_parts_out_raw","_third_parts_out","_remainder","_next_parts_out_raw","_next_parts_out","player","_traderID","_total_trades"];

if(DZE_ActionInProgress) exitWith { cutText ["Trade already in progress." , "PLAIN DOWN"]; };
DZE_ActionInProgress = true;

// Test cannot lock while another player is nearby
//_playerNear = {isPlayer _x} count (player nearEntities ["CAManBase", 12]) > 1;
//if(_playerNear) exitWith { DZE_ActionInProgress = false; cutText ["Cannot trade while another player is nearby." , "PLAIN DOWN"];  };

_buy_o_sell = (_this select 3) select 4;



if(_buy_o_sell == "buy") then {
	
_finish_trade = {
	{player removeAction _x} forEach s_player_parts;s_player_parts = [];
	s_player_parts_crtl = -1;
	DZE_ActionInProgress = false;
	dayzTradeResult = nil;
};

_name = (_this select 3) select 0;
_textPart = (_this select 3) select 6;
_price = (_this select 3) select 3;
_traderID = (_this select 3) select 7;

_player_headShots = player getVariable ["cashMoney",0];

_emptySlots = [player] call BIS_fnc_invSlotsEmpty;
_free_magazine_slots = _emptySlots select 4;

_tradeCounter = 0;

if(_free_magazine_slots < 1) exitWith { 
	_needed =  _qty_in - _qty;
	cutText ["You have no room in your inventory.", "PLAIN DOWN"];
	DZE_ActionInProgress = false;
};

_total_trades = floor(_player_headShots / _price);
if (_total_trades < 1) exitWith {
	_needed =  _price - _player_headShots;
	cutText [format["You need another %1 %2",_needed,CurrencyName] , "PLAIN DOWN"];
	call _finish_trade;
};
if (_total_trades > _free_magazine_slots) then {
	_total_trades = _free_magazine_slots;
};

_abort = false;

// perform number of total trades
for "_x" from 1 to _total_trades do {
	_tradeCounter = _tradeCounter + 1;

	// cutText ["Starting trade, stand still to complete.", "PLAIN DOWN"];
	if(_total_trades == 1) then { 
		cutText [format["Starting trade, stand still to complete trade.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	} else {
		cutText [format["Starting trade, stand still to complete trade %1 of %2.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	};
	player playActionNow "Medic";

	r_interrupt = false;
	_animState = animationState player;
	r_doLoop = true;
	_started = false;
	_finished = false;
	
	while {r_doLoop} do {
		_animState = animationState player;
		_isMedic = ["medic",_animState] call fnc_inString;
		if (_isMedic) then {
			_started = true;
		};
		if (_started and !_isMedic) then {
			r_doLoop = false;
			_finished = true;
		};
		if (r_interrupt) then {
			r_doLoop = false;
		};
		sleep 0.1;
	};
	r_doLoop = false;

	if (!_finished) exitWith { 
		r_interrupt = false;
		if (vehicle player == player) then {
			[objNull, player, rSwitchMove,""] call RE;
			player playActionNow "stop";
		};
		cutText ["Canceled Trade." , "PLAIN DOWN"];
	};

	if (_finished) then {
		_player_headShots = player getVariable ["cashMoney",0];
		if (_player_headShots >= _price) then {
				player setVariable["cashMoney",(_player_headShots - _price),true];
				player addMagazine _name;
				_abort = false;
				cutText [format["Traded %1 %2 for %3",_price,CurrencyName,_textPart], "PLAIN DOWN"];
				PVDZE_plr_Save = [player,(magazines player),true,true] ;
				publicVariableServer "PVDZE_plr_Save";
		} else {
			_needed =  _price - _player_headShots;
			cutText [format["You need another %1 %2",_needed,CurrencyName] , "PLAIN DOWN"];
			_abort = true;
		};
	};
	sleep 1;

	if(_abort) exitWith {};
};
DZE_ActionInProgress = false;

} else {
	
	private ["_part_out","_part_in","_qty_out","_qty_in","_qty","_buy_o_sell","_textPartIn","_textPartOut","_needed","_started","_finished","_animState","_isMedic","_total_parts_out","_abort","_removed","_tradeCounter","_next_highest_bar","_third_highest_bar","_next_highest_conv","_third_highest_conv","_third_parts_out_raw","_third_parts_out","_remainder","_next_parts_out_raw","_next_parts_out","player","_traderID","_total_trades"];

_finish_trade = {
	{player removeAction _x} forEach s_player_parts;s_player_parts = [];
	s_player_parts_crtl = -1;
	DZE_ActionInProgress = false;
	dayzTradeResult = nil;
};


_name = (_this select 3) select 1;
_textPart = (_this select 3) select 5;
_price = (_this select 3) select 2;
_traderID = (_this select 3) select 7;


_player_headShots = player getVariable ["cashMoney",0];

_qty = {_x == _name} count magazines player;

_removed = 0;
_tradeCounter = 0;



_total_trades = _qty;
if (_total_trades < 1) exitWith {
	cutText [format["You do not have a %1", _textPart], "PLAIN DOWN"];
	call _finish_trade;
};



_abort = false;

// perform number of total trades
for "_x" from 1 to _total_trades do {
	_tradeCounter = _tradeCounter + 1;


	// cutText ["Starting trade, stand still to complete.", "PLAIN DOWN"];
	if(_total_trades == 1) then { 
		cutText [format["Starting trade, stand still to complete trade.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	} else {
		cutText [format["Starting trade, stand still to complete trade %1 of %2.",_tradeCounter,_total_trades] , "PLAIN DOWN"];
	};
	player playActionNow "Medic";

	r_interrupt = false;
	_animState = animationState player;
	r_doLoop = true;
	_started = false;
	_finished = false;
	
	while {r_doLoop} do {
		_animState = animationState player;
		_isMedic = ["medic",_animState] call fnc_inString;
		if (_isMedic) then {
			_started = true;
		};
		if (_started and !_isMedic) then {
			r_doLoop = false;
			_finished = true;
		};
		if (r_interrupt) then {
			r_doLoop = false;
		};
		sleep 0.1;
	};
	r_doLoop = false;

	if (!_finished) exitWith { 
		r_interrupt = false;
		if (vehicle player == player) then {
			[objNull, player, rSwitchMove,""] call RE;
			player playActionNow "stop";
		};
		cutText ["Cancelled Trade." , "PLAIN DOWN"];
	};

	if (_finished) then {
	
		_removed = ([player,_name,1] call BIS_fnc_invRemove);
		if (_removed > 0) then {
			_player_headShots = player getVariable ["cashMoney",0];	
				player setVariable["cashMoney",(_player_headShots + _price),true];
				cutText [format[("Traded %1 for %2 %3"),_textPart,_price,CurrencyName], "PLAIN DOWN"];
				PVDZE_plr_Save = [player,(magazines player),true,true] ;
				publicVariableServer "PVDZE_plr_Save";
		} else {
			cutText [format["Something went wrong. Could not remove %1 from inventory", _name], "PLAIN DOWN"];
			_abort = true;
		};
	};
	sleep 1;

	if(_abort) exitWith {};
};
DZE_ActionInProgress = false;
	
};

DZE_ActionInProgress = false;

Link to comment
Share on other sites

Well in trade_any_vehicles I can already see you haven't actually applied my fix that I posted above.

 

In your trade_any_vehicles.sqf look for:

PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_obj,inTraderCity];
publicVariableServer  "PVDZE_obj_Trade";

Replace it with:

			if (_bos == 1) then {
				// Selling
				PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_in,inTraderCity,CurrencyName,_qty_out];
			} else {
				// Buying
				PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_out,inTraderCity,CurrencyName,_qty_in];
			};
			publicVariableServer  "PVDZE_obj_Trade";

Trade_items.sqf doesn't have logging at all so it shouldn't cause any issues atm.

 

As for the unknown trader city I'm not sure. THAT might be the issue of custom trader city, for me that code works fine.

Link to comment
Share on other sites

Well in trade_any_vehicles I can already see you haven't actually applied my fix that I posted above.

 

In your trade_any_vehicles.sqf look for:

PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_obj,inTraderCity];
publicVariableServer  "PVDZE_obj_Trade";

Replace it with:

			if (_bos == 1) then {
				// Selling
				PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_in,inTraderCity,CurrencyName,_qty_out];
			} else {
				// Buying
				PVDZE_obj_Trade = [_activatingPlayer,_traderID,_bos,_part_out,inTraderCity,CurrencyName,_qty_in];
			};
			publicVariableServer  "PVDZE_obj_Trade";

Trade_items.sqf doesn't have logging at all so it shouldn't cause any issues atm.

 

As for the unknown trader city I'm not sure. THAT might be the issue of custom trader city, for me that code works fine.

 

Yes as per your post #62 above, I applied it to trade_weapons.sqf only. I'll do the vehicle one now thanks for pointing out.

I don't know how to fix the unknown trade city issue though. I hope someone else will explain what to do.

Link to comment
Share on other sites

With Souls hive I get MSVCP120.dll is missing when I join then the server crashes.

 

Whats this .dll and how am i missing it?/What do i need to install to fix it?

check out this one mate:

 

 

edit - use the 32-bit version (even if your server is 64-bit).

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