Exports & API

Current server and client exports exposed by Oxide Vending.

Server Exports

Admin and Read Exports

GetAllBusinesses()

Returns the in-memory business cache keyed by business_id.

GetBusinessById(businessId)

Returns one business row or nil.

GetBusinessByOwner(citizenid)

Returns the business owned by the given identifier or nil.

GetBusinessStats(businessId)

Returns summary data for a business:

local stats = exports["oxide-vending"]:GetBusinessStats(businessId)
-- {
--   machine_count = number,
--   total_revenue = number,
--   uncollected_balance = number,
--   total_items_sold = number,
-- }

GetAllMachines()

Returns the in-memory machine cache keyed by machine_id.

GetMachineById(machineId)

Returns one machine row or nil.

GetMachinesByBusiness(businessId)

Returns the machine list for a business.

GetMachineStats(machineId)

Returns aggregate machine stats or nil if the machine is missing.

GetMachineStock(machineId)

Returns cached stock rows for a machine.

GetEmployeesByBusiness(businessId)

Returns the employee table for the business.

GetTransactionHistory(businessId, limit, offset)

Returns paginated transaction rows.

  • limit defaults to 50
  • limit is capped at 500
  • offset defaults to 0

AdminDeleteBusiness(businessId, adminIdentifier)

Force-deletes a business and returns:

local success, message = exports["oxide-vending"]:AdminDeleteBusiness(businessId, adminIdentifier)

adminIdentifier is optional and is used for transaction logging.

AdminDeleteMachine(machineId, adminIdentifier)

Force-deletes a machine and returns:

local success, message = exports["oxide-vending"]:AdminDeleteMachine(machineId, adminIdentifier)

Progression Exports

GetBusinessLevel(businessId)

Returns the current business level. Falls back to 1 if no progression row exists.

GetBusinessProgression(businessId)

Returns the cached progression row or nil.

AddXP(businessId, amount, source, notifySource)

Adds XP and returns:

local success, leveledUp = exports["oxide-vending"]:AddXP(businessId, amount, source, notifySource)
  • source is a string label such as "Event Bonus"
  • notifySource is an optional player source for XP gain notifications

AddRevenue(businessId, amount)

Tracks progression revenue and returns true if the business leveled up from the revenue update.

GetMaxMachines(businessId)

Returns the effective machine cap, using progression rewards when enabled or Config.Business.MaxMachinesPerBusiness otherwise.

GetMaxEmployees(businessId)

Returns the effective employee cap.

IsMachineTypeUnlocked(businessId, machineType)

Returns true if the machine type is currently unlocked for the business.

IsWarehouseUnlocked(businessId)

Returns true if the warehouse should be available to the business.

GetPricingRange(businessId, itemName)

Returns minPrice, maxPrice for the item after applying the current level or fallback pricing config.

GetWholesaleDiscount(businessId)

Returns the current wholesale discount as a decimal percentage, such as 0.08.

GetNPCRevenueBoost(businessId)

Returns the NPC revenue boost as a decimal percentage, such as 0.15.

CreateProgressionRecord(businessId)

Creates a missing progression row. Returns true on success.

ClaimDailyBonus(source, businessId)

Claims the daily bonus and returns:

local success, xpOrError, streak = exports["oxide-vending"]:ClaimDailyBonus(source, businessId)
  • Success path: true, xpAmount, streakDays
  • Failure path: false, errorMessage

Warehouse Exports

GetBusinessInventory(businessId)

Returns the raw warehouse inventory table for a business.

GetBusinessInventoryItem(businessId, itemName)

Returns the stored quantity or 0.

GetBusinessInventoryList(businessId)

Returns a formatted item list:

{
  { item_name = "water_bottle", label = "Water Bottle", quantity = 40, image = "water_bottle.png" }
}

GetTotalWarehouseItems(businessId)

Returns the total item count across all stored items.

AddToWarehouse(businessId, itemName, quantity)

Adds items to warehouse storage and returns:

local success, error = exports["oxide-vending"]:AddToWarehouse(businessId, itemName, quantity)

RemoveFromWarehouse(businessId, itemName, quantity)

Removes items from warehouse storage and returns:

local success, error = exports["oxide-vending"]:RemoveFromWarehouse(businessId, itemName, quantity)

HasWarehouse(businessId)

Returns true if the business owns a warehouse.

GetWarehouseByBusiness(businessId)

Returns:

{
  business_id = string,
  access_code = string,
  bucket_id = number,
}

or nil.

GetWarehouseByBucket(bucketId)

Returns warehouse, businessId or nil.

PurchaseWarehouse(source, businessId)

Purchases the warehouse using the business balance and returns:

local success, codeOrError = exports["oxide-vending"]:PurchaseWarehouse(source, businessId)
  • Success path: true, accessCode
  • Failure path: false, errorMessage

UpdateWarehouseCode(businessId, newCode)

Returns true on success or false, errorMessage on failure.

ValidateAccessCode(code)

Returns:

local valid, businessId, warehouse = exports["oxide-vending"]:ValidateAccessCode(code)

Pickup Export

CreatePickupBox(businessId, itemName, quantity, orderedBy)

Creates a wholesale pickup box and returns:

local boxData, error = exports["oxide-vending"]:CreatePickupBox(businessId, itemName, quantity, orderedBy)

GetPickupBoxesByBusiness(businessId)

Returns pickup boxes for the business.

GetPickupBox(boxId)

Returns one cached pickup box or nil.

NPC Sales Export

GetNPCSalesStats()

Returns current simulation totals:

local stats = exports["oxide-vending"]:GetNPCSalesStats()
-- {
--   totalSales = number,
--   totalRevenue = number,
--   simulationActive = boolean,
--   lastTickTime = number,
--   tickInterval = number,
-- }

Client Exports

Dashboard and Contract

OpenDashboard()

Opens the business dashboard UI.

CloseDashboard()

Closes the dashboard UI.

OpenContract()

Opens the registration contract UI.

CloseContract()

Closes the contract UI.

Placement

StartPlacement(machineType, modelName)

Starts the two-step placement flow for the given machine type and prop model.

CancelPlacement()

Cancels the active placement flow.

IsInPlacementMode()

Returns a boolean.

GetPlacementState()

Returns the current placement state string:

  • "positioning"
  • "rotating"
  • nil

Warehouse

OpenChangeCodeMenu()

Opens the warehouse access-code change menu for the owner flow.

Usage Examples

Check Progression Limits

local maxMachines = exports["oxide-vending"]:GetMaxMachines(businessId)
local maxEmployees = exports["oxide-vending"]:GetMaxEmployees(businessId)

Grant XP From Another Resource

local success, leveledUp = exports["oxide-vending"]:AddXP(businessId, 500, "Event Bonus", source)

Open the Dashboard From Another Client Resource

exports["oxide-vending"]:OpenDashboard()

Monitor NPC Sales

local stats = exports["oxide-vending"]:GetNPCSalesStats()
print(stats.totalSales, stats.totalRevenue)

On this page

Server ExportsAdmin and Read ExportsGetAllBusinesses()GetBusinessById(businessId)GetBusinessByOwner(citizenid)GetBusinessStats(businessId)GetAllMachines()GetMachineById(machineId)GetMachinesByBusiness(businessId)GetMachineStats(machineId)GetMachineStock(machineId)GetEmployeesByBusiness(businessId)GetTransactionHistory(businessId, limit, offset)AdminDeleteBusiness(businessId, adminIdentifier)AdminDeleteMachine(machineId, adminIdentifier)Progression ExportsGetBusinessLevel(businessId)GetBusinessProgression(businessId)AddXP(businessId, amount, source, notifySource)AddRevenue(businessId, amount)GetMaxMachines(businessId)GetMaxEmployees(businessId)IsMachineTypeUnlocked(businessId, machineType)IsWarehouseUnlocked(businessId)GetPricingRange(businessId, itemName)GetWholesaleDiscount(businessId)GetNPCRevenueBoost(businessId)CreateProgressionRecord(businessId)ClaimDailyBonus(source, businessId)Warehouse ExportsGetBusinessInventory(businessId)GetBusinessInventoryItem(businessId, itemName)GetBusinessInventoryList(businessId)GetTotalWarehouseItems(businessId)AddToWarehouse(businessId, itemName, quantity)RemoveFromWarehouse(businessId, itemName, quantity)HasWarehouse(businessId)GetWarehouseByBusiness(businessId)GetWarehouseByBucket(bucketId)PurchaseWarehouse(source, businessId)UpdateWarehouseCode(businessId, newCode)ValidateAccessCode(code)Pickup ExportCreatePickupBox(businessId, itemName, quantity, orderedBy)GetPickupBoxesByBusiness(businessId)GetPickupBox(boxId)NPC Sales ExportGetNPCSalesStats()Client ExportsDashboard and ContractOpenDashboard()CloseDashboard()OpenContract()CloseContract()PlacementStartPlacement(machineType, modelName)CancelPlacement()IsInPlacementMode()GetPlacementState()WarehouseOpenChangeCodeMenu()Usage ExamplesCheck Progression LimitsGrant XP From Another ResourceOpen the Dashboard From Another Client ResourceMonitor NPC Sales