Jump to content

[Outdated][RELEASE] Virtual Garage update for 1061


theduke

Recommended Posts

Alright so here is the virtual garage.

ALL CREDITS go to the original authors.

GZA David for the Virtual Garage script

Torndeco for the EXT Database

All i did was change a few variables to update it for 1.0.6.1

 

DOWNLOAD
https://github.com/theduke77/Virtual-Garage

I use the script a little different than intended.

The only difference, i use vehicle and air traders to access the virtual garage, intended for use with garages, but requires gem crafting...
The original instructions are in the download in case someone wants to do it that way

so on with the instructions..

Tools Required

Notepad ++
PBO Tool
SQL tool such as HeidiSQL

First we start with the mission folder.

copy the scripts folder from the downloads into your mission folder.

1. Open your init.sqf

look for

dayz_randomMaxFuelAmount

add this bellow

DZE_garagist = ["Profiteer4","Worker3","RU_Profiteer4","Hooker1","Worker2"];

save and close

2. Open your description.ext

add this at the bottom

#include "scripts\garage\common.hpp"
#include "scripts\garage\vehicle_garage.hpp"

save and close

4. Open your fn_selfactions.sqf

look for

//Player Deaths

add this above

//Garage
		
   	if((_typeOfCursorTarget in DZE_garagist) && (player distance _cursorTarget < 5)) then {
		if (s_garage_dialog2 < 0) then {
			s_garage_dialog2 = player addAction ["Vehicle Garage", "scripts\garage\vehicle_dialog.sqf",_cursorTarget, 3, true, true, "", ""];
		};
		if (s_garage_dialog < 0) then {
			s_garage_dialog = player addAction ["Store Vehicle in Garage", "scripts\garage\vehicle_store_list.sqf",_cursorTarget, 3, true, true, "", ""];
		};
	} else {
		player removeAction s_garage_dialog2;
		s_garage_dialog2 = -1;
		player removeAction s_garage_dialog;
		s_garage_dialog = -1;
	};

still in the fn_selfactions.sqf

look for

player removeAction s_player_fuelauto2;
	s_player_fuelauto2 = -1;
	player removeAction s_player_manageDoor;
	s_player_manageDoor = -1;

add this bellow

player removeAction s_garage_dialog2;
	s_garage_dialog2 = -1;
	player removeAction s_garage_dialog;
	s_garage_dialog = -1;

save and close.

5. Open your variables.sqf

look for dayz_resetSelfActions = {

add this before the closing bracket     };

s_garage_dialog = -1;
s_garage_dialog2 = -1;

save and close

 

6. Open your compiles.sqf

look for

fn_dropItem = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_dropItem.sqf";

add this above

player_getVehicle = 			compile preprocessFileLineNumbers "scripts\garage\getvehicle.sqf";
	player_storeVehicle = 			compile preprocessFileLineNumbers "scripts\garage\player_storeVehicle.sqf";
	vehicle_info = compile preprocessFileLineNumbers "scripts\garage\vehicle_info.sqf";

Still in the compiles, add this at the bottom

SC_fnc_removeCoins=
{
	private ["_player","_amount","_wealth","_newwealth", "_result"];
	_player = _this select 0;
	_amount = _this select 1;
	_result = false;
	_wealth = _player getVariable[Z_MoneyVariable,0];  
	if(_amount > 0)then{
	if (_wealth < _amount) then {
	_result = false;
	} else {                         
	_newwealth = _wealth - _amount;
	_player setVariable[Z_MoneyVariable,_newwealth, true];
	_player setVariable ["moneychanged",1,true];    
	_result = true;
	call player_forceSave;        
	};
	}else{
	_result = true;
	};
	_result
};

SC_fnc_addCoins = 
{
	private ["_player","_amount","_wealth","_newwealth", "_result"];			
	_player =  _this select  0;
	_amount =  _this select  1;
	_result = false;	
	_wealth = _player getVariable[Z_MoneyVariable,0];
	_player setVariable[Z_MoneyVariable,_wealth + _amount, true];
	call player_forceSave;
	_player setVariable ["moneychanged",1,true];					
	_newwealth = _player getVariable[Z_MoneyVariable,0];		
	if (_newwealth >= _wealth) then { _result = true; };			
	_result
};

vehicle_gear_count = {
		private["_counter"];
		_counter = 0;
		{
			_counter = _counter + _x;
		} count _this;
		_counter
	};

save and close

7A. Open your publicEH.sqf

If you don't have a custom publicEH.sqf already, go to step 7B

look for

if (dayz_groupSystem) then {
		"PVDZ_Server_UpdateGroup" addPublicVariableEventHandler {(_this select 1) spawn server_updateGroup};
	};

add this bellow

"PVDZE_queryGarageVehicle" addPublicVariableEventHandler {(_this select 1) spawn server_queryGarageVehicle};
    "PVDZE_spawnVehicle" addPublicVariableEventHandler {(_this select 1) spawn server_spawnVehicle};
    "PVDZE_storeVehicle" addPublicVariableEventHandler {(_this select 1) spawn server_storeVehicle};

7B. Only do this step if you DON'T have a custom publicEH.sqf

Open your init.sqf again

look for

call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";

replace it with this

call compile preprocessFileLineNumbers "scripts\garage\publicEH.sqf";

Thats it for the mission file

 

Now for the server 

Copy the garage folder from the download, into the compiles folder in your dayz_server folder

1. Open your server_functions.sqf

look for this

spawn_vehicles = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\spawn_vehicles.sqf";

add this bellow

"extDB" callExtension "9:DATABASE:Database2";
"extDB" callExtension format["9:ADD:DB_RAW_V2:%1",1];
"extDB" callExtension "9:LOCK";

server_queryGarageVehicle = 	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\garage\server_queryGarageVehicle.sqf";
server_spawnVehicle = 	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\garage\server_spawnVehicle.sqf";
server_storeVehicle = 	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\garage\server_storeVehicle.sqf";
fn_asyncCall = 	compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\garage\fn_async.sqf";

Save and close

Thats it for the server PBO

 

 

BattlEye

Add to publicvariable.txt:

!="PVDZE_queryGarageVehicle" !="PVDZE_storeVehicle" !="PVDZE_spawnVehicle" 

 

Infistar

Infistar: 
Add to _ALLOWED_Dialogs:

2800,3800

 

Now for the database

Using heidi (or your favorite sql tool)

Open SQL.txt and copy everything in there and run a query on your database.

This will create a database called extdb

Copy the @extdb folder to the root of your server.

In your server launch BAT. add @extdb; before @dayz_epoch_server

Open the @extdb folder, edit the extdb-conf.ini and change the username and password to suit your needs.

(you might need to give all permissions for that user for the new database in heidi)

 

All done.  Log in and go visit your vehicle traders!

Cheers Enjoy!

 

EDIT: updated the instructions for the fix of ANY/gear and it not taking coins. Please refer to step 6
EDIT 22/03/2017 : Added a fix for client RPT error (Step 5) Also changed the variable for the currency

Link to comment
Share on other sites

59 minutes ago, kingpapawawa said:

wondering how this will fit in with masterkey... probably not so well since it takes the key. 

It's possible to do, I did it on one of my servers, you just need to comment out a few lines.

In player_storeVehicle.sqf find

if(_charID != "0") then {
[_unit,_key] call BIS_fnc_invRemove; cutText ["Key removed!", "PLAIN DOWN"];
};

and replace it with 

/*if(_charID != "0") then {
[_unit,_key] call BIS_fnc_invRemove; cutText ["Key removed!", "PLAIN DOWN"];
};*/

in getvehicle.sqf find 

_inventory = (weapons player);
_backpack = ((getWeaponCargo unitBackpack player) select 0);
if (_result in (_inventory+_backpack)) then
{
	if (_result in _inventory) then {cutText [format["Key [%1] already in your inventory!",_result], "PLAIN"];};
	if (_result in _backpack) then {cutText [format["Key [%1] already in your backpack!",_result], "PLAIN"];};
}
else
{
	player addweapon _result;
	cutText [format["Key [%1] added to your inventory!",_result], "PLAIN"];
};

and replace it with 

/*_inventory = (weapons player);
_backpack = ((getWeaponCargo unitBackpack player) select 0);
if (_result in (_inventory+_backpack)) then
{
	if (_result in _inventory) then {cutText [format["Key [%1] already in your inventory!",_result], "PLAIN"];};
	if (_result in _backpack) then {cutText [format["Key [%1] already in your backpack!",_result], "PLAIN"];};
}
else
{
	player addweapon _result;
	cutText [format["Key [%1] added to your inventory!",_result], "PLAIN"];
};*/

This will stop it from removing the key and also stop it from giving you another key when the vehicle is called from the garage.

Link to comment
Share on other sites

Changes for master key work fine, thanks @orionjade

Have an error. It stores vehicle but does not take coins... probably this is an old call to single currency.. SC_fnc_removeCoins

Error in expression <hen {
_added = [player, Pricegear] call SC_fnc_removeCoins;
} else {_added = tru>
  Error position: <SC_fnc_removeCoins;
} else {_added = tru>
  Error Undefined variable in expression: sc_fnc_removecoins
File mpmissions\__CUR_MP.Chernarus\scripts\garage\player_storeVehicle.sqf, line 39
Error in expression <{_added = true;};
Pricegear = nil;

if(!_added) exitWith {cutText ["You don't ha>
  Error position: <_added) exitWith {cutText ["You don't ha>
  Error Undefined variable in expression: _added
File mpmissions\__CUR_MP.Chernarus\scripts\garage\player_storeVehicle.sqf, line 43

Link to comment
Share on other sites

49 minutes ago, kingpapawawa said:

Changes for master key work fine, thanks @orionjade

Have an error. It stores vehicle but does not take coins... probably this is an old call to single currency.. SC_fnc_removeCoins

Error in expression <hen {
_added = [player, Pricegear] call SC_fnc_removeCoins;
} else {_added = tru>
  Error position: <SC_fnc_removeCoins;
} else {_added = tru>
  Error Undefined variable in expression: sc_fnc_removecoins
File mpmissions\__CUR_MP.Chernarus\scripts\garage\player_storeVehicle.sqf, line 39
Error in expression <{_added = true;};
Pricegear = nil;

if(!_added) exitWith {cutText ["You don't ha>
  Error position: <_added) exitWith {cutText ["You don't ha>
  Error Undefined variable in expression: _added
File mpmissions\__CUR_MP.Chernarus\scripts\garage\player_storeVehicle.sqf, line 43

Does your vehicle inventory say any in the garage menu. If so you have the same problem i have. If I find a fix I'll share.

Link to comment
Share on other sites

1 minute ago, kingpapawawa said:

In your server launch BAT. add @extdb; before @dayz_epoch_server (check original instructions for the datbase additions)

Thanks for the reply ! 

I have it like this - "-mod=@DayzOverwatch;@DayZ_Epoch;@extdb;@DayZ_Epoch_Server;"

I also uploaded the extdb folder to server root and ran SQL on db. 

Everything else works except the vehicle is gone after you store it in garage.

"No Vehicle" is the notice you get when you try to withdraw vehicle.

Link to comment
Share on other sites

37 minutes ago, Bricktop said:

Thanks for the reply ! 

I have it like this - "-mod=@DayzOverwatch;@DayZ_Epoch;@extdb;@DayZ_Epoch_Server;"

I also uploaded the extdb folder to server root and ran SQL on db. 

Everything else works except the vehicle is gone after you store it in garage.

"No Vehicle" is the notice you get when you try to withdraw vehicle.

you set the username and password in extdb-conf.ini ?

Link to comment
Share on other sites

1 hour ago, Bricktop said:

Thanks for the reply ! 

I have it like this - "-mod=@DayzOverwatch;@DayZ_Epoch;@extdb;@DayZ_Epoch_Server;"

I also uploaded the extdb folder to server root and ran SQL on db. 

Everything else works except the vehicle is gone after you store it in garage.

"No Vehicle" is the notice you get when you try to withdraw vehicle.

Same for me...

 

RPT:

17:55:10 Error in expression < call compile format["%1",_key];
_key = _key select 1;

sleep (random .03);


_q>
17:55:10   Error position: <_key select 1;

sleep (random .03);


_q>
17:55:10   Error Nicht definierte Variable in Ausdruck: _key
17:55:10 File z\addons\dayz_server\compile\garage\fn_async.sqf, line 26
17:55:10 Error in expression < = "extDB" callExtension format["4:%1", _key];
if (_queryResult == "[5]") then {>
17:55:10   Error position: <_key];
if (_queryResult == "[5]") then {>
17:55:10   Error Nicht definierte Variable in Ausdruck: _key
17:55:10 File z\addons\dayz_server\compile\garage\fn_async.sqf, line 35
17:55:10 Error in expression <ult = call compile _queryResult;


if ((_queryResult select 0) == 0) exitWith {d>
17:55:10   Error position: <_queryResult select 0) == 0) exitWith {d>
17:55:10   Error Nicht definierte Variable in Ausdruck: _queryresult
17:55:10 File z\addons\dayz_server\compile\garage\fn_async.sqf, line 66
17:55:10 Error in expression <all;


PVDZE_queryGarageVehicleResult = _result;


if(!isNull _player) then {
_c>
17:55:10   Error position: <_result;


if(!isNull _player) then {
_c>
17:55:10   Error Nicht definierte Variable in Ausdruck: _result
17:55:10 File z\addons\dayz_server\compile\garage\server_queryGarageVehicle.sqf, line 13

 

Link to comment
Share on other sites

2 hours ago, SryImAnooB said:

Same for me...

 

RPT:


17:55:10 Error in expression < call compile format["%1",_key];
_key = _key select 1;

sleep (random .03);


_q>
17:55:10   Error position: <_key select 1;

sleep (random .03);


_q>
17:55:10   Error Nicht definierte Variable in Ausdruck: _key
17:55:10 File z\addons\dayz_server\compile\garage\fn_async.sqf, line 26
17:55:10 Error in expression < = "extDB" callExtension format["4:%1", _key];
if (_queryResult == "[5]") then {>
17:55:10   Error position: <_key];
if (_queryResult == "[5]") then {>
17:55:10   Error Nicht definierte Variable in Ausdruck: _key
17:55:10 File z\addons\dayz_server\compile\garage\fn_async.sqf, line 35
17:55:10 Error in expression <ult = call compile _queryResult;


if ((_queryResult select 0) == 0) exitWith {d>
17:55:10   Error position: <_queryResult select 0) == 0) exitWith {d>
17:55:10   Error Nicht definierte Variable in Ausdruck: _queryresult
17:55:10 File z\addons\dayz_server\compile\garage\fn_async.sqf, line 66
17:55:10 Error in expression <all;


PVDZE_queryGarageVehicleResult = _result;


if(!isNull _player) then {
_c>
17:55:10   Error position: <_result;


if(!isNull _player) then {
_c>
17:55:10   Error Nicht definierte Variable in Ausdruck: _result
17:55:10 File z\addons\dayz_server\compile\garage\server_queryGarageVehicle.sqf, line 13

 

I gave up on this for now ... 

Moving on to something else before I lose my mind lol

I'm going to try to get god mode for vehicles in plot pole working.  (same difference I guess - except for the performance boost) 

If you figure this out please let me know and I'll do the same.

Link to comment
Share on other sites

On 3/15/2017 at 0:32 PM, orionjade said:

This will stop it from removing the key and also stop it from giving you another key when the vehicle is called from the garage.

I personally think its a good idea that this script removes the key. Like me, I have it so players can transfer vehicles from cherno to taviana.  

Also, it teaches players to make copies of their keys.  If they have a masterkey, they SHOULD have copies...

Link to comment
Share on other sites

17 minutes ago, theduke said:

@Bricktop Are you on a host or a dedicated box?

Also once stored, does it appear in the table if you look in the database?

Thanks for the reply duke -

I looked in the Workbench and I don't see any vehicles stored in the extdb

(I also uploaded the extdb folder to the server root and changed the user/pass) 

============

I use a host for the live server (phpMyAdmin) 

I also have a local server set up here at home for testing (XAMPP/MySQL Workbench)

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...