Exports
Server Exports
addOrder
Creates an order from server side. Useful for external scripts that want to send items through the blackmarket pickup system.
---@param items table[] Array of items to include in the order
---@return table|false Result with orderId and pickupLocation, or false on failure
exports.fd_blackmarket:addOrder(items) Each item in the items array should have:
| Field | Type | Description |
|---|---|---|
item | string | Item spawn name |
label | string? | Display label (defaults to item name) |
metadata | table? | Item metadata |
category | string? | Category id (defaults to 'misc') |
quantity | number? | Amount (defaults to 1) |
price | number? | Price in BC (defaults to 0) |
Example:
local result = exports.fd_blackmarket:addOrder({
{ item = 'lockpick', label = 'Lockpick', quantity = 5 },
{ item = 'WEAPON_PISTOL', label = 'Pistol', quantity = 1 },
})
if result then
print('Order created:', result.orderId)
print('Pickup:', result.pickupLocation.x, result.pickupLocation.y, result.pickupLocation.z)
end deleteOrder
Cancels an existing order by its ID. Frees the associated pickup location and syncs the buyer.
---@param orderId string The order's localId
---@return boolean success
exports.fd_blackmarket:deleteOrder(orderId) Example:
local success = exports.fd_blackmarket:deleteOrder('abc-123-def')
if success then
print('Order cancelled')
end addCoinsByIdentifier
Adds BC (Blackmarket Coins) to a player’s wallet using their framework identifier. Automatically creates the wallet if it doesn’t exist.
---@param identifier string Player's framework identifier (citizenid, license, etc.)
---@param amount number Amount of BC to add
---@return boolean success
exports.fd_blackmarket:addCoinsByIdentifier(identifier, amount) Example:
local success = exports.fd_blackmarket:addCoinsByIdentifier('ABC12345', 500)
if success then
print('Added 500 BC')
end removeCoinsByIdentifier
Removes BC from a player’s wallet using their framework identifier. Returns false if the player has insufficient balance.
---@param identifier string Player's framework identifier (citizenid, license, etc.)
---@param amount number Amount of BC to remove
---@return boolean success
exports.fd_blackmarket:removeCoinsByIdentifier(identifier, amount) Example:
local success = exports.fd_blackmarket:removeCoinsByIdentifier('ABC12345', 200)
if not success then
print('Insufficient balance')
end getCoinsByIdentifier
Returns a player’s current BC balance using their framework identifier.
---@param identifier string Player's framework identifier (citizenid, license, etc.)
---@return number balance
exports.fd_blackmarket:getCoinsByIdentifier(identifier) Example:
local balance = exports.fd_blackmarket:getCoinsByIdentifier('ABC12345')
print('Balance:', balance) addCoinsByPlayerId
Adds BC to a player’s wallet using their server ID. Resolves the identifier automatically via the framework bridge.
---@param source number Player's server ID
---@param amount number Amount of BC to add
---@return boolean success
exports.fd_blackmarket:addCoinsByPlayerId(source, amount) Example:
local success = exports.fd_blackmarket:addCoinsByPlayerId(source, 500)
if success then
print('Added 500 BC')
end removeCoinsByPlayerId
Removes BC from a player’s wallet using their server ID. Returns false if the player has insufficient balance.
---@param source number Player's server ID
---@param amount number Amount of BC to remove
---@return boolean success
exports.fd_blackmarket:removeCoinsByPlayerId(source, amount) Example:
local success = exports.fd_blackmarket:removeCoinsByPlayerId(source, 200)
if not success then
print('Insufficient balance')
end getCoinsByPlayerId
Returns a player’s current BC balance using their server ID.
---@param source number Player's server ID
---@return number balance
exports.fd_blackmarket:getCoinsByPlayerId(source) Example:
local balance = exports.fd_blackmarket:getCoinsByPlayerId(source)
print('Balance:', balance) spawnTemporaryVehicle
Spawns a temporary server-side vehicle. Used internally for vehicle pickup locations but available as an export.
---@param payload table { model: string|number, coords: vector3, heading: number, plate?: string, vehicleType?: string }
---@return number|nil vehicle, string|nil plate
exports.fd_blackmarket:spawnTemporaryVehicle(payload) Example:
local vehicle, plate = exports.fd_blackmarket:spawnTemporaryVehicle({
model = 'burrito3',
coords = vec3(793.0, -2990.8, 6.0),
heading = 270.0,
})