Skip to content

Client Exports

0R SmartPad | Client Export Functions

0R SmartTab — Client Exports Reference#

Complete reference for every client-side export available in 0r-smarttab.

lua
-- Usage from any other client script
exports['0r-smarttab']:ExportName(...)

All exports below run on the client and apply to the local player unless stated otherwise.


Table of Contents#

#ExportCategoryAsync
1IsTabletOpenTablet StateNo
2OpenTabletWithAppTablet ControlNo
3SendNotificationNotificationsNo
4SetAppBadgeNotificationsNo
5GetPlayerByTabletSerialTablet LookupYes (callback)
6GetPlayerInvoiceListBillingYes (callback)
7GetPlayerInvoiceCountBillingYes (callback)
8GetPlayerUnpaidInvoiceCountBillingYes (callback)
9GetPlayerTotalDebtBillingYes (callback)
10GetMugShotBase64UtilityYes (yields)

Tablet State#

1. IsTabletOpen#

Check if the local player's tablet is currently open.

lua
local isOpen = exports['0r-smarttab']:IsTabletOpen()
ReturnsTypeDescription
isOpenbooleantrue if the tablet UI is open

Example:

lua
if exports['0r-smarttab']:IsTabletOpen() then
    print("Tablet is open right now")
else
    print("Tablet is closed")
end

Tablet Control#

2. OpenTabletWithApp#

Open the tablet and navigate directly to a specific app. The player must have a tablet item in their inventory (and satisfy metadata checks if enabled).

lua
exports['0r-smarttab']:OpenTabletWithApp(appId)
ParameterTypeDescription
appIdstringApp id or action from server/apps.json
Returns
nothing

Example:

lua
-- Open the Mail app
exports['0r-smarttab']:OpenTabletWithApp("app-mail")

-- Open the Police MDT
exports['0r-smarttab']:OpenTabletWithApp("app-police")

-- Open the EMS app
exports['0r-smarttab']:OpenTabletWithApp("app-ems")

-- Open Settings
exports['0r-smarttab']:OpenTabletWithApp("settings")

-- Open a custom iframe app
exports['0r-smarttab']:OpenTabletWithApp("customapp")

Tip: You can find valid app IDs in server/apps.json. Each app has an id and/or action field — either one works.


Notifications#

3. SendNotification#

Push a notification to the local player's tablet. If the tablet is open, it appears immediately as an in-app notification. If the tablet is closed, it queues and plays a peek animation on screen.

lua
exports['0r-smarttab']:SendNotification(data)
ParameterTypeDescription
datatableNotification payload

Payload fields:

FieldTypeRequiredDefaultDescription
titlestringyes—Notification title
messagestringyes—Body text
appstringnonilApp ID — determines the icon shown
iconstringnonilCustom icon override
durationnumberno4000How long to show (ms)
typestringnonilOptional type tag
categorystringnonilOptional category tag
Returns
nothing

Example:

lua
exports['0r-smarttab']:SendNotification({
    title    = "New Order",
    message  = "You have a delivery waiting at the warehouse.",
    app      = "app-mail",
    duration = 5000
})

4. SetAppBadge#

Set a numeric badge on an app's home-screen icon. Useful for showing unread counts.

lua
exports['0r-smarttab']:SetAppBadge(appId, count)
ParameterTypeDescription
appIdstringApp ID (e.g. "app-mail")
countnumberBadge number — pass 0 to clear
Returns
nothing

Example:

lua
-- Show a badge of 5 on the mail app
exports['0r-smarttab']:SetAppBadge("app-mail", 5)

-- Clear the badge
exports['0r-smarttab']:SetAppBadge("app-mail", 0)

Tablet Lookup#

5. GetPlayerByTabletSerial#

Find the owner of a tablet by its serial number. Sends a request to the server and returns the result via callback. The owner must be online to be found.

lua
exports['0r-smarttab']:GetPlayerByTabletSerial(serial, callback)
ParameterTypeDescription
serialstringTablet serial number (e.g. "0R-A1B2C3")
callbackfunctionCalled with the result table

Callback result:

FieldTypeDescription
sourcenumber | nilPlayer server ID (nil if offline / not found)
citizenidstring | nilOwner citizen ID / identifier
namestring | nilPlayer character name

Example:

lua
exports['0r-smarttab']:GetPlayerByTabletSerial("0R-A1B2C3", function(result)
    if result.source then
        print("Owner: " .. result.name .. " (ID: " .. result.source .. ")")
    else
        print("No online player found for this serial")
    end
end)

Billing#

All billing exports fetch data from the server asynchronously. They return data for the local player only.

6. GetPlayerInvoiceList#

Get the full list of invoices (paid + unpaid) for the local player.

lua
exports['0r-smarttab']:GetPlayerInvoiceList(callback)
ParameterTypeDescription
callbackfunctionCalled with the invoice array

Each invoice object:

FieldTypeDescription
idnumber / stringInvoice ID
titlestringInvoice label
senderstringSender name or society
amountnumberTotal amount (with interest if overdue)
baseAmountnumberOriginal amount before interest
interestAmountnumberAccrued interest (0 if not overdue)
statusstring"unpaid" / "overdue" / "paid"
dueDatestringFormatted due date
daysOverduenumberDays past the due date (0 if not overdue)

Example:

lua
exports['0r-smarttab']:GetPlayerInvoiceList(function(invoices)
    print("You have " .. #invoices .. " invoice(s)")
    for _, inv in ipairs(invoices) do
        print((" - %s | $%d | %s"):format(inv.title, inv.amount, inv.status))
    end
end)

7. GetPlayerInvoiceCount#

Get the total number of invoices (paid + unpaid).

lua
exports['0r-smarttab']:GetPlayerInvoiceCount(callback)
ParameterType
callbackfunction(count: number)

Example:

lua
exports['0r-smarttab']:GetPlayerInvoiceCount(function(count)
    print("Total invoices: " .. count)
end)

8. GetPlayerUnpaidInvoiceCount#

Get the number of unpaid and overdue invoices only.

lua
exports['0r-smarttab']:GetPlayerUnpaidInvoiceCount(callback)
ParameterType
callbackfunction(count: number)

Example:

lua
exports['0r-smarttab']:GetPlayerUnpaidInvoiceCount(function(count)
    if count > 0 then
        print("You have " .. count .. " unpaid bill(s)!")
    end
end)

9. GetPlayerTotalDebt#

Get the total debt amount across all unpaid / overdue invoices (interest included).

lua
exports['0r-smarttab']:GetPlayerTotalDebt(callback)
ParameterType
callbackfunction(totalDebt: number)

Example:

lua
exports['0r-smarttab']:GetPlayerTotalDebt(function(debt)
    if debt > 0 then
        print("Total debt: $" .. debt)
    else
        print("No outstanding debt")
    end
end)

Utility#

10. GetMugShotBase64#

Capture a ped's headshot and return it as a base64 image string. This is a yielding call — it blocks the current thread until the headshot is ready (up to ~2 seconds).

lua
local base64 = exports['0r-smarttab']:GetMugShotBase64(ped, transparent)
ParameterTypeDescription
pednumberPed entity handle
transparentbooleantrue for transparent background, false for default
ReturnsTypeDescription
base64stringBase64-encoded image data (or empty string on failure)

Example:

lua
local ped = PlayerPedId()
local photo = exports['0r-smarttab']:GetMugShotBase64(ped, false)

if photo and photo ~= "" then
    print("Headshot captured, length: " .. #photo)
end

Note: This function yields (uses Citizen.Await internally). Call it from a CreateThread or async context — do not call it from a synchronous NUI callback handler.


Quick Reference#

ExportReturnsSync?
IsTabletOpen()booleanSync
OpenTabletWithApp(appId)—Sync
SendNotification(data)—Sync
SetAppBadge(appId, count)—Sync
GetPlayerByTabletSerial(serial, cb)via callbackAsync
GetPlayerInvoiceList(cb)via callbackAsync
GetPlayerInvoiceCount(cb)via callbackAsync
GetPlayerUnpaidInvoiceCount(cb)via callbackAsync
GetPlayerTotalDebt(cb)via callbackAsync
GetMugShotBase64(ped, transparent)stringYielding