Skip to content

Server Exports

0R SmartPad | Server Export Functions

0R SmartTab — All Exports Reference#

Complete reference for every export available in 0r-smarttab, organized by side and category.

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

Table of Contents#

Server-Side Exports

#ExportCategory
1IsPlayerTabletOpenTablet State
2GetPlayerByTabletSerialTablet State
3IsAppEnabledApp Management
4GetAppJobRequirementsApp Management
5SendNotificationNotifications
6SetAppBadgeNotifications
7GetPlayerInvoiceListBilling
8GetPlayerInvoiceCountBilling
9GetPlayerUnpaidInvoiceCountBilling
10GetPlayerTotalDebtBilling
11CheckUnpaidBillsBilling
12CreateInvoiceBilling
13IsPlayerOnDutyMDT / Police
14CheckHasWarrantMDT / Police
15SendJailPrison

Client-Side Exports

#ExportCategory
16IsTabletOpenTablet State
17OpenTabletWithAppTablet Control
18SendNotificationNotifications
19SetAppBadgeNotifications
20GetPlayerByTabletSerialTablet State
21GetPlayerInvoiceListBilling
22GetPlayerInvoiceCountBilling
23GetPlayerUnpaidInvoiceCountBilling
24GetPlayerTotalDebtBilling
25GetMugShotBase64Utility

Server-Side Exports#

All of these run in server scripts only.


Tablet State#

1. IsPlayerTabletOpen#

Check whether a player currently has their tablet open.

lua
local isOpen = exports['0r-smarttab']:IsPlayerTabletOpen(source)
ParameterTypeDescription
sourcenumberPlayer server ID
ReturnsType
is openboolean
lua
if exports['0r-smarttab']:IsPlayerTabletOpen(5) then
    print("Player 5 has their tablet open")
end

2. GetPlayerByTabletSerial#

Find the owner of a tablet by its serial number. The owner must be online.

lua
local source, citizenId, name = exports['0r-smarttab']:GetPlayerByTabletSerial(serial)
ParameterTypeDescription
serialstringTablet serial (e.g. "0R-A1B2C3")
ReturnsTypeDescription
sourcenumber | nilPlayer server ID
citizenIdstring | nilOwner citizen ID
namestring | nilPlayer character name
lua
local src, cid, name = exports['0r-smarttab']:GetPlayerByTabletSerial("0R-A1B2C3")
if src then
    print(name .. " owns this tablet (server id: " .. src .. ")")
end

App Management#

3. IsAppEnabled#

Check if a specific app is enabled in server/apps.json.

lua
local enabled = exports['0r-smarttab']:IsAppEnabled(appId)
ParameterTypeDescription
appIdstringApp ID (e.g. "app-mail", "app-police")
ReturnsType
enabledboolean
lua
if exports['0r-smarttab']:IsAppEnabled("app-mail") then
    print("Mail app is active")
end

4. GetAppJobRequirements#

Get all job-restricted apps and which jobs they require.

lua
local requirements = exports['0r-smarttab']:GetAppJobRequirements()
Parameters—
none
ReturnsTypeDescription
requirementstable{ [appId] = { "job1", "job2" } }
lua
local reqs = exports['0r-smarttab']:GetAppJobRequirements()
-- reqs["app-police"] = { "police", "sheriff" }
-- reqs["app-ems"]    = { "ambulance" }

Notifications#

5. SendNotification (Server)#

Send a notification to a player's tablet from the server. Shows immediately if the tablet is open, otherwise queues as a peek notification.

lua
exports['0r-smarttab']:SendNotification(targetSrc, data)
ParameterTypeDescription
targetSrcnumberTarget player server ID
datatableNotification payload

Payload fields:

FieldTypeRequiredDescription
titlestringyesTitle
messagestringyesBody text
appstringnoApp ID for icon
iconstringnoCustom icon
durationnumbernoDuration in ms (default 4000)
lua
exports['0r-smarttab']:SendNotification(source, {
    title    = "Delivery",
    message  = "New package available for pickup.",
    app      = "app-mail",
    duration = 5000
})

6. SetAppBadge (Server)#

Set a badge counter on an app icon for a player (from server).

lua
exports['0r-smarttab']:SetAppBadge(targetSrc, appId, count)
ParameterTypeDescription
targetSrcnumberTarget player server ID
appIdstringApp ID
countnumberBadge number (0 to clear)
lua
exports['0r-smarttab']:SetAppBadge(source, "app-mail", 3)

Billing#

7. GetPlayerInvoiceList#

Get the full invoice list for a player (paid + unpaid). Reads from phone_invoices (QBCore/Qbox) or billing (ESX).

lua
local invoices = exports['0r-smarttab']:GetPlayerInvoiceList(source)
ParameterTypeDescription
sourcenumberPlayer server ID
ReturnsType
invoicestable | nil

Each invoice object:

FieldTypeDescription
idnumber/stringInvoice ID
titlestringLabel
senderstringSender name / society
amountnumberTotal (with interest)
baseAmountnumberOriginal amount
interestAmountnumberAccrued interest
statusstring"unpaid" / "overdue" / "paid"
dueDatestringDue date
daysOverduenumberDays past due
lua
local list = exports['0r-smarttab']:GetPlayerInvoiceList(source)
if list then
    for _, inv in ipairs(list) do
        print(inv.title, inv.amount, inv.status)
    end
end

8. GetPlayerInvoiceCount#

Total number of invoices (paid + unpaid).

lua
local count = exports['0r-smarttab']:GetPlayerInvoiceCount(source)
ParameterType
sourcenumber
ReturnsType
countnumber

9. GetPlayerUnpaidInvoiceCount#

Number of unpaid + overdue invoices only.

lua
local unpaid = exports['0r-smarttab']:GetPlayerUnpaidInvoiceCount(source)
ParameterType
sourcenumber
ReturnsType
countnumber

10. GetPlayerTotalDebt#

Total debt across all unpaid/overdue invoices (interest included).

lua
local debt = exports['0r-smarttab']:GetPlayerTotalDebt(source)
ParameterType
sourcenumber
ReturnsType
totalDebtnumber

11. CheckUnpaidBills#

Quick boolean check + count for unpaid bills.

lua
local hasUnpaid, count = exports['0r-smarttab']:CheckUnpaidBills(source)
ParameterType
sourcenumber
ReturnsTypeDescription
hasUnpaidbooleantrue if any unpaid bills exist
countnumberNumber of unpaid bills
lua
local hasUnpaid, count = exports['0r-smarttab']:CheckUnpaidBills(source)
if hasUnpaid then
    print("Player owes " .. count .. " bill(s)")
end

12. CreateInvoice#

Create a new invoice for a target citizen. Officer info is auto-resolved from source. Supports QBCore/Qbox (phone_invoices) and ESX (billing).

lua
exports['0r-smarttab']:CreateInvoice(source, targetId, amount, reason)
ParameterTypeDescription
sourcenumberOfficer / sender server ID
targetIdstringTarget citizen ID / identifier
amountnumberAmount (> 0)
reasonstringInvoice label / reason

Returns nothing (async).

lua
exports['0r-smarttab']:CreateInvoice(source, "ABC12345", 5000, "Speeding violation")

MDT / Police#

13. IsPlayerOnDuty#

Check if a player is currently on duty (job onduty flag).

lua
local onDuty = exports['0r-smarttab']:IsPlayerOnDuty(source)
ParameterType
sourcenumber
ReturnsType
onDutyboolean
lua
if exports['0r-smarttab']:IsPlayerOnDuty(source) then
    print("Officer is on duty")
end

14. CheckHasWarrant#

Check if a citizen has active warrants in the MDT.

lua
local hasWarrant, count, records = exports['0r-smarttab']:CheckHasWarrant(citizenid)
ParameterType
citizenidstring
ReturnsTypeDescription
hasWarrantbooleantrue if warrants exist
countnumberNumber of warrants
recordstableArray of warrant rows
lua
local has, count, recs = exports['0r-smarttab']:CheckHasWarrant("ABC12345")
if has then
    print(count .. " active warrant(s)")
end

Prison#

15. SendJail#

Send a player to jail. Auto-detects the prison resource (xt-prison, qb-prison, qb-policejob, esx_policejob).

lua
exports['0r-smarttab']:SendJail(source, targetId, jailTime)
ParameterTypeDescription
sourcenumberOfficer server ID
targetIdstringTarget citizen ID / identifier
jailTimenumberTime in months/minutes (> 0)

Returns nothing. Target must be online.

lua
exports['0r-smarttab']:SendJail(source, "ABC12345", 30)

Client-Side Exports#

All of these run in client scripts only and affect the local player.


Tablet State & Control#

16. IsTabletOpen#

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

lua
local isOpen = exports['0r-smarttab']:IsTabletOpen()
Parameters—
none
ReturnsType
isOpenboolean
lua
if exports['0r-smarttab']:IsTabletOpen() then
    print("My tablet is open")
end

17. OpenTabletWithApp#

Open the tablet and jump directly to a specific app. The player must have a tablet item in their inventory.

lua
exports['0r-smarttab']:OpenTabletWithApp(appId)
ParameterTypeDescription
appIdstringApp ID or action from apps.json

Returns nothing.

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

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

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

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

Notifications#

18. SendNotification (Client)#

Send a notification to the local player's tablet. If open, appears immediately; if closed, queues and shows a peek animation.

lua
exports['0r-smarttab']:SendNotification(data)
ParameterTypeDescription
datatableNotification payload (same fields as server version)
lua
exports['0r-smarttab']:SendNotification({
    title   = "Alert",
    message = "Something happened nearby.",
    app     = "app-police",
    duration = 4000
})

19. SetAppBadge (Client)#

Set a badge counter on an app icon (local player only).

lua
exports['0r-smarttab']:SetAppBadge(appId, count)
ParameterTypeDescription
appIdstringApp ID
countnumberBadge number (0 to clear)
lua
exports['0r-smarttab']:SetAppBadge("app-mail", 5)

Tablet Lookup (Async)#

20. GetPlayerByTabletSerial (Client)#

Look up a tablet's owner by serial number. Queries the server asynchronously.

lua
exports['0r-smarttab']:GetPlayerByTabletSerial(serial, callback)
ParameterTypeDescription
serialstringTablet serial number
callbackfunctionfunction(result) — result is a table

Result table:

FieldType
sourcenumber | nil
citizenidstring | nil
namestring | nil
lua
exports['0r-smarttab']:GetPlayerByTabletSerial("0R-A1B2C3", function(result)
    if result.source then
        print(result.name .. " — server id: " .. result.source)
    end
end)

Billing (Async)#

All client billing exports query the server and return data via callback.

21. GetPlayerInvoiceList (Client)#

lua
exports['0r-smarttab']:GetPlayerInvoiceList(function(list)
    for _, inv in ipairs(list) do
        print(inv.title, inv.amount, inv.status)
    end
end)
ParameterType
callbackfunction(list)

22. GetPlayerInvoiceCount (Client)#

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

23. GetPlayerUnpaidInvoiceCount (Client)#

lua
exports['0r-smarttab']:GetPlayerUnpaidInvoiceCount(function(count)
    print("Unpaid: " .. count)
end)
ParameterType
callbackfunction(count)

24. GetPlayerTotalDebt (Client)#

lua
exports['0r-smarttab']:GetPlayerTotalDebt(function(debt)
    print("Total debt: $" .. debt)
end)
ParameterType
callbackfunction(totalDebt)

Utility#

25. GetMugShotBase64#

Capture a ped's headshot as a texture dictionary string (for NUI/UI display).

lua
local txd = exports['0r-smarttab']:GetMugShotBase64(ped, transparent)
ParameterTypeDescription
pednumberPed handle
transparentbooleanUse transparent background
ReturnsTypeDescription
txdstringTexture dictionary name ("none" on failure)
lua
local ped = PlayerPedId()
local headshot = exports['0r-smarttab']:GetMugShotBase64(ped, true)