Skip to content

Installation

Install Cuxial License step by step: dependencies, screencapture, the studio map, items, database, convars and start order.

Cuxial License ships as two resources, the script and its photo studio map. It needs screencapture for the photos, a few inventory items and one convar, and creates its own database tables on start.

Check the dependencies ​

These resources must be installed and working before you add the script:

  • ox_lib
  • oxmysql
  • cuxial_bridge, with QBox or QBCore
  • ox_inventory, to use the cards as items
  • screencapture (next step)

Optional:

  • cuxial_interactions: the office NPC talks with a dialog (greeting, how it works). Without it, the NPC has a target option that opens the store, through a target resource supported by the bridge (sleepless_interact, ox_target or qb-target).
  • cuxial_police: the card shown carries the wanted and dangerous marks of the character.
  • av_weather: drives the time-of-day selector of the photo session and, with prim_climatime as an alternative, the clock of the office hours.

Install screencapture ​

screencapture is a free, open-source resource that takes a screenshot of a player's game. Cuxial License uses it for the photo printed on each card, and will not start without it.

  1. Download the latest release from github.com/itschip/screencapture. Take the packaged release, not the source code: the resource must contain the game/dist folder.
  2. Place the folder in your resources directory and keep its name as screencapture.
  3. Start it before Cuxial License.

screencapture declares itself as a replacement for screenshot-basic, so resources that depend on that one keep working with it. It runs on Node 22: use a recent server artifact.

Copy the resources ​

The package contains two folders. Place both inside your resources directory:

FolderWhat it is
cuxial_licenseThe script
cuxial_license_mapThe green-screen studio where photos are taken

Keep the folder name cuxial_license. The inventory items call the script by that exact name and stop working if you rename it. If you rename cuxial_license_map, set the new name in photo.mapResource.

Database ​

Nothing to import. On start the resource creates its six tables and brings older ones up to date:

TableHolds
cuxial_cardsCard designs
cuxial_issuedIssued documents
cuxial_license_settingsSettings edited in the panel
cuxial_license_officesOffices
cuxial_license_templatesDesign templates
cuxial_license_auditLog of staff actions

If your database user cannot create or alter tables, run sql/install.sql by hand once.

Updating from 2.x. Back up the database, then replace the resource folder. The resource applies sql/migrate_2_1_0.sql, migrate_2_2_0.sql and migrate_3_0_0.sql on its own; they are included to run by hand if your user lacks permissions, in that order. Cards made in 2.x keep working and show a Convert to v3 button in the designer to edit them by layers. The config file changed shape: start from the new shared/config.lua and copy your values into it (authorizedJobs is now jobs.authorized, revokeJobs is jobs.revoke, paymentType is payment.account, theme.color is ui.accent, and the offices moved to data/offices.lua).

Add the items ​

Add the items you use to ox_inventory/data/items.lua. Every document and badge item uses useLicenseCard.

ox_inventory/data/items.lua
lua
['id_card'] = {
    label = 'ID card',
    weight = 5,
    stack = false,
    close = true,
    consume = 0,
    description = 'Identity document',
    client = { export = 'cuxial_license.useLicenseCard' },
},
ItemWhen you need it
id_cardAlways. It is the default item (issuing.defaultItem) and the one of the ID card created on first start (issuing.defaultIdCard). Add it before starting the script.
Badge itemsOne per faction in documents.badges. The example file uses licencia_policial, ems_badge and fib_badge; rename them to yours.
Any item name typed in the designerEach one needs its own definition with useLicenseCard. The designer checks it and shows the block ready to copy.
fake_idOnly with fakeId.enabled = true. Uses export = 'cuxial_license.useFakeId'.
job_badge, worker_idOnly if another resource of yours hands them out (see Exports & events). They use useJobBadge and useWorkerId.
ox_inventory/data/items.lua
lua
['fake_id'] = {
    label = 'ID card',
    weight = 5,
    stack = false,
    close = true,
    consume = 0,
    client = { export = 'cuxial_license.useFakeId' },
},

stack = false is required. Every card stores its own data, so two cards can never share a slot.

Item images are not included. Add your own to ox_inventory/web/images/ with the item name (id_card.png, fake_id.png…).

Set the convars ​

server.cfg
cfg
# Fivemanage token used to store the photos
set cuxial:fivemanageToken "YOUR_FIVEMANAGE_TOKEN"

# Language (en and es are included)
setr ox:locale "en"

The photo is uploaded to your Fivemanage account and the card keeps its link. Without a token the photo session still opens, but the upload fails and the card is issued without a photo.

The photo is uploaded from the server. Write the token with set, not setr: it stays on the server and is never sent to the players.

Start the resources ​

Start them after their dependencies, your framework and your inventory:

server.cfg
cfg
ensure ox_lib
ensure oxmysql
# your framework here (qbx_core or qb-core)
ensure ox_inventory
ensure ox_target
ensure cuxial_bridge
ensure screencapture
# optional
ensure cuxial_interactions
ensure cuxial_police
ensure cuxial_license_map
ensure cuxial_license

Replace the framework and target lines with the ones your server uses.

Check that it works ​

  1. The server console shows the factory ID card and the factory offices being installed on the first start.
  2. Join with an account that has the admin permission of your framework and type /license. The panel opens.
  3. Go to the city hall office (see Offices in the panel) and buy the ID card. The photo studio opens.
  4. Capture, sign and submit. The item appears in your inventory.
  5. Use the item. The card shows on screen with your photo; G flips it and E puts it away.

Next: set the jobs, badges, offices and studio in Configuration.

© Cuxial