Skip to content

mi-documents

mi-documents is an in character paperwork tablet: players create documents from job templates, keep their own copies, and hand signed copies to nearby players. It is a React rewrite of qbx_documents on qbx_core, DB-cached for large servers.

Install

ensure mi-documents

Needs OneSync enabled on the server. It ships server/migrate.lua, so tables auto-create on first boot, no manual SQL import.

Config

local Config = {
    command          = 'docs',    -- chat command that opens the tablet
    keybind          = nil,       -- optional key mapping, e.g. 'F8'
    documentItemName = nil,       -- optional inventory item that opens it, e.g. 'wallet'

    maxGiveDistance  = 3.0,       -- max metres to hand a copy to another player

    rateLimit = {
        read  = { 30, 10000 },    -- templates, lists, body fetches (count, window ms)
        write = { 8,  10000 },    -- create, edit, delete, give, show
    },

    cache = {
        templatesTtl = 120000,    -- templates change rarely
        docsTtl      = 60000,     -- per-player list view
        bodyTtl      = 600000,    -- doc body is effectively immutable
    },

    jobLabels = {                 -- pretty names shown for issuer jobs
        ambulance  = 'Alta Hospital',
        ambulance2 = 'Roxwood Hospital',
    },

    paperProp = {                 -- prop used in the show-document animation
        name = 'prop_cd_paper_pile1',
        xRot = -130.0, yRot = -50.0, zRot = 0.0,
    },

    theme   = require 'shared.config.theme',    -- UI palette (5 presets in theme.lua)
    jobDocs = require 'shared.config.jobdocs',  -- per-job document templates
}

Exports

Export Signature What it does
CreateDocument exports['mi-documents']:CreateDocument(opts) Server-side. Issue a document to a player. opts.target is a server id or citizenid, opts.name is required; optional recipient, issuer, fields, description, validUntil, isCopy. Returns { success = true, id = number } or { success = false, error = string }.

Commands

Command Access Does
/docs everyone open the document tablet (name set by Config.command)