Jump to content

[RELEASE] TradeFromVehicle - Version 2.0 is here!


Csus

Recommended Posts

@AceOfSpades

 

The trader selects the vehicle the player was in the driver seat last. If, during the 5 seconds countdown and the entire trade sequence, someone else gets in the vehicle the trade is cancelled. Although, people cannot enter the vehicle during trading.

 

Basically: you can only sell items from the vehicle you was previously in as the driver and only if the vehicle is empty of any other players.

Thank you! Sounds well designed.

Link to comment
Share on other sites

THX for ur fast update! but there i have one issue..

 

stary, klen, bash, and hero trader works fine. the bandit and my special trader wont work. i dont know why!

 

here is the top of the init.sqf

 

tfv_TRADERS_ITEMS = [
        ["TK_GUE_Warlord_EP1",["m8_SAW","RPK_74","AK_47_M","MP5SD","MP5A5","Sa61_EP1","UZI_SD_EP1","UZI_EP1","bizon_silenced","bizon","M14_EP1","VSS_vintorez","KSVK_DZE","M24_des_EP1","M24","M4SPR","huntingrifle","M40A3","SVD_des_EP1","SVD_CAMO","SVD","LeeEnfield","Remington870_lamp","M1014","Crossbow_DZ","MR43","Winchester1866","revolver_EP1","Makarov","revolver_gold_EP1","MakarovSD","M9","Colt1911","glock17_EP1","M9SD","M249_DZ","BAF_L7A2_GPMG","Pecheneg_DZ","MG36_camo","MG36","M60A4_EP1_DZE","Mk_48_DES_EP1","Mk_48_DZ","m240_scoped_EP1_DZE","M240_DZ","M249_EP1_DZ","M249_EP1","M249_m145_EP1_DZE","BAF_L85A2_RIS_Holo","BAF_L85A2_RIS_SUSAT","m8_compact_pmc","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","FN_FAL","AK_74","AKS_74_U","AKS_74_kobra","Sa58V_RCO_EP1","Sa58V_EP1","Sa58V_CCO_EP1","Sa58P_EP1","M4A3_CCO_EP1","M4A1_RCO_GL","M4A1_HWS_GL_SD_Camo","M4A1_HWS_GL_camo","M4A1_HWS_GL","M4A1_AIM_SD_camo","M4A1_Aim","M4A1","M16A4_GL","M16a4","M16A4_ACG","M16A2GL","M16A2","G36K_camo","G36_C_SD_camo","G36_C_SD_eotech","G36C_camo","G36C","G36A_camo"],["weapons"]],
	["BAF_Soldier_AAR_DDPM",["m8_SAW","RPK_74","AK_47_M","MP5SD","MP5A5","Sa61_EP1","UZI_SD_EP1","UZI_EP1","bizon_silenced","bizon","M14_EP1","VSS_vintorez","KSVK_DZE","M24_des_EP1","M24","M4SPR","huntingrifle","M40A3","SVD_des_EP1","SVD_CAMO","SVD","LeeEnfield","Remington870_lamp","M1014","Crossbow_DZ","MR43","Winchester1866","revolver_EP1","Makarov","revolver_gold_EP1","MakarovSD","M9","Colt1911","glock17_EP1","M9SD","M249_DZ","BAF_L7A2_GPMG","Pecheneg_DZ","MG36_camo","MG36","M60A4_EP1_DZE","Mk_48_DES_EP1","Mk_48_DZ","m240_scoped_EP1_DZE","M240_DZ","M249_EP1_DZ","M249_EP1","M249_m145_EP1_DZE","BAF_L85A2_RIS_Holo","BAF_L85A2_RIS_SUSAT","m8_compact_pmc","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","FN_FAL","AK_74","AKS_74_U","AKS_74_kobra","Sa58V_RCO_EP1","Sa58V_EP1","Sa58V_CCO_EP1","Sa58P_EP1","M4A3_CCO_EP1","M4A1_RCO_GL","M4A1_HWS_GL_SD_Camo","M4A1_HWS_GL_camo","M4A1_HWS_GL","M4A1_AIM_SD_camo","M4A1_Aim","M4A1","M16A4_GL","M16a4","M16A4_ACG","M16A2GL","M16A2","G36K_camo","G36_C_SD_camo","G36_C_SD_eotech","G36C_camo","G36C","G36A_camo"],["weapons"]],
	["Soldier_MG_PKM_PMC",["m8_SAW","RPK_74","AK_47_M","MP5SD","MP5A5","Sa61_EP1","UZI_SD_EP1","UZI_EP1","bizon_silenced","bizon","M14_EP1","VSS_vintorez","KSVK_DZE","M24_des_EP1","M24","M4SPR","huntingrifle","M40A3","SVD_des_EP1","SVD_CAMO","SVD","LeeEnfield","Remington870_lamp","M1014","Crossbow_DZ","MR43","Winchester1866","revolver_EP1","Makarov","revolver_gold_EP1","MakarovSD","M9","Colt1911","glock17_EP1","M9SD","M249_DZ","BAF_L7A2_GPMG","Pecheneg_DZ","MG36_camo","MG36","M60A4_EP1_DZE","Mk_48_DES_EP1","Mk_48_DZ","m240_scoped_EP1_DZE","M240_DZ","M249_EP1_DZ","M249_EP1","M249_m145_EP1_DZE","BAF_L85A2_RIS_Holo","BAF_L85A2_RIS_SUSAT","m8_compact_pmc","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","FN_FAL","AK_74","AKS_74_U","AKS_74_kobra","Sa58V_RCO_EP1","Sa58V_EP1","Sa58V_CCO_EP1","Sa58P_EP1","M4A3_CCO_EP1","M4A1_RCO_GL","M4A1_HWS_GL_SD_Camo","M4A1_HWS_GL_camo","M4A1_HWS_GL","M4A1_AIM_SD_camo","M4A1_Aim","M4A1","M16A4_GL","M16a4","M16A4_ACG","M16A2GL","M16A2","G36K_camo","G36_C_SD_camo","G36_C_SD_eotech","G36C_camo","G36C","G36A_camo"],["weapons"]],
        ["US_Delta_Force_Undercover_Takistani06_EP1",["MAAWS","SCAR_L_STD_EGLM_RCO","SCAR_L_CQC_Holo","SCAR_L_CQC_EGLM_Holo","SCAR_H_STD_EGLM_Spect","SCAR_H_CQC_CCO_SD","SCAR_H_CQC_CCO","SCAR_H_LNG_Sniper","SCAR_H_LNG_Sniper_SD","M110_NVG_EP1"]],
        ["Tanny_PMC",["FN_FAL_ANPVS4","AK_107_PSO","DMR","BAF_LRR_scoped"],["weapons"]],
        ["GUE_Soldier_1",["FN_FAL_ANPVS4","AK_107_PSO","DMR","BAF_LRR_scoped"],["weapons"]],     
        ["Dr_Annie_Baker_EP1",["ItemSodaPepsi","ItemSodaCoke","FoodCanPasta","M16A2"],["magazines","weapons"]]
]; if (tfv_DEBUGGING) then { diag_log "tfv - Traders and their weapons loaded in!"; };

 

here is my sensor classes of mission.sqm

 

	class Sensors
	{
		items=10;
		class Item0
		{
			position[]={6325.6772,304.99033,7807.7412};
			a=100;
			b=100;
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonestary";
			expCond="(player distance zonestary) < 100;";
			expActiv="TitleText[""Now entering trader city Stary"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Stary"";";
			expDesactiv="TitleText[""Now leaving trader city Stary"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
       
		class Item1
		{
			position[]={4063.4226,365.00577,11664.19};
			a=100;
			b=100;
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonebash";
			expCond="(player distance zonebash) < 100;";
			expActiv="TitleText[""Now entering trader city Bash"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Bash"";";
			expDesactiv="TitleText[""Now leaving trader city Bash"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item2
		{
			position[]={11447.472,317.26886,11364.504};
			a=100;
			b=100;
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zoneklen";
			expCond="(player distance zoneklen) < 100;";
			expActiv="TitleText[""Now entering trader city Klen"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Klen"";";
			expDesactiv="TitleText[""Now leaving trader city Klen"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item3
		{
			position[]={5075.5767,338.98999,9733.6934};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zoneair";
			expCond="(player distance zoneair) < 75;";
			expActiv="TitleText[""Now entering trader airfield"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Air"";";
			expDesactiv="TitleText[""Now leaving trader airfield"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item4
		{
			position[]={12948.543,209.96339,12761.643};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonehero";
			expCond="(player distance zonehero) < 50;";
			expActiv="TitleText[""Now entering trader hero"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Hero"";";
			expDesactiv="TitleText[""Now leaving trader hero"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item5
		{
			position[]={3438.6069,306.28281,4554.1855};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zoneholz";
			expCond="(player distance zoneholz) < 50;";
			expActiv="TitleText[""Now entering trader wood"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Holz"";";
			expDesactiv="TitleText[""Now leaving trader wood"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item6
		{
			position[]={1100.26,10.213919,2854.37};
			a=100;
			b=100;
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonewhole";
			expCond="(player distance zonewhole) < 50;";
			expActiv="TitleText[""Now entering trader whole"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Whole"";";
			expDesactiv="TitleText[""Now leaving trader whole"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item7
		{
			position[]={13253.62,7.9455967,6090.1885};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonewholew";
			expCond="(player distance zonewholew) < 50;";
			expActiv="TitleText[""Now entering trader whole"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Wholew"";";
			expDesactiv="TitleText[""Now leaving trader whole"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item8
		{
			position[]={1608.1403,283.95963,7782.3174};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zonebandit";
			expCond="(player distance zonebandit) < 50;";
			expActiv="TitleText[""Now entering trader bandit"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Bandit"";";
			expDesactiv="TitleText[""Now leaving trader bandit"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
		class Item9
		{
			position[]={6758.9004,343.01801,5586.7593};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="zoneextra";
			expCond="(player distance zoneextra) < 50;";
			expActiv="TitleText[""Now entering special trader"",""PLAIN DOWN""]; canbuild = false; inTraderCity = ""Extra"";";
			expDesactiv="TitleText[""Now leaving special trader"",""PLAIN DOWN""]; canbuild = true; inTraderCity = ""Any"";";
			class Effects
			{
			};
		};
       };

 

class Item9 is the trader which doesent work

and class Itrem9 also doesent work

 

Why?

Link to comment
Share on other sites

not exactly a practical thing to do though. considering it only starts monitoring which vehicle you're in once you have entered the trade zone.

i could implement that very easily though if you guys would like it

 

OP updated with new files. just copy over all your exiting weapon/trader/price lists.

implemented a radius of 30m. easily changed through the 'monitor.sqf' file.

to change the radius find this on line 46

if ((player distance _trader_obj < 5) && (tfv_ACTION == 0) && (_vehicle distance _trader_obj < 30)) then {

and change the 30 to whatever you like.

 

EDIT: ps. I haven't tested this, i'm too tired. but i'm certain it works perfectly fine, i only added about 20 letters XD

ps ps. you don't even have to download the new files. just make the change youself in the monitor.sqf :)

Link to comment
Share on other sites

 

Don't want to have to hand update the gun list for this mod?

 

I came up with the SQL needed to generate the list.

 

First you will need a split function:

CREATE FUNCTION SPLIT_STR(
x VARCHAR(255),
delim VARCHAR(12),
pos INT
)
RETURNS VARCHAR(255)
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, '');

Then just run the query below and copy the results into the init array.

SELECT 
	case SPLIT_STR(sell,',',2)
		when '\"ItemGoldBar10oz\"' then  
			(concat(SPLIT_STR(item,',',1) ,',',replace(SPLIT_STR(sell,',',1),'[','')*1000,'],') )
		when '\"ItemGoldBar\"' then 
			(concat(SPLIT_STR(item,',',1) ,',',replace(SPLIT_STR(sell,',',1),'[','')*100,'],') )
		when '\"ItemSilverBar10oz\"' then  
			(concat(SPLIT_STR(item,',',1) ,',',replace(SPLIT_STR(sell,',',1),'[','')*10,'],') )
		when '\"ItemSilverBar\"' then 
			(concat(SPLIT_STR(item,',',1) ,',',replace(SPLIT_STR(sell,',',1),'[',''),'],') )
		
	end as list
FROM traders_data where afile = 'trade_weapons'
order by list

Any tips on how to do this via navicat or phpmyadmin?

currently hand editing the list

 

Is it possible to use the traders categories like "Medical supplies" or does each item need to be listed individually?

Link to comment
Share on other sites

hi, really nice script.

its working great apart from one thing: for me the counter doenst wait to go down one step until the animation is finished. i.e. 12 sell cycles are done within 3 animation cycles.

any idea where i screwed up?

Link to comment
Share on other sites

that sounds like a problem i had in a very early testing build i had of this, if you can send me your 'init.sqf' (from this) along with your 'trade.sqf' i'll try find the problem for you

Link to comment
Share on other sites

my "is dedicated" part of init:

if (!isDedicated) then {
    [] execVM "TradeFromVehicle\init.sqf";
//Conduct map operations
    0 fadeSound 0;
    waitUntil {!isNil "dayz_loadScreenMsg"};
    dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
    [] execVM "scripts\kh_actions.sqf";
    
    //Run the player monitor
    _id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
    _playerMonitor =     [] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
    [] execVM "spawn.sqf";
    [] execVM 'AGN\safezone.sqf';
        
    //Lights
    //[false,12] execVM "\z\addons\dayz_code\compile\local_lights_init.sqf";
    
};

ill try to move the exec further down with the next server restart. maybe after the safezone exec? i just followed the install instructions and put the exec below the "is dedicated".

 

tfv init:

waitUntil {!isNil "dayz_animalCheck"};
sleep 1;

/*    *******************************************************************************************************************************************   */
/*    Turn debugging functionality on or off.                                                                                                       */
/*    *******************************************************************************************************************************************   */
tfv_DEBUGGING = true;

/*    *******************************************************************************************************************************************   */
/*    How many weapons will be sold per cycle.                                                                                                      */
/*    *******************************************************************************************************************************************   */
tfv_SALES_PER_ANIM = 1;

/*    *******************************************************************************************************************************************   */
/*    How many magazines will be sold per cycle.                                                                                                      */
/*    *******************************************************************************************************************************************   */
tfv_SALES_PER_ANIM_MAGS = 2;

/*    *******************************************************************************************************************************************   */
/*    A list of each trader, along with the weapons they accept.                                                                                    */
/*    *******************************************************************************************************************************************   */

tfv_TRADERS_ITEMS = [
        ["RU_Functionary1",["30Rnd_556x45_StanagSD","5Rnd_86x70_L115A1","100Rnd_762x51_M240","20Rnd_762x51_FNFAL","20Rnd_762x51_SB_SCAR","20rnd_762x51_B_SCAR","G36_C_SD_camo","M4A1_AIM_SD_camo","FN_FAL_ANPVS4","SCAR_H_LNG_Sniper_SD","BAF_LRR_scoped","FN_FAL","Mk_48_DZ","M240_DZ","M110_NVG_EP1"],["magazines","weapons"]],
		["GUE_Soldier_MG",["30Rnd_556x45_StanagSD","5Rnd_86x70_L115A1","100Rnd_762x51_M240","20Rnd_762x51_FNFAL","20Rnd_762x51_SB_SCAR","20rnd_762x51_B_SCAR","G36_C_SD_camo","M4A1_AIM_SD_camo","FN_FAL_ANPVS4","SCAR_H_LNG_Sniper_SD","BAF_LRR_scoped","FN_FAL","Mk_48_DZ","M240_DZ","M110_NVG_EP1"],["magazines","weapons"]],
		["RU_Citizen3",["30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","30Rnd_545x39_AK","30Rnd_762x39_AK47","30Rnd_762x39_SA58","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_762x54_PK","15Rnd_9x19_M9","15Rnd_9x19_M9SD","17Rnd_9x19_glock17","6Rnd_45ACP","7Rnd_45ACP_1911","8Rnd_9x18_Makarov","8Rnd_9x18_MakarovSD","15Rnd_W1866_Slug","2Rnd_shotgun_74Pellets","2Rnd_shotgun_74Slug","8Rnd_B_Beneli_74Slug","8Rnd_B_Beneli_Pellets","Quiver","10x_303","20Rnd_762x51_DMR","10Rnd_762x54_SVD","5Rnd_762x51_M24","5x_22_LR_17_HMR","30rnd_9x19_MP5","30Rnd_9x19_MP5SD","30Rnd_9x19_UZI","64Rnd_9x19_SD_Bizon","30Rnd_9x19_UZI_SD","20Rnd_B_765x17_Ball"],["magazines"]],
		["Rocker4",["G36A_camo","G36C","G36C_camo","G36K_camo","M16A2","M16A2GL","M16A4_ACG","M4A1","M4A1_HWS_GL_camo","M4A3_CCO_EP1","M4A1_Aim","Sa58P_EP1","Sa58V_CCO_EP1","Sa58V_EP1","Sa58V_RCO_EP1","AKS_74_kobra","AKS_74_U","AK_47_M","AK_74","FN_FAL","BAF_L85A2_RIS_SUSAT","BAF_L85A2_RIS_Holo","M16A4","SCAR_L_CQC","SCAR_L_CQC_Holo","SCAR_L_STD_Mk4CQT","SCAR_L_STD_HOLO","M249_EP1_DZ","M240_DZ","Mk_48_DZ","Pecheneg_DZ","M9SD","glock17_EP1","Colt1911","M9","MakarovSD","revolver_gold_EP1","Makarov","revolver_EP1","Winchester1866","MR43","Crossbow_DZ","M1014","Remington870_lamp","LeeEnfield","SVD_CAMO","M40A3","M14_EP1","huntingrifle","M4SPR","SVD","SVD_des_EP1","M24","M24_des_EP1","bizon_silenced","UZI_EP1","Sa61_EP1","MP5A5","UZI_SD_EP1","MP5SD"],["weapons"]],
		["CIV_EuroMan02_EP1",["30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","30Rnd_545x39_AK","30Rnd_762x39_AK47","30Rnd_762x39_SA58","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_762x54_PK","15Rnd_9x19_M9","15Rnd_9x19_M9SD","17Rnd_9x19_glock17","6Rnd_45ACP","7Rnd_45ACP_1911","8Rnd_9x18_Makarov","8Rnd_9x18_MakarovSD","15Rnd_W1866_Slug","2Rnd_shotgun_74Pellets","2Rnd_shotgun_74Slug","8Rnd_B_Beneli_74Slug","8Rnd_B_Beneli_Pellets","Quiver","10x_303","20Rnd_762x51_DMR","10Rnd_762x54_SVD","5Rnd_762x51_M24","5x_22_LR_17_HMR","30rnd_9x19_MP5","30Rnd_9x19_MP5SD","30Rnd_9x19_UZI","64Rnd_9x19_SD_Bizon","30Rnd_9x19_UZI_SD","20Rnd_B_765x17_Ball"],["magazines"]],
		["CIV_EuroMan01_EP1",["G36A_camo","G36C","G36C_camo","G36K_camo","M16A2","M16A2GL","M16A4_ACG","M4A1","M4A1_HWS_GL_camo","M4A3_CCO_EP1","M4A1_Aim","Sa58P_EP1","Sa58V_CCO_EP1","Sa58V_EP1","Sa58V_RCO_EP1","AKS_74_kobra","AKS_74_U","AK_47_M","AK_74","FN_FAL","BAF_L85A2_RIS_SUSAT","BAF_L85A2_RIS_Holo","M16A4","SCAR_L_CQC","SCAR_L_CQC_Holo","SCAR_L_STD_Mk4CQT","SCAR_L_STD_HOLO","M249_EP1_DZ","M240_DZ","Mk_48_DZ","Pecheneg_DZ","M9SD","glock17_EP1","Colt1911","M9","MakarovSD","revolver_gold_EP1","Makarov","revolver_EP1","Winchester1866","MR43","Crossbow_DZ","M1014","Remington870_lamp","LeeEnfield","SVD_CAMO","M40A3","M14_EP1","huntingrifle","M4SPR","SVD","SVD_des_EP1","M24","M24_des_EP1","bizon_silenced","UZI_EP1","Sa61_EP1","MP5A5","UZI_SD_EP1","MP5SD"],["weapons"]],
		["Pilot_EP1",["30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","30Rnd_545x39_AK","30Rnd_762x39_AK47","30Rnd_762x39_SA58","100Rnd_762x51_M240","200Rnd_556x45_M249","100Rnd_762x54_PK","15Rnd_9x19_M9","15Rnd_9x19_M9SD","17Rnd_9x19_glock17","6Rnd_45ACP","7Rnd_45ACP_1911","8Rnd_9x18_Makarov","8Rnd_9x18_MakarovSD","15Rnd_W1866_Slug","2Rnd_shotgun_74Pellets","2Rnd_shotgun_74Slug","8Rnd_B_Beneli_74Slug","8Rnd_B_Beneli_Pellets","Quiver","10x_303","20Rnd_762x51_DMR","10Rnd_762x54_SVD","5Rnd_762x51_M24","5x_22_LR_17_HMR","30rnd_9x19_MP5","30Rnd_9x19_MP5SD","30Rnd_9x19_UZI","64Rnd_9x19_SD_Bizon","30Rnd_9x19_UZI_SD","20Rnd_B_765x17_Ball"],["magazines"]],
		["TK_CIV_Takistani04_EP1",["G36A_camo","G36C","G36C_camo","G36K_camo","M16A2","M16A2GL","M16A4_ACG","M4A1","M4A1_HWS_GL_camo","M4A3_CCO_EP1","M4A1_Aim","Sa58P_EP1","Sa58V_CCO_EP1","Sa58V_EP1","Sa58V_RCO_EP1","AKS_74_kobra","AKS_74_U","AK_47_M","AK_74","FN_FAL","BAF_L85A2_RIS_SUSAT","BAF_L85A2_RIS_Holo","M16A4","SCAR_L_CQC","SCAR_L_CQC_Holo","SCAR_L_STD_Mk4CQT","SCAR_L_STD_HOLO","M249_EP1_DZ","M240_DZ","Mk_48_DZ","Pecheneg_DZ","M9SD","glock17_EP1","Colt1911","M9","MakarovSD","revolver_gold_EP1","Makarov","revolver_EP1","Winchester1866","MR43","Crossbow_DZ","M1014","Remington870_lamp","LeeEnfield","SVD_CAMO","M40A3","M14_EP1","huntingrifle","M4SPR","SVD","SVD_des_EP1","M24","M24_des_EP1","bizon_silenced","UZI_EP1","Sa61_EP1","MP5A5","UZI_SD_EP1","MP5SD"],["weapons"]],
		["GUE_Woodlander2",["20Rnd_9x39_SP5_VSS","8Rnd_B_Beneli_74Slug","20Rnd_762x51_SB_SCAR","8Rnd_B_Beneli_Pellets","8Rnd_B_Saiga12_74Slug","8Rnd_B_Saiga12_Pellets","20Rnd_B_765x17_Ball","10Rnd_762x54_SVD","5Rnd_762x51_M24","30Rnd_556x45_Stanag","20Rnd_762x51_FNFAL","100Rnd_556x45_BetaCMag","75Rnd_545x39_RPK","64Rnd_9x19_Bizon","5Rnd_127x108_KSVK","20rnd_762x51_B_SCAR","Saiga12K","m8_compact","m8_sharpshooter","m8_holo_sd","m8_carbine","M24_des_EP1","VSS_vintorez","SVD_des_EP1","SVD","M8_SAW","MG36","RPK_74","M60A4_EP1_DZE","m240_scoped_EP1_DZE","M249_m145_EP1_DZE","MG36_camo","bizon","M4A1_HWS_GL_SD_Camo","KSVK_DZE","SCAR_H_LNG_Sniper","SCAR_H_CQC_CCO","SCAR_H_CQC_CCO_SD","SCAR_L_CQC_CCO_SD","DMR_DZ"],["magazines","weapons"]]
]; if (tfv_DEBUGGING) then { diag_log "tfv - Traders and their weapons loaded in!"; };

/*    *******************************************************************************************************************************************   */
/*    List of ALL weapons, regardless of trader, along with the prices.                                                                             */
/*    *******************************************************************************************************************************************   */

tfv_TRADERS_PRICES = [
	["30Rnd_556x45_StanagSD",20],
	["5Rnd_86x70_L115A1",200],
	["100Rnd_762x51_M240",100],
	["20Rnd_762x51_FNFAL",20],
	["20Rnd_762x51_SB_SCAR",50],
	["20rnd_762x51_B_SCAR",5],
	["G36_C_SD_camo",500],
	["M4A1_AIM_SD_camo",500],
	["FN_FAL_ANPVS4",1000],
	["SCAR_H_LNG_Sniper_SD",1000],
	["BAF_LRR_scoped",2000],
	["FN_FAL",500],
	["Mk_48_DZ",1000],
	["M240_DZ",500],
	["M110_NVG_EP1",1000],
	["30Rnd_556x45_Stanag",2],
	["30Rnd_545x39_AK",1],
	["30Rnd_762x39_AK47",1],
	["30Rnd_762x39_SA58",1],
	["100Rnd_762x51_M240",100],
	["200Rnd_556x45_M249",200],
	["100Rnd_762x54_PK",100],
	["15Rnd_9x19_M9",5],
	["15Rnd_9x19_M9SD",10],
	["17Rnd_9x19_glock17",5],
	["6Rnd_45ACP",1],
	["7Rnd_45ACP_1911",1],
	["8Rnd_9x18_Makarov",1],
	["8Rnd_9x18_MakarovSD",10],
	["15Rnd_W1866_Slug",1],
	["2Rnd_shotgun_74Pellets",1],
	["2Rnd_shotgun_74Slug",1],
	["8Rnd_B_Beneli_74Slug",1],
	["8Rnd_B_Beneli_Pellets",1],
	["Quiver",1],
	["10x_303",1],
	["20Rnd_762x51_DMR",10],
	["10Rnd_762x54_SVD",10],
	["5Rnd_762x51_M24",5],
	["5x_22_LR_17_HMR",50],
	["30rnd_9x19_MP5",10],
	["30Rnd_9x19_MP5SD",20],
	["30Rnd_9x19_UZI",10],
	["64Rnd_9x19_SD_Bizon",10],
	["30Rnd_9x19_UZI_SD",10],
	["20Rnd_B_765x17_Ball",10],
	["G36A_camo",300],
	["G36C",200],
	["G36C_camo",300],
	["G36K_camo",300],
	["M16A2",100],
	["M16A2GL",200],
	["M16A4_ACG",200],
	["M4A1",200],
	["M4A1_HWS_GL_camo",400],
	["M4A3_CCO_EP1",500],
	["M4A1_Aim",400],
	["Sa58P_EP1",100],
	["Sa58V_CCO_EP1",400],
	["Sa58V_EP1",100],
	["Sa58V_RCO_EP1",400],
	["AKS_74_kobra",200],
	["AKS_74_U",100],
	["AK_47_M",600],
	["AK_74",100],
	["BAF_L85A2_RIS_SUSAT",300],
	["BAF_L85A2_RIS_Holo",600],
	["M16A4",400],
	["SCAR_L_CQC",500],
	["SCAR_L_CQC_Holo",500],
	["SCAR_L_STD_Mk4CQT",500],
	["SCAR_L_STD_HOLO",500],
	["M249_EP1_DZ",600],
	["M240_DZ",500],
	["Mk_48_DZ",1000],
	["Pecheneg_DZ",1000],
	["M9SD",100],
	["glock17_EP1",50],
	["Colt1911",10],
	["M9",20],
	["MakarovSD",100],
	["revolver_gold_EP1",200],
	["Makarov",10],
	["revolver_EP1",10],
	["Winchester1866",10],
	["MR43",8],
	["Crossbow_DZ",5],
	["M1014",200],
	["Remington870_lamp",100],
	["LeeEnfield",10],
	["SVD_CAMO",600],
	["M40A3",600],
	["M14_EP1",1000],
	["huntingrifle",100],
	["M4SPR",600],
	["SVD",600],
	["SVD_des_EP1",600],
	["M24",600],
	["M24_des_EP1",600],
	["bizon_silenced",500],
	["UZI_EP1",200],
	["Sa61_EP1",50],
	["MP5A5",20],
	["UZI_SD_EP1",500],
	["MP5SD",300],
	["20Rnd_9x39_SP5_VSS",100],
	["8Rnd_B_Saiga12_74Slug",3],
	["8Rnd_B_Saiga12_Pellets",3],
	["100Rnd_556x45_BetaCMag",30],
	["75Rnd_545x39_RPK",10],
	["64Rnd_9x19_Bizon",5],
	["5Rnd_127x108_KSVK",10],
	["Saiga12K",300],
	["m8_compact",200],
	["m8_sharpshooter",300],
	["m8_holo_sd",400],
	["m8_carbine",200],
	["VSS_vintorez",400],
	["M8_SAW",600],
	["MG36",600],
	["RPK_74",600],
	["M60A4_EP1_DZE",1000],
	["m240_scoped_EP1_DZE",600],
	["M249_m145_EP1_DZE",600],
	["MG36_camo",600],
	["bizon",500],
	["M4A1_HWS_GL_SD_Camo",1000],
	["KSVK_DZE",1000],
	["SCAR_H_LNG_Sniper",500],
	["SCAR_H_CQC_CCO",500],
	["SCAR_H_CQC_CCO_SD",500],
	["SCAR_L_CQC_CCO_SD",500],
	["DMR_DZ",1000]	
]; if (tfv_DEBUGGING) then { { diag_log format ["tfv - Price loaded - %1",_x]; } forEach tfv_TRADERS_PRICES; };

/*    *******************************************************************************************************************************************   */
/*    Anything below this line was not intended to be modified.                                                                                     */
/*    *******************************************************************************************************************************************   */

tfv_TRADERS = [];
{ tfv_TRADERS set [(count tfv_TRADERS),(_x select 0)]; } forEach tfv_TRADERS_ITEMS;
tfv_TRADERS_TYPES = [];
{ tfv_TRADERS_TYPES set [(count tfv_TRADERS_TYPES),(_x select 2)]; } forEach tfv_TRADERS_ITEMS;
if (tfv_DEBUGGING) then { { diag_log format ["tfv - Trader loaded - %1",_x]; } forEach tfv_TRADERS; };
tfv_SALE_SUCCESS_STRING = "Sold %1 weapons from your vehicle";
tfv_SALE_SUCCESS_STRING_MAGS = "Sold %1 items from your vehicle";
tfv_PREP_FOR_TRADE = "Starting trade in %1 seconds, move to cancel";
tfv_CANCELLED_TRADE = "Trade cancelled";
tfv_STARTING_TRADE = "Starting trade";
tfv_TRADE_STEPS = "Trading, stage %1 of %2";
tfv_TRADE_CANCELLED_END = "Trade cancelled\nMake sure your vehicle is empty and isn't moving";
tfv_SIDENOTE = "You were paid an %1";
tfv_VEHICLE_CONFIRM = "Trading from %1";
tfv_NO_WEAPONS = "There is no weapons inside your vehicle (%1)";
tfv_NO_MAGAZINES = "There is no items inside your vehicle (%1)";
tfv_ACTION_INDEX = -1;
tfv_ACTION = 0;
tfv_ACTION_INDEX_MAGS = -1;
tfv_ACTION_MAGS = 0;
tfv_IS_TRADING = false;
tfv_EXCHANGE = [
	["ItemBriefcase100oz",10000],
	["ItemBriefcase90oz",9000],
	["ItemBriefcase80oz",8000],
	["ItemBriefcase70oz",7000],
	["ItemBriefcase60oz",6000],
	["ItemBriefcase50oz",5000],
	["ItemBriefcase40oz",4000],
	["ItemBriefcase30oz",3000],
	["ItemBriefcase20oz",2000],
	["ItemGoldBar10oz",1000],
	["ItemGoldBar9oz",900],
	["ItemGoldBar8oz",800],
	["ItemGoldBar7oz",700],
	["ItemGoldBar6oz",600],
	["ItemGoldBar5oz",500],
	["ItemGoldBar4oz",400],
	["ItemGoldBar3oz",300],
	["ItemGoldBar2oz",200],
	["ItemGoldBar",100],
	["ItemBriefcaseS90oz",90],
	["ItemBriefcaseS80oz",80],
	["ItemBriefcaseS70oz",70],
	["ItemBriefcaseS60oz",60],
	["ItemBriefcaseS50oz",50],
	["ItemBriefcaseS40oz",40],
	["ItemBriefcaseS30oz",30],
	["ItemBriefcaseS20oz",20],
	["ItemSilverBar10oz",10],
	["ItemSilverBar9oz",9],
	["ItemSilverBar8oz",8],
	["ItemSilverBar7oz",7],
	["ItemSilverBar6oz",6],
	["ItemSilverBar5oz",5],
	["ItemSilverBar4oz",4],
	["ItemSilverBar3oz",3],
	["ItemSilverBar2oz",2],
    ["ItemSilverBar",1]
]; if (tfv_DEBUGGING) then { { diag_log format ["tfv - Exchange loaded - %1",_x]; } forEach tfv_EXCHANGE; };

/*    *******************************************************************************************************************************************   */
/*    Functions.                                                                                                                                    */
/*    *******************************************************************************************************************************************   */

tfv_fnc_aConcat =        compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_aConcat.sqf";
tfv_fnc_checkTrade =     compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_checkTrade.sqf";
tfv_fnc_Convert =        compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_Convert.sqf";
tfv_fnc_findPrices =     compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_findPrices.sqf";
tfv_fnc_findTrWeapons =  compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_findTrWeapons.sqf";
tfv_fnc_getSteps =       compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_getSteps.sqf";
tfv_fnc_payTrade =       compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_payTrade.sqf";
tfv_fnc_wCount =         compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_wCount.sqf";
tfv_fnc_mCount =         compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_mCount.sqf";
tfv_fnc_checkTradeMags = compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_checkTradeMags.sqf";
tfv_fnc_aConcatMags =    compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_aConcatMags.sqf";
tfv_fnc_getStepsMags =   compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_getStepsMags.sqf";
tfv_fnc_payTradem =      compile preprocessFileLineNumbers "TradeFromVehicle\functions\fnc_payTradem.sqf";

/*    *******************************************************************************************************************************************   */
/*    Init file finished. Start monitor script.    */    [] ExecVM "TradeFromVehicle\monitor.sqf";
/*    *******************************************************************************************************************************************   */

and the trade.sqf

player removeAction tfv_ACTION_INDEX;
player removeAction tfv_ACTION_INDEX_MAGS;
tfv_IS_TRADING = true;
if (tfv_DEBUGGING) then { diag_log "tfv - trade.sqf - starting"; };
private ["_goStart","_tPassed","_sTime","_display","_tradeCancel","_pStartPos","_sWepCounts",
         "_trader","_traderWeapons","_weaponsActual","_price_rejetcs","_sale","_rejects","_bars",
		 "_steps_complete","_steps","_cur_step","_badTrade","_firstStep","_preTestCargoCounts"];

_goStart = false;
_tPassed = 0;
_sTime = time;
_vehicle = _this select 3 select 1;
_vehicle setVehicleLock "LOCKED";
_vStartPos = getPos _vehicle;
_tradeCancel = false;
_pStartPos = getPos player;
_sWepCounts = _vehicle call tfv_fnc_wCount;
_preTestCargoCounts = getWeaponCargo _vehicle;
if (count(_preTestCargoCounts select 0) == 0) exitWith { tfv_IS_TRADING = false; systemChat format [tfv_NO_WEAPONS,typeOf _vehicle]; };
systemChat format [tfv_VEHICLE_CONFIRM,typeOf _vehicle];
while {!_goStart} do {
    if ((time -_sTime) >= _tPassed) then {    //Show a countdown timer, 5 seconds. Give the player chance to cancel, and give us time to check some things.
	    _display = format [tfv_PREP_FOR_TRADE,5 - _tPassed];
		titleText [_display,"PLAIN DOWN"];
		_tPassed = _tPassed + 1;
	};
	if (_tPassed >= 6) then {    //If 5 seconds has passed, tell the player we are about to begin trading.
	    titleText [tfv_STARTING_TRADE,"PLAIN DOWN"];
		_goStart = true;
	};
	if (([_vStartPos,_sWepCounts,_vehicle,_pStartPos] call tfv_fnc_checkTrade)) exitWith {    //Check to be sure that the player is not swindling us!
	    _tradeCancel = true;
		titleText [tfv_CANCELLED_TRADE,"PLAIN DOWN"];
	};
};
if (_tradeCancel) exitWith { tfv_IS_TRADING = false; _vehicle setVehicleLock "UNLOCKED"; };

sleep 0.5;
_trader = _this select 3 select 0;
_traderWeapons = _trader call tfv_fnc_findTrWeapons;
_weaponsActual = _vehicle call tfv_fnc_aConcat;
_price_rejects = [_weaponsActual,_traderWeapons] call tfv_fnc_findPrices;
_sale = _price_rejects select 0;
_rejects = _price_rejects select 1;
_steps = [_weaponsActual,_rejects] call tfv_fnc_getSteps;
_bars = _sale call tfv_fnc_convert;
_steps_complete = false;
_cur_step = 0;
_badTrade = false;
_firstStep = true;

while {!_steps_complete} do {
    _display = format [tfv_TRADE_STEPS,_cur_step + 1,_steps];
	titleText [_display,"PLAIN DOWN"];
	player playActionNow "medic";
	if (_firstStep) then { sleep 3; _firstStep = false; };
	sleep 1;
	waitUntil {(((animationState player) != "ainvpknlmstpslaywrfldnon_medic") && ((animationState player) != "ainvpknlmstpsnonwnondnon_medic_2") && ((animationState player) != "ainvpknlmstpslaywrfldnon_amovpknlmstpsnonwnondnon"))};
	_cur_step = _cur_step + 1;
	if (([_vStartPos,_sWepCounts,_vehicle,_pStartPos] call tfv_fnc_checkTrade)) exitWith {
	    _badTrade = true;
		titleText [tfv_TRADE_CANCELLED_END,"PLAIN DOWN"];
	};
	if (_cur_step >= _steps) then {
	    _steps_complete = true;
	};
};
if (_badTrade) exitWith { _vehicle setVehicleLock "UNLOCKED"; tfv_IS_TRADING = false; };

_nul = [_bars,_rejects,_vehicle] call tfv_fnc_payTrade;
{ systemChat format [tfv_SIDENOTE,_x]; } forEach _bars;

_display = format [tfv_SALE_SUCCESS_STRING,(count _weaponsActual) - (count _rejects)];
titleText [_display,"PLAIN DOWN"];
_vehicle setVehicleLock "UNLOCKED";
tfv_IS_TRADING = false;
Link to comment
Share on other sites

there is absolutely nothing wrong with any of it, and it makes no difference where abouts in the '!isDedicated' section you call it.

if you lok at this part -

while {!_steps_complete} do {
    _display = format [tfv_TRADE_STEPS,_cur_step + 1,_steps];
	titleText [_display,"PLAIN DOWN"];
	player playActionNow "medic";
	if (_firstStep) then { sleep 3; _firstStep = false; };

that is what should stop that happening to you, before i put that there it just did what it's doing to you now.

it's wierd that this is happening to you.

you could play around with the sleep timer here -

if (_firstStep) then { sleep 3; _firstStep = false; };

just keep upping the 3 and see if it sorts it out for you.

 

the only other explanation is if you've ever changed the animation played while trading, i know that's been going around the forum lately

Link to comment
Share on other sites

i dint touch the animations. but it seems to be admin tool related, got a report from a player that it worked fine for him. after changing the sleep 3 to a 6 it was ok for the first cycle but after that it was like before.

ill change it back to a 3 and have some players test it.

thx for your help!

Link to comment
Share on other sites

not working for me, here is my init.sqf http://pastebin.com/vX1M3Rfx

if (isServer) then {

	[] ExecVM "TradeFromVehicle\init.sqf";    //  <<<< Line to launch TradeFromVehicle script

	//Compile vehicle configs

	call compile preprocessFileLineNumbers "\z\addons\dayz_server\missions\DayZ_Epoch_24.Napf\dynamic_vehicle.sqf";				

	// Add trader citys

	_nil = [] execVM "\z\addons\dayz_server\missions\DayZ_Epoch_24.Napf\mission.sqf";



	_serverMonitor = 	[] execVM "\z\addons\dayz_code\system\server_monitor.sqf";

my mission init.sqf, and the mission.sqm markers are adjusted properly. i have only tried to configure one of my custom traders and tried to sell an einfield from my ural but no luck.

no RPT spam and message from trader about needing weapon in hand.

Link to comment
Share on other sites

you need to launch it from further down your init.sqf

look for this then place the ExecVM just beneath it -

if (!isDedicated) then {

also, you have 4 of everything in

tfv_TRADERS_PRICES = [

and on line 164 you're missing a [

        ["ItemKnife",1],
        ["ItemKnife",1],
        ["ItemKnife",1],
        ["ItemKnife",1],
        ItemKnife",1],
Link to comment
Share on other sites

It truly is unfortunate that this script doesn't use the trader items and prices already set in the database. The hassle alone of having to add any custom items, and match up trader prices, especially if the server has a customized economy, is enough for me not to bother with this script.

 

Don't get me wrong, it's an awesome concept, and yes, definitely makes the players lives a lot easier, but the simple fact that it could take hours of setup for me, the server admin, completely turns me off.

 

Maybe look into doing a database lookup in the traders_data table for the item and item price instead of setting it in your script. For any server admin who has a custom economy and has customized prices on items, this would save A LOT of setup time.

Link to comment
Share on other sites

I did originally want to use the database to pull all the information from, I just didn't and still don't have the knowledge of how to interact with the database through SQF files. Also, while making this I was testing it on a live server during it's down time late at night when it was empty and I really didn't want to make 1 mistake and ruin the database for everyone while learning so I had to settle on second best.

I think, once I've learned what I need to, I'll revisit this script and add that functionality to it, because that's the only thing I wasn't happy with on this script.

 

I ain't so worried though, I'm happy having learned as much as I have in just about 2 months of messing with this stuff :D

Link to comment
Share on other sites

no joy on my end, i can tell for certain that the init.sqf is being opened (after i removed the 1st entry which was in the wrong place) but i'm still getting no errors, and no menu to sell from vehicle.

 

I've fixed the typo's in my price listing and removed all the duplicate entries (these came from the split sql function posted earlier in this thread )

Link to comment
Share on other sites

no joy on my end, i can tell for certain that the init.sqf is being opened (after i removed the 1st entry which was in the wrong place) but i'm still getting no errors, and no menu to sell from vehicle.

 

I've fixed the typo's in my price listing and removed all the duplicate entries (these came from the split sql function posted earlier in this thread )

make sure that all your traders have 'canbuild=false'/'canbuild=true' on them in the mission.sqm file.

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...