⚖️ Auction House
Documentation related to the jo_auction_house script.
jo_auction_house gives players a market run from auction houses across the map. Players sell items at a fixed price or at auction, post buy orders for items they want and check the median price exchanged before trading. Purchased items, unsold lots and money earned wait in a private chest at the auction house.
Watch the trailer
1. Installation
jo_auction_house works on all frameworks compatible with jo_libs (the list). It requires jo_libs 2.18.0 or later and oxmysql.
To install jo_auction_house:
- Download the latest
jo_libsrelease. - Unzip it and place the
jo_libsfolder in your resources folder. - Download
jo_auction_housefrom your account. - Unzip it and place the
jo_auction_housefolder in your resources folder. - Start the resources in this order in your
server.cfg, after your framework and inventory:
ensure oxmysql
ensure jo_libs
ensure jo_auction_house💡 No SQL file
The script creates its database tables on its first startup. Your database must use the InnoDB engine.
Choose the market mode before the first start
Config.marketMode decides whether each auction house has its own market ("local", default) or all of them share one ("global"). The mode is saved in the database on the first start and cannot be changed afterwards: the resource refuses to start if the configuration no longer matches.
To let administrators use the removal commands, grant them the jo_auction_house.admin permission:
add_ace group.admin jo_auction_house.admin allowThe Auction House script is now ready to use.
2. Usage
Each auction house has a clerk and a chest next to it, and usually a blip on the map. The script ships with auction houses in Valentine, Saint Denis and Blackwater. A location can also have no visible clerk (npc.model = false): its prompt still shows at the clerk position.
- In local mode, each auction house has its own lots, buy orders and prices. Items and money are collected at the auction house where the trade happened.
- In global mode, every auction house shows the same market. Items and money can be collected at any chest.
Approach the clerk and press ENTER to open the auction house. The interface is split into counters: Market, Wanted, Sell, My sales and History. Press Q and E to change counter and ESC to close.
For players
Default controls
| Key | Context | Action |
|---|---|---|
ENTER | Clerk | Open the auction house |
ENTER | Chest | Open the chest |
R | Chest | Collect the money owed |
Q / E | Interface | Change counter |
F | Interface | Search |
I | Interface | Open the item sheet of the selected lot, order or item |
ENTER | Interface | Run the main action of the selected line |
ESC | Interface | Close the receipt, the item sheet, then the interface |
The prompt keys are set in keys.lua.
For administrators
| Command | Who | Effect |
|---|---|---|
/auctionHouse [id] | Players allowed by the server | Opens an auction house without walking to it. In local mode, pass the auction house id; in global mode, it opens the first configured auction house. Nobody can use it remotely until the canUseAuctionHouseRemotely filter allows them. The name is set by Config.auctionHouseCommand; false removes the command. |
/auctionremove <listing id> | Console or jo_auction_house.admin | Returns an active lot to its seller's chest. The leader of an auction gets their bid back at the chest. |
/orderremove <order id> | Console or jo_auction_house.admin | Closes an active buy order and returns what it held to the buyer's chest. |
The chest is never remote: items and money are always collected at an auction house.
3. Configuration
The configuration files are located in the config folder within the resource. This folder contains two subfolders:
_default.lock/- Contains the default configuration files. Do not edit these files directly as they may be overwritten during updates.custom/- This is where you place your custom configuration files to override the defaults.
How to customize the configuration
- Navigate to
jo_auction_house/config/_default.lock/ - Copy the file you want to modify (e.g.,
prices.lua) - Paste it into
jo_auction_house/config/custom/ - Edit the copied file in the
customfolder
The script automatically loads files from custom/ first, and only uses _default.lock/ as a fallback. This system ensures your customizations are preserved when updating the script.
Default configuration files
To change a setting, copy its file from config/_default.lock/ into config/custom/ and keep only the settings you change: the others keep their default value. Then run refresh and ensure jo_auction_house.
| File | Settings |
|---|---|
global.lua | Market mode, chest capacity, page size, interface sounds, the remote command and debug logs |
market.lua | Currencies, commission, barter, partial trades, free lots, price and quantity limits, durations of lots, auctions and buy orders, market statistics |
items.lua | Which items can be traded, the categories and the category preselected for each item |
locations.lua | Auction houses: id, clerk, chest and blip of each one |
keys.lua | Prompt keys at the clerk and the chest |
lang.lua | Every text shown to players: translate the script here |
A few points to check for your server:
Config.itemCategories(items.lua) ships with VORP item names. Adapt them to your inventory.- On VORP, the chest capacity counts every unit, not slots: keep
Config.chestMaxSlotswell aboveConfig.listingMaxQuantity. - On RSG, gold amounts must be whole numbers. Gold bid steps are rounded up to a whole unit.
- Every new category needs a
Lang.category_<id>name. A lot whose category no longer exists is shown underConfig.defaultCategory.
4. FAQ
The prompts are not working!
- Keyboard layout: the script uses the raw keys module: set the keyboard layout.
- Key conflicts: another resource may use the same key. Change the keys in
keys.lua(copy it intoconfig/custom/). - Distance: get closer. The clerk prompt shows within 2 meters and the chest prompts within 1.5 meters (
promptDistanceof each auction house inlocations.lua). - Installation: check that your framework is compatible with jo_libs and that
jo_libsstarts beforejo_auction_house.
The resource refuses to start after I changed the market mode
The market mode is recorded in the database on the first start because local and global chests hold different contents. Restore the recorded Config.marketMode. Switching modes on an existing database is not supported.
Lots or chest contents disappeared after I edited an auction house
Every lot and waiting item is saved with the auction house id. Renaming or removing a location hides its lots and chest contents. Restore the previous id. Each id must be unique and use lowercase letters, digits, _ or - (50 characters at most), or the resource stops at startup.
My money was not added to my wallet after a sale
Money from sales and refunds is never paid automatically. Go to the chest and press R to collect it. In local mode, use the chest of the auction house where the trade happened.
I cannot find an item in the Sell counter
The item must be allowed by Config.itemFilter. Inventory entries of type weapon are never offered. Items already listed have left your satchel.
I cannot open the auction house with the command
The command works near the clerk by default. To use it from anywhere, register the canUseAuctionHouseRemotely filter, as in the integration examples. In local mode, also pass the auction house id.
What happens to buy orders when I disable them?
With Config.enableBuyOrders = false, the Wanted counter and every order action disappear, and expiry pauses. Existing orders stay in the database: they are not cancelled or refunded automatically. Settle them before disabling the feature.
5. For developers
Every hook is registered from your own resource with the exports of jo_auction_house: exports.jo_auction_house:registerAction(name, callback) and exports.jo_auction_house:registerFilter(name, callback), on the side shown by the badge of each hook. source is the player who triggered the operation. Hook arguments are copied tables: use their fields (listing.item, listing.quantity, order.locationId…), not class methods. Prices are copies of jo.pricing tables. The callbacks and network events used by the interface are not part of the public API.
Restarting jo_auction_house
The hooks are stored by jo_auction_house: they are lost when jo_auction_house restarts alone. With jo_libs in your resource, register them in jo.onResourceStart("jo_auction_house", function() ... end), as in the integration examples, so they are registered again. The examples that use jo.framework need jo_libs in your resource (@jo_libs/init.lua and the framework-bridge module).
Hooks never bypass server checks
Identity, distance, ownership, quantities and payment are always checked by the server, whatever a filter returns.
Actions
Actions run after an operation has been saved. Their callbacks do not return a replacement value.
Client auctionHouseOpened
After the interface opens for the local player.
-- @param location - table: the configured auction house (id, name, npc, chest, blip)
exports.jo_auction_house:registerAction("auctionHouseOpened", function(location)
end)Server auctionSettled
After an auction closes for a buyer: when it ends with bids, or when a player uses buy-now. An auction ending without bids does not trigger it.
-- @param listing - table: the closed auction; listing.price is the final price
-- @param buyer - table: { identifier = string, charid = string } of the winner
-- @param buyNow - boolean: closed by buy-now
exports.jo_auction_house:registerAction("auctionSettled", function(listing, buyer, buyNow)
end)Server bidPlaced
After a bid was paid and saved.
-- @param listing - table: the auction with its new current bid
-- @param source - serverID of the bidder
-- @param amount - number: the bid, in the auction currency
exports.jo_auction_house:registerAction("bidPlaced", function(listing, source, amount)
end)Server listingCancelled
After the seller cancelled a lot. Expiry and /auctionremove do not trigger it.
-- @param listing - table: the cancelled lot
-- @param source - serverID of the seller
exports.jo_auction_house:registerAction("listingCancelled", function(listing, source)
end)Server listingPublished
After a fixed-price lot or an auction was saved and its items left the seller's inventory.
-- @param listing - table: the published lot; listing.type is "direct" or "auction"
-- @param source - serverID of the seller
exports.jo_auction_house:registerAction("listingPublished", function(listing, source)
end)Server listingSold
After each purchase of a fixed-price lot. On a partial purchase, listing holds the remaining quantity; its status becomes "sold" when nothing remains. Auctions trigger auctionSettled instead.
-- @param listing - table: the lot after the purchase
-- @param buyerSource - serverID of the buyer
-- @param quantity - integer: units bought
exports.jo_auction_house:registerAction("listingSold", function(listing, buyerSource, quantity)
end)Server moneyCollected
After the money owed was credited to the player's wallet at a chest.
-- @param source - serverID of the player
-- @param collected - table: jo.pricing copy of the amount paid
exports.jo_auction_house:registerAction("moneyCollected", function(source, collected)
end)Server orderClosed
When a buy order closes before being fully supplied. What it still held is returned to the buyer's chest.
-- @param order - table: the closed buy order
-- @param reason - "cancelled", "expired" or "removed" (/orderremove)
exports.jo_auction_house:registerAction("orderClosed", function(order, reason)
end)Server orderCreated
After a buy order was saved and its total or offered items were taken.
-- @param order - table: the posted buy order
-- @param source - serverID of the buyer
exports.jo_auction_house:registerAction("orderCreated", function(order, source)
end)Server orderFulfilled
After each supply. On a partial supply, order holds the remaining quantity; its status becomes "fulfilled" when nothing remains.
-- @param order - table: the buy order after the supply
-- @param supplierSource - serverID of the supplier
-- @param quantity - integer: units supplied
exports.jo_auction_house:registerAction("orderFulfilled", function(order, supplierSource, quantity)
end)Filters
Filters synchronously control permissions or replace values. Return the value expected by each filter. The can… filters receive true (false for canUseAuctionHouseRemotely): return false to refuse, return the value received to keep it. Another resource may have refused before yours, so keep its refusal (if not allowed then return false end). A filter may run several times for one operation: do not rely on side effects.
Server canBuyListing
Before a fixed-price lot is paid. Also called before an auction buy-now, with the whole quantity.
-- @param allowed - boolean: true
-- @param source - serverID of the buyer
-- @param listing - table: copy of the lot
-- @param quantity - integer: units to buy
-- @return boolean
exports.jo_auction_house:registerFilter("canBuyListing", function(allowed, source, listing, quantity)
return allowed
end)Server canCollectMoney
Before the money owed is collected at a chest. Refusing keeps the money owed; the filter cannot change the amount.
-- @param allowed - boolean: true
-- @param source - serverID of the player
-- @param owed - table: jo.pricing copy of the amount owed at this chest
-- @return boolean
exports.jo_auction_house:registerFilter("canCollectMoney", function(allowed, source, owed)
return allowed
end)Server canCreateOrder
Before a buy order is posted and its total taken.
-- @param allowed - boolean: true
-- @param source - serverID of the buyer
-- @param data - table: { locationId, item, quantity, price, barter, duration }
-- price: jo.pricing copy of the total held, or of the offered items when barter is true
-- duration: integer, in seconds
-- @return boolean
exports.jo_auction_house:registerFilter("canCreateOrder", function(allowed, source, data)
return allowed
end)Server canFulfillOrder
Before a buy order is supplied and the supplier's items taken.
-- @param allowed - boolean: true
-- @param source - serverID of the supplier
-- @param order - table: copy of the buy order
-- @param quantity - integer: units to supply
-- @return boolean
exports.jo_auction_house:registerFilter("canFulfillOrder", function(allowed, source, order, quantity)
return allowed
end)Client canOpenAuctionHouse
Before the interface opens for the local player. This is a client-side convenience: the server still checks every request.
-- @param allowed - boolean: true
-- @param location - table: the configured auction house
-- @return boolean
exports.jo_auction_house:registerFilter("canOpenAuctionHouse", function(allowed, location)
return allowed
end)Server canPlaceBid
Before a bid is paid.
-- @param allowed - boolean: true
-- @param source - serverID of the bidder
-- @param listing - table: copy of the auction
-- @param amount - number: the bid, in the auction currency
-- @return boolean
exports.jo_auction_house:registerFilter("canPlaceBid", function(allowed, source, listing, amount)
return allowed
end)Server canPublishListing
Before a lot or an auction is published and its items leave the seller's inventory.
-- @param allowed - boolean: true
-- @param source - serverID of the seller
-- @param data - table: { locationId, item, quantity, metadata, category, price, type, buyNowPrice }
-- price: jo.pricing copy of the lot total (or of the items asked), or the starting price of an auction
-- type: "direct" or "auction"
-- buyNowPrice: number|nil, the buy-now price of an auction
-- @return boolean
exports.jo_auction_house:registerFilter("canPublishListing", function(allowed, source, data)
return allowed
end)Client canSeeAuctionHouseBlip
When the blips are created, for each auction house that has one.
-- @param allowed - boolean: true
-- @param location - table: the configured auction house
-- @return boolean
exports.jo_auction_house:registerFilter("canSeeAuctionHouseBlip", function(allowed, location)
return allowed
end)Server canUseAuctionHouseRemotely
When a player farther than 10 meters from the clerk uses the auction house: by the /auctionHouse command and by each interface request made from a distance. It never applies to the chest.
-- @param allowed - boolean: false
-- @param source - serverID of the player
-- @param locationId - string: id of the auction house
-- @return boolean
exports.jo_auction_house:registerFilter("canUseAuctionHouseRemotely", function(allowed, source, locationId)
return allowed
end)Server overwriteCommission
Replaces the commission rate of a fixed-price lot, an auction or a buy order. Called when the receipt is quoted and again at confirmation; the operation is refused if the two rates differ. The rate is rounded to three decimals, then stored with the lot or order. Lots and orders paid in items pay no commission and never call it.
-- @param rate - number: percentage, Config.commissionPercent by default
-- @param source - serverID of the seller, or of the buyer for a buy order
-- @param locationId - string: id of the auction house
-- @param item - string: item name
-- @param quantity - integer: units
-- @param price - table: jo.pricing copy of the lot total, the auction starting price or the order total
-- @return number: percentage from 0 to 100; any other value refuses the operation
exports.jo_auction_house:registerFilter("overwriteCommission", function(rate, source, locationId, item, quantity, price)
return rate
end)Integration examples
Allow the remote command with an ACE permission
Players with the jo_auction_house.remote permission can use /auctionHouse from anywhere. Add add_ace group.vip jo_auction_house.remote allow (or another group) to your server.cfg.
-- server side
jo.onResourceStart("jo_auction_house", function()
exports.jo_auction_house:registerFilter("canUseAuctionHouseRemotely", function(allowed, source, locationId)
return allowed or IsPlayerAceAllowed(source, "jo_auction_house.remote")
end)
end)Lower the commission for a job
Traders pay half the commission. The same rate is returned at quote and at confirmation, so the receipt stays valid.
-- server side
jo.onResourceStart("jo_auction_house", function()
exports.jo_auction_house:registerFilter("overwriteCommission", function(rate, source, locationId, item, quantity, price)
if jo.framework:getJob(source) == "trader" then
return rate / 2
end
return rate
end)
end)Keep buy orders for one job
Only merchants can post buy orders. Earlier refusals are kept.
-- server side
jo.onResourceStart("jo_auction_house", function()
exports.jo_auction_house:registerFilter("canCreateOrder", function(allowed, source, data)
if not allowed then return false end
return jo.framework:getJob(source) == "merchant"
end)
end)