Jump to content

[RELEASE] TradeFromVehicle - Version 2.0 is here!


Csus

Recommended Posts

So version 2.0 is finally here! Woooo :D

 

It's a giant improvement over the last version, no more manual labour to get it working! Just plug and play.

 

Features -

    Select to either sell weapons, sell magazines or sell all items from your vehicle.

    Select to either sell weapons, sell magazines or sell all items from your backpack.

    Combine Currency - Takes the player's money and tries to reduce the amount of items while still keep the same value.

        Example, 5 * 10oz Gold would turn into a Briefcase with 5 * 10oz gold inside.

    Safe trading, locks your vehicle during trade and the trade is cancelled if, somehow, the vehicle moves, is entered by a player or the gear is changed.

    It also cancels trading from your backpack if your backpacks gear is changed in some way.

    If a weapon or magazine cannot be sold at that trader normally, it won't be sold using this script either.

    If you don't have the right humanity to trade with a trader normally, you can't trade using this either.

   

Things you can modify -

    You can disable or enable trading from backpack, trading from vehicle and combine currency.

    You can modify the trading speeds of both magazines and weapons.

    You can disable or enable the trading of toolbelt items. (These are classed as weapons, keys will ALWAYS be safe.)

 

 

HOTFIX - Now compatible with Piggd's Banking System. Also shaved 7kb from the file size.

 

Update 0.1 -

  Added ability to disable trading from vehicle.

  Improved the maths behind calculationg trading stages.

  Improved the checks made on weapons/magazines when calculating trading stages.

  The 'Combine Money' action will no longer show when you only have one currency item in your inventory.

 

This will ALWAYS sell weapons and magazines for the correct price, the exact selling price you have in your database.

A newer video will be uploaded as soon as I can do it.

 

Download the files here! Installation and setup instructions are in the download, but it's incredibly easy.

 

-Dwarfer's Version-

You can also find an 'unofficial' (also, probably better) version of this script here!

This version adds compatability with both config traders and Zupa's Single Currency. It also adds a 'taxing' mechanic.

Massive, massive thanks to Dwarfer!  People like him are the reason this community is damn good!

 

All posts after this one are regarding the current version.

 

https://www.youtube.com/watch?v=E5gn7-uA7UU

Link to comment
Share on other sites

Will this conflict if we put different trader prices than the database? probably not :)

 

Is there an easier way of finding out which weps did i add rather than the defualt epoch weapons, becuase i added in too many and i cant remember. Do I have to remove any weps from your list if they are custom on your server ?

 

Thanks, for the awesome script. I think you should put a note on the animation per items that putting this to a high value will put pressure on the database and can lag trading for others. (does this use the database at all?)

Link to comment
Share on other sites

@ Gr8Boi

 

Yeah, you should completely modify the weapons and prices to matchs your server.

It will never conflict with anything you put in your database, it never reads or writes from there.

The way I found the weapons I want to add is just by using the 'Spawn Weapons' list of infiSTAR to find the proper weapon name, so if you can use that or a similar method that would be most efficient.

You can change tfv_SALES_PER_ANIM to any value you like (greater than 0), it will never cause lag. Unless they're playing on an Amiga XD

Your databse will never be lagged and any lag caused will always be local lag. I highly doubt it will lag though.

 

 

I'm glad you all like it! :D

Link to comment
Share on other sites

@ Gr8Boi

 

I think your problem is on line 19.

After a quick search of character models, I found that 'BAF_Soldier_AAA_MT' is not a proper model.

Try another trader and if it works fine then your problem is just a typo.

Link to comment
Share on other sites

@ Gr8Boi

 

I think your problem is on line 19.

After a quick search of character models, I found that 'BAF_Soldier_AAA_MT' is not a proper model.

Try another trader and if it works fine then your problem is just a typo.

 

 

Its not "BAF_Soldier_AAA_MT" its "BAF_Soldier_AAA_MTP"

 

Typo on your part

Link to comment
Share on other sites

Well, i figured it out, Instead of linking the script right under Dedicated loop. I put it at the end before };

 

Thanks for the awesome script. What are the whitelist action names for infistar AH?

Link to comment
Share on other sites

yeah, you could.

something like this -

 

in the init create a variable called 'tfv_ALLOWED_VEHICLES'.

then add the vehicles to this, e.g -

tfv_ALLOWED_VEHICLES = ["UralCivil","Horse_Carriage","Flying_Saucer_DES_EP1_DZE"];

then in the monitor.sqf add a new variable to line 3 called '_isAllowed', it should look like this -

private ["_vehicle","_crew","_driver","_ownsCar","_trader","_trader_obj","_isAllowed"];

next, add this directly below line 19

_isAllowed = (typeOf _vehicle) in tfv_ALLOWED_VEHICLES;

so line 19 to 27 should look like -

    if (vehicle player != player) then {    //Check if the player was in the driver seat.
		_vehicle = vehicle player;
	    _isAllowed = (typeOf _vehicle) in tfv_ALLOWED_VEHICLES;
		_crew = crew _vehicle;
		_driver = _crew select 0;
		if (player == _driver) then {
		    _ownsCar = true;
		} else {
		    _ownsCar = false;
		};
	};

now, you just gotta change this line -

if ((vehicle player == player) && (_ownsCar)) then {

to this -

if ((vehicle player == player) && (_ownsCar)&&(_isAllowed)) then {

this should work just nicley for you

Link to comment
Share on other sites

Well, i figured it out, Instead of linking the script right under Dedicated loop. I put it at the end before };

 

Thanks for the awesome script. What are the whitelist action names for infistar AH?

 

 

 

I got the same problem than you. Default files, no errors, no debug. Like it just wont run.

Tried what u say, nothing.

Link to comment
Share on other sites

this is a chunk of my init.sqf

//Load in compiled functions
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";				//Initilize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";				//Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";	//Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";				//Compile regular functions
progressLoadingScreen 0.5;
call compile preprocessFileLineNumbers "server_traders.sqf";				//Compile trader configs
progressLoadingScreen 1.0;

"filmic" setToneMappingParams [0.153, 0.357, 0.231, 0.1573, 0.011, 3.750, 6, 4]; setToneMapping "Filmic";

if (isServer) then {
	//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";
};

if (!isDedicated) then {

    [] ExecVM "TradeFromVehicle\init.sqf";    //  <<<< Line to launch TradeFromVehicle script
    [10] ExecVM "AutoEpi\AutoEpi.sqf";
	
	//Conduct map operations
	0 fadeSound 0;
	waitUntil {!isNil "dayz_loadScreenMsg"};
	dayz_loadScreenMsg = (localize "STR_AUTHENTICATING");
	
	//Run the player monitor
	_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
	_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";	
	
};

as long as you have the ExecVM line around the same place I do it should work pefectly.

Link to comment
Share on other sites

This is so awesome!!

ppl love it on my server!

 

It works without issues when u have setup the config correctly. it only sells weapons which the trader support! (love this)

 

Realy good work!

 

It would be more awesome if u could trade magazines too! Is this possible to come in future updates??

Link to comment
Share on other sites

@sisquo007

I could add magazine selling to it, i'll get that out as soon as i can :)

 

@Bambit

After nearly 10 years of using this name in games and generally everywhere online, someone finally knows what it is :D

And, if you know how to adjust it to sell from your backpack, you're more than welcome to do so. Let me know how it goes!

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 item,
	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 in ('trade_weapons','trade_items')
group by item
order by list 
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...