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.
local result = exports["oxide-vending"]:GetAllBusinesses()GetBusinessById(businessId)
Returns one business row or nil.
local result = exports["oxide-vending"]:GetBusinessById(businessId)GetBusinessByOwner(citizenid)
Returns the business owned by the given identifier or nil.
local result = exports["oxide-vending"]:GetBusinessByOwner(citizenid)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.
local result = exports["oxide-vending"]:GetAllMachines()GetMachineById(machineId)
Returns one machine row or nil.
local result = exports["oxide-vending"]:GetMachineById(machineId)GetMachinesByBusiness(businessId)
Returns the machine list for a business.
local result = exports["oxide-vending"]:GetMachinesByBusiness(businessId)GetMachineStats(machineId)
Returns aggregate machine stats or nil if the machine is missing.
local result = exports["oxide-vending"]:GetMachineStats(machineId)GetMachineStock(machineId)
Returns cached stock rows for a machine.
local result = exports["oxide-vending"]:GetMachineStock(machineId)GetEmployeesByBusiness(businessId)
Returns the employee table for the business.
local result = exports["oxide-vending"]:GetEmployeesByBusiness(businessId)GetTransactionHistory(businessId, limit, offset)
Returns paginated transaction rows.
local result = exports["oxide-vending"]:GetTransactionHistory(businessId, limit, offset)limitdefaults to50limitis capped at500offsetdefaults to0
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.
local result = exports["oxide-vending"]:GetBusinessLevel(businessId)GetBusinessProgression(businessId)
Returns the cached progression row or nil.
local result = exports["oxide-vending"]:GetBusinessProgression(businessId)AddXP(businessId, amount, source, notifySource)
Adds XP and returns:
local success, leveledUp = exports["oxide-vending"]:AddXP(businessId, amount, source, notifySource)sourceis a string label such as"Event Bonus"notifySourceis 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.
local result = exports["oxide-vending"]:AddRevenue(businessId, amount)GetMaxMachines(businessId)
Returns the effective machine cap, using progression rewards when enabled or Config.Business.MaxMachinesPerBusiness otherwise.
local result = exports["oxide-vending"]:GetMaxMachines(businessId)GetMaxEmployees(businessId)
Returns the effective employee cap.
local result = exports["oxide-vending"]:GetMaxEmployees(businessId)IsMachineTypeUnlocked(businessId, machineType)
Returns true if the machine type is currently unlocked for the business.
local result = exports["oxide-vending"]:IsMachineTypeUnlocked(businessId, machineType)IsWarehouseUnlocked(businessId)
Returns true if the warehouse should be available to the business.
local result = exports["oxide-vending"]:IsWarehouseUnlocked(businessId)GetPricingRange(businessId, itemName)
Returns minPrice, maxPrice for the item after applying the current level or fallback pricing config.
local result = exports["oxide-vending"]:GetPricingRange(businessId, itemName)GetWholesaleDiscount(businessId)
Returns the current wholesale discount as a decimal percentage, such as 0.08.
local result = exports["oxide-vending"]:GetWholesaleDiscount(businessId)GetNPCRevenueBoost(businessId)
Returns the NPC revenue boost as a decimal percentage, such as 0.15.
local result = exports["oxide-vending"]:GetNPCRevenueBoost(businessId)CreateProgressionRecord(businessId)
Creates a missing progression row. Returns true on success.
local result = exports["oxide-vending"]:CreateProgressionRecord(businessId)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.
local result = exports["oxide-vending"]:GetBusinessInventory(businessId)GetBusinessInventoryItem(businessId, itemName)
Returns the stored quantity or 0.
local result = exports["oxide-vending"]:GetBusinessInventoryItem(businessId, itemName)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.
local result = exports["oxide-vending"]:GetTotalWarehouseItems(businessId)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.
local result = exports["oxide-vending"]:HasWarehouse(businessId)GetWarehouseByBusiness(businessId)
Returns:
{
business_id = string,
access_code = string,
bucket_id = number,
}or nil.
GetWarehouseByBucket(bucketId)
Returns warehouse, businessId or nil.
local result = exports["oxide-vending"]:GetWarehouseByBucket(bucketId)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.
local result = exports["oxide-vending"]:UpdateWarehouseCode(businessId, newCode)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.
local result = exports["oxide-vending"]:GetPickupBoxesByBusiness(businessId)GetPickupBox(boxId)
Returns one cached pickup box or nil.
local result = exports["oxide-vending"]:GetPickupBox(boxId)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.
local result = exports["oxide-vending"]:OpenDashboard()CloseDashboard()
Closes the dashboard UI.
local result = exports["oxide-vending"]:CloseDashboard()OpenContract()
Opens the registration contract UI.
local result = exports["oxide-vending"]:OpenContract()CloseContract()
Closes the contract UI.
local result = exports["oxide-vending"]:CloseContract()Placement
StartPlacement(machineType, modelName)
Starts the raycast placement flow for the given machine type and prop model. The player aims with the camera, rotates with the scroll wheel, and confirms with E (or cancels with Backspace).
local result = exports["oxide-vending"]:StartPlacement(machineType, modelName)CancelPlacement()
Cancels the active placement flow.
local result = exports["oxide-vending"]:CancelPlacement()IsInPlacementMode()
Returns a boolean.
local result = exports["oxide-vending"]:IsInPlacementMode()GetPlacementState()
Returns the current placement state string:
local result = exports["oxide-vending"]:GetPlacementState()"placing"while placement is activenilwhen idle
Warehouse
OpenChangeCodeMenu()
Opens the warehouse access-code change menu for the owner flow.
local result = exports["oxide-vending"]:OpenChangeCodeMenu()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)