The tablet has no list of businesses in its config. Each business resource adds itself with RegisterBusiness when it starts. The key is a job name in your framework, and the app shows only for players who hold that job.
exports['glitch-businesstablet']:RegisterBusiness('burgershot', {
appName = 'Burger Shot',
iconPath = 'https://cfx-nui-my-burgershot/html/logo.png',
icon = 'burger',
colour = '#ff3a2f',
colour2 = '#f5c400',
features = { memberships = false, loyalty = true },
})
Fields#
| Field | Required | Description |
|---|---|---|
appName |
Yes | The app's name on the tablet. |
iconPath |
Yes | The app icon, as a URL. |
icon |
No | A Font Awesome icon shown when iconPath does not load: 'burger', 'fa-burger' or 'fa-brands fa-discord'. Defaults to a building. |
colour |
No | Accent colour. Defaults to #6f42c1. |
colour2 |
No | Second colour, used for highlights in the phone app. |
features |
No | Which optional features the business uses. |
permissions |
No | Permissions of the business's own, such as using a work vehicle. See below. |
extension |
No | The business's own pages and the built-in pages it hides. See Custom pages. |
Features#
| Feature | Default | Description |
|---|---|---|
memberships |
true |
false removes the Memberships and Membership tiers pages and member discounts. |
app |
nil |
The business's customer phone app. nil gives it one only when loyalty or ordering is on. |
ordering |
false |
An Order tab in the phone app. Your resource must export the phone order functions below. |
loyalty |
false |
true, or a table to set up the card. |
Loyalty table fields:
| Field | Description |
|---|---|
stamps |
Paid orders needed for one reward (2 to 50). |
type |
'item' for one free item on the order, or 'percent' for a percentage off. |
reward |
Type item: what the free item is called. |
menuItem |
Type item: the label of the one menu item that is free. Leave it out to make the most expensive item on the order free. |
maxValue |
Type item: the free item is worth at most this much. 0 means no limit. |
percent |
Type percent: percent off the order (5 to 100). |
minSpend |
An order must total at least this to earn a stamp. |
These are starting values. The owner can change them on the tablet's Loyalty page.
Customers sign up in the business's phone app and get a four-character code. An order earns a stamp when the card is added to it at the till or kiosk. Staff redeem rewards on the Loyalty page, or your tills can use CheckLoyaltyCode and RedeemLoyaltyCode.
Business permissions#
A business can add its own permissions next to the built-in ones. Each shows on the Permissions page, where the boss gives it to ranks like any other, and your script checks it with HasPermission.
permissions = {
{ key = 'use_work_vehicle', label = 'Use work van', description = 'Take out and return the business work van', group = 'Vehicles' },
{ key = 'run_catering', label = 'Run catering jobs', group = 'Catering', default = true },
},
| Field | Description |
|---|---|
key |
Lower case letters, numbers and _. It cannot reuse a built-in permission. |
label |
Name on the Permissions page. |
description |
Optional. Shown under the name. |
group |
Optional. The heading it is listed under. Defaults to Business. |
default |
Optional. true gives it to every rank until the boss changes it. Defaults to false. |
The boss always has every permission. In your script:
if not exports['glitch-businesstablet']:HasPermission(source, 'pizzeria', 'run_catering') then
return notify(source, 'Your rank cannot run catering jobs.')
end
Phone ordering#
With ordering = true, your resource exports these server functions:
| Export | Returns |
|---|---|
PhoneOrder(src, picked, useCard) |
{ ok, orderNumber, error } after placing and charging the order. |
PhoneOrders(src) |
The player's open orders. |
PhoneOrdersOpen() |
true while the business takes app orders. |
PhoneOrderLimits() |
Optional. A table of limits shown in the app. |
Ownership and restarts#
A business belongs to the resource that registered it. Registering it again from the same resource updates it, and another resource cannot take it over. When the owning resource stops, the business is removed from the tablet. When the tablet itself restarts it forgets every business, so register again on its onResourceStart, as in the example on the Examples page.