Installation
- Added
- Updated
Download the dependencies
Download main resource
Place the REC_Books folder inside your server’s resources directory.
Import the SQL file
REC_Books does not create its own tables.
Copy rec_books.sql into REC_SQLRunner/server/sql/ and it runs when the server starts, or run it on your database yourself.
If REC_Books starts before the tables exist, it lists the missing tables in the console and refuses to create, open or save books. Restart REC_Books once the tables are there.
CREATE TABLE IF NOT EXISTS `rec_books_volumes` (
`id` bigint(8) NOT NULL AUTO_INCREMENT,
`uid` varchar(24) NOT NULL,
`ownerCitizenId` varchar(50) NOT NULL,
`authorName` varchar(64) NOT NULL DEFAULT '',
`title` varchar(64) NOT NULL DEFAULT '',
`status` varchar(16) NOT NULL DEFAULT 'draft',
`hidden` tinyint(4) NOT NULL DEFAULT 0,
`pageOrder` TEXT NOT NULL,
`orderRev` int(11) NOT NULL DEFAULT 0,
`bytes` int(11) NOT NULL DEFAULT 0,
`sealedAt` timestamp NULL DEFAULT NULL,
`lastOpenedAt` timestamp NULL DEFAULT NULL,
`updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`createdAt` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `uid` (`uid`),
KEY `ownerCitizenId` (`ownerCitizenId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `rec_books_surfaces` (
`id` bigint(8) NOT NULL AUTO_INCREMENT,
`bookUid` varchar(24) NOT NULL,
`surfaceId` varchar(16) NOT NULL,
`rev` int(11) NOT NULL DEFAULT 0,
`data` MEDIUMTEXT NOT NULL,
`bytes` int(11) NOT NULL DEFAULT 0,
`updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`createdAt` timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
UNIQUE KEY `bookSurface` (`bookUid`, `surfaceId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
Register the items
Add the two entries below to the existing return table in ox_inventory/data/items.lua.
Do not replace the file or add a second return statement.
The names must match config.items in config/sh_config.lua.
--[[
Definitions to append to ox_inventory/data/items.lua
(keep the names in sync with config.items, the images go to ox_inventory/web/images/)
consume = 0 on purpose: the server takes the blank book itself once the new book exists
]]
return {
['rec_book_blank'] = {
label = '白紙の本',
weight = 300,
stack = true,
close = true,
consume = 0,
description = '使うと自分だけの本を作れる。',
client = {
export = 'REC_Books.useBlankBook',
},
},
['rec_book'] = {
label = '本',
weight = 300,
stack = false,
close = true,
consume = 0,
description = '使うと開ける。',
client = {
export = 'REC_Books.useBook',
},
},
}
Copy rec_book_blank.png and rec_book.png from _install/images/ to ox_inventory/web/images/.
Check the web build
The screen is loaded from web/build/.
If that folder is missing (for example when you install from source), build it in web:
cd web
pnpm install
pnpm build
Copy and paste this on your server.cfg
# ox
ensure oxmysql
ensure ox_inventory
# RE:CORD
ensure REC_Books
Give yourself the ACE permission
The moderation commands are restricted to config.moderation.ace in config/sv_config.lua (group.admin by default).
lib.addCommand grants the ACE itself when the resource starts. If your server does not let it, add these lines yourself:
add_ace group.admin command.bookmod allow
add_ace group.admin command.bookhide allow
add_ace group.admin command.bookpurgeimages allow
add_ace group.admin command.bookunseal allow
Every moderation action by a player also checks command.bookmod, so staff need it even for the other three commands.
Done
enjoy it !
