Integration
All exports
Every client and server export of fx-pocketbook, the side it runs on, who may call it and a link to its reference.
Everything another resource can call on FX Pocketbook:
lualocal book = exports['fx-pocketbook']
local open = book:IsOpen()
The resource folder must be named fx-pocketbook. If you renamed it, use that name in exports[...].
#Before you start
- Client exports run on the player's own game and act on that player's notebook.
- Server exports take a player (
src, the server id) or a character id. A character id is the framework name and the character key:'vorp:12'(VORP charidentifier) or'rsg:ABC12345'(RSG citizenid). The Kartlarim exports also work for offline characters when you pass a character id. - Money in the Bank and Kartlarim exports is in cents (100 = 1 dollar). The bill exports take and return dollars.
- Dates are unix seconds (
os.time()). - Server exports that read or write the database wait for it. Call them from a thread or an event handler, not every frame.
- Some groups of exports only answer resources you allow by name. See the access column below.
#Client exports
| Export | Purpose | Reference |
|---|---|---|
Open |
Open the notebook | Notebook |
Close |
Close the notebook | Notebook |
IsOpen |
Whether the notebook is open | Notebook |
OpenApplication |
Open the notebook on a built-in app | Notebook |
IsPlacingRelay |
Whether the player is placing a pole or a phonograph | Notebook |
Notify |
Show a notification in the notebook | Notifications and signal |
GetSignal |
Signal bars, 0 to 5 | Notifications and signal |
CanUseOnline |
Whether the signal is enough to send or receive | Notifications and signal |
AddCustomApp |
Add your own app to the notebook | Custom apps |
RemoveCustomApp |
Remove your app | Custom apps |
OpenApp |
Open the notebook on your app | Custom apps |
SendCustomAppMessage |
Send data to your app's page | Custom apps |
#Server exports
| Export | Purpose | Access | Reference |
|---|---|---|---|
Notify |
Send a notification to a player | any resource | Notifications and signal |
GetSignal |
A player's signal bars | any resource | Notifications and signal |
CanUseOnline |
Whether a player's signal is enough | any resource | Notifications and signal |
IssueDocument |
Give a document (identity, licence) | Kartlarim list | Documents |
RevokeDocument |
Delete a document | Kartlarim list | Documents |
SetDocumentStatus |
Mark a document valid, suspended or expired | Kartlarim list | Documents |
GetDocuments |
A character's documents | Kartlarim list | Documents |
HasValidDocument |
Whether a character holds a valid document of a type | Kartlarim list | Documents |
AddDeed |
Give a deed (house, farm, shop, stable) | Kartlarim list | Deeds and keys |
RemoveDeed |
Delete a deed and its keys | Kartlarim list | Deeds and keys |
TransferDeed |
Give a deed to a new owner | Kartlarim list | Deeds and keys |
SetDeedTax |
Change the tax line on a deed | Kartlarim list | Deeds and keys |
GiveDeedKey |
Give a key holder access | Kartlarim list | Deeds and keys |
TakeDeedKey |
Take a key back | Kartlarim list | Deeds and keys |
GetDeedAccess |
Whether a character owns or holds a key to a deed | Kartlarim list | Deeds and keys |
GetDeeds |
Deeds a character owns | Kartlarim list | Deeds and keys |
BankAddTransaction |
Write a row into a character's bank history | any resource | Bank |
GetBankData |
A character's account number and extra accounts | any resource | Bank |
CreateInvoice (SendInvoice) |
Write a bill from a player | Billing list | Bills |
PayInvoice |
Pay a bill as a player | Billing list | Bills |
CancelInvoice |
Cancel a bill as its sender | Billing list | Bills |
CancelInvoices |
Cancel several bills | Billing list | Bills |
GetInvoices |
A page of a player's bills | Billing list | Bills |
GetInvoice |
One bill with its payments | Billing list | Bills |
GetInvoiceStats |
Totals of a player's bills | Billing list | Bills |
CheckUnpaidInvoices |
Whether a player has overdue unpaid bills | Billing list | Bills |
HelpCall |
Leave a help call for doctors on duty | any resource | Help calls |
SendGovernmentTelegram |
Send an official telegram to every mailbox | Telegram list | Telegram administration |
GetGovernmentTelegramStatus |
Progress of an official telegram | Telegram list | Telegram administration |
CancelGovernmentTelegram |
Stop an official telegram | Telegram list | Telegram administration |
InspectTelegramMailbox |
Read a mailbox's telegrams | Telegram list | Telegram administration |
ReassignTelegramAddress |
Change a mailbox's address | Telegram list | Telegram administration |
ForceCloseTelegramMailbox |
Close a personal mailbox | Telegram list | Telegram administration |
RegisterApplication |
Add server actions for your app | any resource | Custom app actions |
UnregisterApplication |
Remove your app's actions | owner only | Custom app actions |
ValidateApplicationPlayer |
Check a player again before a change | owner only | Custom app actions |
Names in brackets are the same function under another name.
#Access lists
Three groups of server exports read an allow list from a server-only config file. The lists do not behave the same way when they are empty.
| Group | Setting | Empty list means |
|---|---|---|
| Kartlarim | apps/kartlarim/config_server.lua > API.AllowedResources |
every resource may call |
| Billing | apps/billing/config_server.lua > API.AllowedResources |
no resource may call |
| Telegram | apps/telegram/config_server.lua > Administration.AllowedResources |
no resource may call |
Add a resource by its exact folder name:
luaAPI = { AllowedResources = { ['my-housing'] = true, ['my-licenses'] = true } }
A call from a resource that is not on a list answers false, 'forbidden' (Kartlarim) or a table with ok = false (Billing, Telegram).
#Owner-only exports
RemoveCustomApp, OpenApp, SendCustomAppMessage, UnregisterApplication and ValidateApplicationPlayer work only for the resource that registered the app. A call from another resource returns false.