Start
Installation
Install FX Pocketbook: the three resources, the start order, the optional fx-radio, the database, the items, the health check and the commands.
#1. Copy the three resources
Put all three folders in resources/:
| Folder | Keep this name because |
|---|---|
fx-pocketbook |
Other resources call exports['fx-pocketbook'], and the assets resource is found by this name plus -assets |
fx-pocketbook-assets |
The interface loads pictures and sounds from https://cfx-nui-fx-pocketbook-assets/.... It must be named <notebook resource name>-assets |
fx-pocketbook-anims |
The holding and writing animations are loaded from a resource with this name |
fx-pocketbook-assets holds the large images, the sounds and the streamed models of the 15 notebooks. It is kept apart so that a code update of fx-pocketbook does not make players download them again.
#2. Start order
The manifest of fx-pocketbook lists oxmysql, fx-pocketbook-assets and fx-pocketbook-anims as dependencies: the notebook does not start without all three. Start the notebook after the database, the framework and the inventory:
cfgensure oxmysql
ensure vorp_core
ensure vorp_inventory
ensure fx-pocketbook-assets
ensure fx-pocketbook-anims
ensure fx-pocketbook
On RSG write rsg-core and rsg-inventory in place of vorp_core and vorp_inventory.
Start your bank and stable scripts (vorp_banking, rsg-banking, gum_stables, vorp_stables, rsg-horses, rsg-wagons) before fx-pocketbook as well: the adapters check whether they are started.
The holding and writing animations (fx_phone@base, fx_phone@female, fx_phone_write@base, fx_phone_write@female) are loaded from a resource named fx-pocketbook-anims. If they cannot be loaded, the client console prints holding: writing animation ... could not be loaded (is fx-pocketbook-anims started?).
#The back radio (optional)
The back radio set is a separate resource, fx-radio (voice channels on pma-voice). The notebook does not need it: without it, signal comes from towns and relay poles. With it started, a worn radio with a charged battery gives the book signal anywhere, and the notebook store also sells the radio, its battery and its charger. The notebook notices when fx-radio starts or stops, so it can be started before or after fx-pocketbook. Its own installation is in the fx-radio documentation.
#3. Framework
luaConfig.Framework = 'auto' -- auto | vorp | rsg
'auto' picks VORP when vorp_core is started and RSG when rsg-core is started. If both are started nothing is picked and you must write 'vorp' or 'rsg'.
On RSG, Config.MoneyAccount may be 'cash' or 'bank'. On VORP only 'cash' works for the book's own money moves; pocketbook_health warns about any other value.
#4. Database
You do not import any SQL by hand. All tables are in one file, sql/install.sql. On every start server/database.lua does this:
- Creates
fx_pocketbook_metaif it is missing and reads the hash of the last clean run. - If
sql/install.sqlhas not changed since then and every table of the file exists, it stops there. The console printsdatabase ready in N ms (schema unchanged, setup skipped). If a table is missing, it printsN table(s) missing; creating them. - If the file changed or a table is missing, it runs every statement of the file. They are
CREATE TABLE IF NOT EXISTS,ALTER TABLE ... ADD COLUMN IF NOT EXISTSandINSERT IGNORE, so existing tables and rows are never changed or deleted. - If every statement worked, it saves the new hash. If one failed, it prints
Database setup error: ...for each, thenDatabase setup finished with N error(s). Run pocketbook_health., and runs the file again on the next start.
It works on MariaDB and MySQL 8. MySQL 8 does not know ADD COLUMN IF NOT EXISTS, so the script looks each such column up itself and adds it only when it is missing.
Other server scripts of the notebook wait until this has finished before they query the database.
You never need to import sql/install.sql by hand. If you do it anyway, on RSG delete the INSERT IGNORE INTO items block from the file first: that block is for VORP's items table. On MySQL 8 the ALTER TABLE ... ADD COLUMN IF NOT EXISTS lines may give errors in a hand import; the automatic setup handles them.
The setup creates 94 fx_pocketbook_* tables plus fx_pocketbook_meta.
#5. Items
#VORP
The items are added to VORP's items table automatically by the same database step, with INSERT IGNORE. This happens when vorp_core is installed, Config.Framework is not 'rsg', and in 'auto' mode rsg-core is not started. After items were added the console prints:
cfg[fx-pocketbook] 25 item(s) added to VORP. Restart the server once so vorp_inventory loads them.
Restart the server once. If the insert fails, the console prints VORP items could not be added automatically; add them from sql/install.sql.
#RSG
Nothing is added on RSG. Add the items to rsg-core/shared/items.lua. The list of every item, with the lines to paste, is on Items.
#Item images
Copy the PNGs from fx-pocketbook/setup/inventoryitem-images/ (200x200, no background) into your inventory's image folder:
| Inventory | Folder |
|---|---|
| vorp_inventory | vorp_inventory/html/img/items/ |
| rsg-inventory | rsg-inventory/html/images/ |
The file name is the item name: pocketbook.png, pocketbook_<colour>.png for each colour, pocketbook_relay.png, pocketbook_phonograph.png and so on. The radio images come with fx-radio.
#6. Check the installation
Type in the server console:
cfgpocketbook_health
It is a read-only check. It does not move items or money. It reports:
| Key | What is checked |
|---|---|
framework |
Exactly one framework is selected by Config.Framework and running |
inventory |
vorp_inventory or rsg-inventory is started |
money |
Config.MoneyAccount is 'cash' on VORP, 'cash' or 'bank' on RSG |
music |
The phonograph data has loaded |
relays |
The relay pole data has loaded |
action |
The core app actions are registered (telegram.send, telegram.profile, music.shareResolve, company.dashboard, billing.list, atlas.load, album.list) |
database |
oxmysql is started and the information schema can be read |
treasury |
The business till bindings in apps/company/config_server.lua can be verified |
table |
Every fx_pocketbook_* table exists |
column |
Every expected column exists |
engine |
Every table is InnoDB |
The first line gives the result, the selected framework and how many tables and columns were checked. Then one line per problem, as [fx-pocketbook] <key>: <message>. The last line reminds you that this is not a game test: items, money and the network are not tried.
The command can run once every 10 seconds. In game it needs the ACE permission command.pocketbook_health.
#Opening the notebook
A player opens the book by using a notebook item or by pressing F1 (Config.OpenMenuKey). With Config.Access.RequireItem = true, a notebook item in the inventory is needed in both cases. See config.lua.
#Player commands
| Command | Setting | What it does |
|---|---|---|
/pocketbook |
Config.Command |
Opens and closes the book. Registered only when Config.MenuOpenMode is 'command' or 'both' |
/pocketbird |
Config.Telegram.Birds.WhistleCommand |
Calls your mail bird, like the birdwhistle item. '' removes the command |
/yardim [text] |
Config.MDT.Doctor.Calls.Command |
Leaves a help call that on-duty doctors see in the Official Ledger. '' removes the command |
#Admin and console commands
These are restricted commands. The server console can always run them; a player needs the ACE permission command.<name>.
| Command | What it does |
|---|---|
pocketbook_health |
Installation check, see above |
pocketbook_remove_relay <id> |
Deletes a relay pole (fx_pocketbook_relays.id). No item is given back |
pocketbook_retry_log <id> |
Puts a log row whose Discord delivery failed back in the queue |
pocketbook_hold |
In game. Opens the fx-toolbag tool to place the notebook in the hand, and the notebook and pencil while writing. Saving writes holding.json for everybody and needs command.pocketbook_hold. Name set by Config.Holding.TuneCommand |
pocketbook_broadcast <template> <nonce> |
Sends a predefined government telegram from BroadcastTemplates in apps/telegram/config_server.lua to every mailbox. The nonce is 16 to 64 letters, digits or -; sending the same nonce again does not send twice |
pocketbook_broadcast_status <id> |
Prints the state of a broadcast |
pocketbook_broadcast_cancel <id> |
Cancels the remaining delivery of a broadcast |
pocketbook_close_mailbox <address> <mailbox id> <nonce> <reason> |
Closes a telegraph mailbox. The reason needs at least 8 characters. Correspondence is kept |
pocketbook_resolve_*, pocketbook_bank_resolve |
Close an operation the book held for an admin. See Troubleshooting |
#Other ACE permissions
| Permission | What it allows |
|---|---|
pocketbook.news.moderate |
Moderating the Gazette. The name is Config.News.ModeratorAce |
fx-pocketbook.postmaster |
Moderating the telegraph notice board, on top of Config.Telegram.Board.ModeratorJobs |
cfgadd_ace group.admin command.pocketbook_health allow
add_ace group.admin command.pocketbook_remove_relay allow
add_ace group.admin pocketbook.news.moderate allow
add_ace group.admin fx-pocketbook.postmaster allow