Server Exports#
Open Book#
Opens a book for a specific player.
local success = exports['qs-book-creator']:openBook(source, bookUid)
Parameters
Parameter | Type | Description |
|---|---|---|
| number | Player server ID |
| string | number | Book UUID, or the numeric row id |
Returns
booleanReturns false if the book does not exist or has no readable content (no title, or no pages).
Use Book#
Item-use handler for ox_inventory. Declared in the item definition and never called manually.
server = { export = 'qs-book-creator.useBook' }
Any additional item you want to work as a book needs this same export.
Callbacks#
Client To Server#
Call them with lib.callback.await.
Callback | Parameters | Returns |
|---|---|---|
| — |
|
| — |
|
|
|
Example:
local book = lib.callback.await('book:getByUid', false, bookUid)
Legacy callbacks are kept for compatibility: book:createBook, book:updateBook, book:removeBook, book:getBookById.
Net Events#
Server To Client#
Event | Payload |
|---|---|
| Full |
|
|
|
|
|
mode is either create or edit, and decides how the creator opens.
Inventory Adapters#
How They Work#
Adapters live in server/custom/inventory/adapters/ and are open source (escrow_ignore). Each one excludes itself when Config.Inventory doesn't match.
Every adapter implements four functions:
Function | Purpose |
|---|---|
| Whether the inventory can store per-item metadata |
| Register the book item as usable |
| Write |
|
Adding A New Inventory#
Copy an existing adapter, change the guard clause at the top to match your inventory name, and implement the four functions against your inventory's API.
if Config.Inventory ~= 'my_inventory' then return endAdapters already ship for qs, ox, qb, origen, core, codem, tgiann, ak47, ak47_qb and standalone.
Data Structures#
Book#
{
unique_id = 'uuid-v4-string',
title = 'The Book Title',
author = 'Author Name',
description = 'A short synopsis',
cover_url = 'https://...',
pages = { ... },
item = 'book',
}Page#
{
"title": "Chapter I",
"subtitle": "The beginning",
"content": "Text...",
"image": "https://..."
}Integration Examples#
Open A Book From Another Resource#
Example: handing a quest document to a player.
exports['qs-book-creator']:openBook(source, 'a1b2c3d4-...')Register A Second Book Item#
Example: adding a diary item that behaves like a book on ox_inventory.
['diary'] = {
label = 'Diary',
weight = 200,
stack = false,
close = true,
consume = 0,
server = { export = 'qs-book-creator.useBook' },
},Check Creator Access#
local hasAccess = lib.callback.await('book:hasPermission', false)
if hasAccess then
-- Your custom logic here
end


