Jump to content

Release Auction House (MMO Style)


Creep

Recommended Posts

Hey guys I just gonna leave this here:

This Script is based on basics and dialogs of the virtual garage script! (Dialogs and the async call are from Altis life apparently)
Credits to GZA for sharing the Virtual Garage script.

However, most of the code is completely rewritten by me (Creep/Senfo).
If you find any bugs, feel free to report them to me.

This will add a dialog to enter items into a traderdatabase with a custom price set by the player (not 0 and not negative).
The added item can be bought by other players.
If the item was sold, you can claim the money from the trader.

Screenshots:



05402-2df18466-e82d-436f-94b4-2fb9a6cbbd


05402-0c440b35-89db-433b-b694-3eae129042



Dont worry, I will pull a new version of the dialog soon to fix the width of the scrollbar.
#####Install Instructions#####

This Script isnt easy to install because of extDB and the Database part!

1. Get a working version of extDB and install it! (Watch tutorials if needed)

2. Install some dependencies (not needed if you already have the virtual garage script running)


Server.pbo

server_functions.sqf:

paste this:

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

under this:
onPlayerDisconnected {[_uid,_name] call server_onPlayerDisconnect;};

#Sidenote: "extDB" callExtension "9:DATABASE:Database2"; change Database2 to the Databaseconfig you got in your extdb-conf.ini


copy the fn_async.sqf into the compiles folder

then add in serverfunction.sqf

fn_asyncCall = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fn_async.sqf";

under:

server_deaths = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\server_playerDeaths.sqf";

3. The actual Auctionhouse

Server.pbo

server_functions.sqf

paste this:

server_buyitem = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\store\server_buyitem.sqf";
server_sellitem = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\store\server_sellitem.sqf";
server_claimprice = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\store\server_claimprice.sqf";
server_queryStoreitems = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\store\server_queryStoreitems.sqf";

under:

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

copy the "store" folder from the download into the compiles folder

Mission.pbo

Compiles.sqf

Add:

player_claimmoney = compile preprocessFileLineNumbers "custom\scripts\auctionhouse\claimmoney.sqf";
player_sellitem = compile preprocessFileLineNumbers "custom\scripts\auctionhouse\player_sellitem.sqf";
player_buyitem = compile preprocessFileLineNumbers "custom\scripts\auctionhouse\player_buyitem.sqf";

Under this block of code (this might look a bit different)

if (DZE_ConfigTrader) then {
call compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_traderMenuConfig.sqf";
}else{
call compile preprocessFileLineNumbers "ZSC\gold\player_traderMenu.sqf";
};


fn_selfactions.sqf (yes you need a custom one, just search the forum for it)
this will add the auctionhouse scrolloption to every servertrader

add:

//Auctionhouse
if(_typeOfCursorTarget in serverTraders && (player distance _cursorTarget < 5)) then {
if (s_auction_dialog2 < 0) then {
s_auction_dialog2 = player addAction ["Buy Items from the Auctionhouse", "custom\scripts\auctionhouse\item_dialog.sqf",_cursorTarget, 0, true, false, "", ""];
};
if (s_auction_dialog < 0) then {
s_auction_dialog = player addAction ["Sell Items to the Auctionhouse", "custom\scripts\auctionhouse\item_sell_list.sqf",_cursorTarget, 0, true, false, "", ""];
};
if (s_auction_claim < 0) then {
s_auction_claim = player addAction ["Claim your Money", "custom\scripts\auctionhouse\claimmoney.sqf",_cursorTarget, 0, true, false, "", ""];
};
} else {
player removeAction s_auction_dialog2;
s_auction_dialog2 = -1;
player removeAction s_auction_dialog;
s_auction_dialog = -1;
player removeAction s_auction_claim;
s_auction_claim = -1;
};

after:

if(_cursorTarget == dayz_hasFire) then {
if ((s_player_fireout < 0) && !(inflamed _cursorTarget) && (player distance _cursorTarget < 3)) then {
s_player_fireout = player addAction [localize "str_actions_self_06", "custom\levelsys\fire_pack.sqf",_cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_fireout;
s_player_fireout = -1;
};

add:

player removeAction s_auction_dialog2;
s_auction_dialog2 = -1;
player removeAction s_auction_dialog;
s_auction_dialog = -1;
player removeAction s_auction_claim;
s_auction_claim = -1;

after:

player removeAction s_player_downgrade_build;
s_player_downgrade_build = -1;
variables.sqf

add:
s_auction_dialog2 = -1;
s_auction_dialog = -1;
s_auction_claim = -1;

directly after:
s_player_untow = -1;

if needed create the path:

costum\scripts\ -> this means a folder called "custom" in the root and a folder called "scripts" inside it (without "")


then paste the "auctionhouse" folder from the download in it

description.ext

if you already have a custom common.hpp from the garagescript this is not needed, otherwise

paste this to the very end of the file:

#include "custom\scripts\auctionhouse\common.hpp"

This is for everyone again:

paste this to the very end of the file:

#include "custom\scripts\auctionhouse\itemstore.hpp"


publicEH.sqf

paste this in the if(isServer) then { part: (like below "PVDZE_plr_DeathB" addPublicVariableEventHandler {(_this select 1) spawn server_deaths}; or something)

"PVDZE_getStoreitems" addPublicVariableEventHandler {(_this select 1) spawn server_queryStoreitems};
"PVDZE_sellItem" addPublicVariableEventHandler {(_this select 1) spawn server_sellitem};
"PVDZE_buyItem" addPublicVariableEventHandler {(_this select 1) spawn server_buyitem};
"PVDZE_claimmoney" addPublicVariableEventHandler {(_this select 1) spawn server_claimprice};


The database:

enter the database you selected in the extDB config and in the serverfunctions
the run the database.sql from the download in it

this will add the tables:

store
store_user


Battleye:

open the publicvariable.txt

paste:
!"PVDZE_sellItem" !="PVDZE_sellItem" !"PVDZE_buyItem" !="PVDZE_buyItem" !"PVDZE_claimmoney" !="PVDZE_claimmoney" !"PVDZE_getStoreitems" !="PVDZE_getStoreitems"

behind this:
5 "PVDZE_"

And then you are done and it should work if you have done everything right
If you have Infistar or some other stuff like that, you will need to whitelist the scrolloptions and the dialogs



Regards,
Creep/Senfo



### Update 7.4.15 ####

Updated first post!
Files changed!
Installation instructions changed only in selfaction part.

Updated the version with some better Debug messages: make sure to check server and Client RPT's for errors.

###################

Auction House.zip

Link to comment
Share on other sites

this is a very kool idea. but is it possible to also get a non sc version of this?

I dont want and dont need the sc stuff. :D

 

or can you give me a hint on what to change?

 

€: I already rewrote the vehicle garage script to work with normal epoch currency. but with your script Im not sure where to start really.

Link to comment
Share on other sites

for the non single currency you need to change the amount thats getting store to an equal of lets say 1 gold.

then just interprete the amount of "gold as goldbars and use the epoch functions to find the needed goldbars in the inventory :)

this should all be in player_buyitem and player_sellitem

additionally you need to change the claimmoney.sqf too

I guess I will add a non SC version too soon ;)

Link to comment
Share on other sites

for the non single currency you need to change the amount thats getting store to an equal of lets say 1 gold.

then just interprete the amount of "gold as goldbars and use the epoch functions to find the needed goldbars in the inventory :)

this should all be in player_buyitem and player_sellitem

additionally you need to change the claimmoney.sqf too

I guess I will add a non SC version too soon ;)

Nice work!But..where are screenshots of this great thing? :rolleyes:

Link to comment
Share on other sites

ah, one more thing:

 

you might wanna remove that part from the instruction:

 

if ((_typeOfCursorTarget == "MAP_Misc_Greenhouse") && (player distance _cursorTarget < 5)) then {
if (s_player_greenhouse1 < 0) then {
s_player_greenhouse1 = player addAction ["Water the Greenhouse", "custom\greenhouse\water.sqf",_cursorTarget, 3, true, true, "", ""];
};
if (s_player_greenhouse3 < 0) then {
s_player_greenhouse3 = player addAction ["Add Sticks", "custom\greenhouse\sticks.sqf",_cursorTarget, 3, true, true, "", ""];
};
if (s_player_greenhouse2 < 0) then {
s_player_greenhouse2 = player addAction ["Plant Seeds", "custom\greenhouse\seeds.sqf",_cursorTarget, 3, true, true, "", ""];
};
};

 

or share it :P

 

you wanted us to get curious right? ;)

Link to comment
Share on other sites

extdb log

[00:30:51 +00:-1] [Thread 4024544005] extDB: Version: 35
[00:30:51 +00:-1] [Thread 4024544005] extDB: Windows Version
[00:30:51 +00:-1] [Thread 4024544005] Message: Arma Linux Servers are using Older Physic Library (than Windows Servers), due to Debian 7 using old version of Glibc
[00:30:51 +00:-1] [Thread 4024544005] Message: If you like extDB consider donating or bug BIS to drop support for Debian 7 thanks, so Linux Servers get same Physic Library Version as Windows
[00:30:51 +00:-1] [Thread 4024544005] Message: Note currently most/all development for extDB is done on a Linux Server
[00:30:51 +00:-1] [Thread 4024544005] Message: Torndeco: 24/01/15
[00:30:51 +00:-1] [Thread 4024544005] 
[00:30:51 +00:-1] [Thread 4024544005] extDB: Found extdb-conf.ini
[00:30:51 +00:-1] [Thread 4024544005] extDB: Detected 2 Cores, Setting up 2 Worker Threads
[00:30:51 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 9:DATABASE:Database2
[00:30:51 +00:-1] [Thread 4024544005] extDB: Database Type: MySQL
[00:30:51 +00:-1] [Thread 4024544005] extDB: Database Session Pool Started
[00:30:51 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 9:ADD:DB_RAW_V2:1
[00:30:51 +00:-1] [Thread 4024544005] extDB: DB_RAW_V3: Initialized: ADD_QUOTES True
[00:30:51 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 9:LOCK
Link to comment
Share on other sites

extdb log with new user and password

[00:30:51 +00:-1] [Thread 4024544005] extDB: Version: 35
[00:30:51 +00:-1] [Thread 4024544005] extDB: Windows Version
[00:30:51 +00:-1] [Thread 4024544005] Message: Arma Linux Servers are using Older Physic Library (than Windows Servers), due to Debian 7 using old version of Glibc
[00:30:51 +00:-1] [Thread 4024544005] Message: If you like extDB consider donating or bug BIS to drop support for Debian 7 thanks, so Linux Servers get same Physic Library Version as Windows
[00:30:51 +00:-1] [Thread 4024544005] Message: Note currently most/all development for extDB is done on a Linux Server
[00:30:51 +00:-1] [Thread 4024544005] Message: Torndeco: 24/01/15
[00:30:51 +00:-1] [Thread 4024544005] 
[00:30:51 +00:-1] [Thread 4024544005] extDB: Found extdb-conf.ini
[00:30:51 +00:-1] [Thread 4024544005] extDB: Detected 2 Cores, Setting up 2 Worker Threads
[00:30:51 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 9:DATABASE:Database2
[00:30:51 +00:-1] [Thread 4024544005] extDB: Database Type: MySQL
[00:30:51 +00:-1] [Thread 4024544005] extDB: Database Session Pool Started
[00:30:51 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 9:ADD:DB_RAW_V2:1
[00:30:51 +00:-1] [Thread 4024544005] extDB: DB_RAW_V3: Initialized: ADD_QUOTES True
[00:30:51 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 9:LOCK
[00:37:20 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 2:1:SELECT id, classname, price, type FROM store WHERE PlayerUID != '207598278'
[00:37:20 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Input: SELECT id, classname, price, type FROM store WHERE PlayerUID != '207598278'
[00:37:20 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Result: [1,[]]
[00:37:20 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 4:1749605807
[00:39:00 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 2:1:SELECT id, classname, price, type FROM store WHERE PlayerUID != '207598278'
[00:39:00 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Input: SELECT id, classname, price, type FROM store WHERE PlayerUID != '207598278'
[00:39:00 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Result: [1,[]]
[00:39:00 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 4:1749605807
[00:39:09 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 2:1:SELECT price FROM store_user WHERE PlayerUID='207598278'
[00:39:09 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Input: SELECT price FROM store_user WHERE PlayerUID='207598278'
[00:39:09 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Result: [1,[]]
[00:39:09 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 4:1749605807
[00:39:09 +00:-1] [Thread 4024544005] extDB: Extension Input from Server: 1:1:DELETE FROM store_user WHERE PlayerUID='207598278'
[00:39:09 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Input: DELETE FROM store_user WHERE PlayerUID='207598278'
[00:39:09 +00:-1] [Thread 4265045926] extDB: DB_RAW_V3: Trace: Result: [1,[]]
[00:43:50 +00:-1] [Thread 4024544005] extDB: Stopping ...

Link to comment
Share on other sites

diag_log ("HIVE: S>
16:38:04   Error Undefined variable in expression: spawn_roadblocks
16:38:04 File z\addons\dayz_server\system\server_monitor.sqf, line 294
16:38:04 Error in expression <rom 1 to MaxDynamicDebris do {
[] spawn spawn_roadblocks;
};
 
if ((_hiveResponse select 1) == "Instance alr>
16:38:04   Error position: <_hiveResponse select 1) == "Instance alr>
16:38:04   Error Undefined variable in expression: _hiveresponse
16:38:04 File z\addons\dayz_server\system\server_monitor.sqf, line 44
16:38:04 Error in expression <yZ_instance];
_hiveResponse = _key call server_hiveReadWrite;  
 
 
if ((((isnil "_>
16:38:04   Error Undefined variable in expression: server_hivereadwrite
16:38:04 File z\addons\dayz_server\system\server_monitor.sqf, line 40
16:38:04 "HIVE: trying to get objects"
16:38:04 Error in expression <select 1)) != "SCALAR")})) then {
 
diag_log ("HIVE: S>
16:38:05   Error Undefined variable in expression: spawn_roadblocks
16:38:05 File z\addons\dayz_server\system\server_monitor.sqf, line 294
16:38:05 Error in expression <rom 1 to MaxDynamicDebris do {
[] spawn spawn_roadblocks;
};
 
if(isnil "dayz_MapA>
16:38:05   Error Undefined variable in expression: spawn_mineveins
16:38:05 File z\addons\dayz_server\system\server_monitor.sqf, line 306
16:38:05 Error in expression <
if (isDedicated) then {
_id = [] spawn server_spawnEvents;
[] spawn {
private [>
16:38:05   Error position: <server_spawnEvents;
[] spawn {
private [>
16:38:05   Error Undefined variable in expression: server_spawnevents
16:38:05 File z\addons\dayz_server\system\server_monitor.sqf, line 326
16:38:05 "Total Number of spawn locations 5"
16:44:20 NetServer::SendMsg: cannot find channel #436304934, users.card=1
16:44:20 NetServer: users.get failed when sending to 436304934
Link to comment
Share on other sites

@Ghostis Iam using version 33 non_log, it appears that your extDB extension drops out at some point..

Also your PlayerUID doesn't look like a SteamID. Do you use Arma 2 1.63? You should consider updating if not.

I had some trouble once, finding the right tbbmalloc.dll /tbb.dll make sure you got the matching ones.

 

@Sterben Make sure you followed the Instructions right. It seems like you did a mistake in the serverfunctions part.

Link to comment
Share on other sites

@Ghostis+Creep
His extDB is running fine, its just closing when he shutdowns server etc...
Its just his queries are just returning an empty result, but yeah that doesn't look like a steamID value to short


@Creep
Nice bit of code etc...

Just some random tips

extDB v34+ requires  x86 vc redist 2013, thats is prob your reason for extDB v33 working for you + not the later versions.
extDB2 requires x86  vc redist 2013

If you ask your GSP Providor to install them, they shouldn't have any issues etc..

--------

Quick tips if you update to extDB2

_database = "Database2";

_result = call compile ("extDB2" callExtension "9:ADD_DATABASE:Database2");
if (_result select 0 == 0) exitWith {diag_log "extDB2 Database2 Error, check extDB2 Logs ";};
_result = call compile ("extDB2" callExtension format["9:ADD_DATABASE_PROTOCOL:%1:SQL_RAW:1", _database]);
if (_result select 0 == 0) exitWith {diag_log "extDB2 SQL_RAW Error, check extDB2 Logs";};
"extDB2" callExtension "9:LOCK";

Use this as fn_async.sqf
http://pastebin.com/JX8PbgBU


Note: Recommed you consider using SQL_CUSTOM its where you define prepared statements in a file, it is alot more secure.
example of a file @ https://github.com/Torndeco/ArmA3_Wasteland.Altis/blob/Development_main/sql_custom/a3wasteland.ini

extDB2 is really just has some new features, improved some of the code + better at handling Database Server Connection Loses

Link to comment
Share on other sites

@Ghostis Iam using version 33 non_log, it appears that your extDB extension drops out at some point..

Also your PlayerUID doesn't look like a SteamID. Do you use Arma 2 1.63? You should consider updating if not.

I had some trouble once, finding the right tbbmalloc.dll /tbb.dll make sure you got the matching ones.

 

@Sterben Make sure you followed the Instructions right. It seems like you did a mistake in the serverfunctions part.

I am using ver.35 and my arma patch is 1.63.112555

if I use this patch , I can not use this script ? He will be running only with SteamID ????

Link to comment
Share on other sites

Thanks for all the replies first of all :)

hopefully I can upload a bit more updated version today, including some security stuff

@Ghostis my script uses a function called getPlayerUID which was introduced on the switch to steamonly I think, I try to keep this function on the server side to have a single version for sure, that's part of the next update too :)

@seelenapparat gonna check that today, also might include a debug mode to make get the reason.

Link to comment
Share on other sites

installed the script. it works on some levels. but:

 

when I press the 'sell item' button, nothing happens. no error in client or server rpt.

 

seems like it does not spawn the player_sellitem script somehow. paths are correct though, doule- and tripplechecked it. :D

 

 

Having the same problem here....

 

-CJ-

Link to comment
Share on other sites

Thanks for all the replies first of all :)

hopefully I can upload a bit more updated version today, including some security stuff

@Ghostis my script uses a function called getPlayerUID which was introduced on the switch to steamonly I think, I try to keep this function on the server side to have a single version for sure, that's part of the next update too :)

@seelenapparat gonna check that today, also might include a debug mode to make get the reason.

tell me when the wait release, and then I have an intolerance to Steam :lol:  :lol:  :lol:

Link to comment
Share on other sites

Updated first post! 

Files changed! 

Installation instructions changed only in selfaction part.

 

Updated the version with some better Debug messages: make sure to check server and Client RPT's for errors.

Have the files changed? I no longer see a download link.

Link to comment
Share on other sites

yep there is no problem with that :)

 

File is attached now

Thanks. Going to load it up and see if I can find out why the items won't transfer after hitting the sell button. I have the garage installed and it works fine.

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