Skip to main content
Civilian Registration makes character creation from in-game simple. For standalone (menu) based servers, a registration window with your custom character record form is shown with a single button to generate a character selfie. For framework servers with DB sync, this submodule syncs in-game selfies/mugshots to the existing automatic character records.

Activation Guide

  1. Download and Install the Resource

This submodule is already enabled by default when installing the Sonoran CAD FiveM resource.

  1. Configure the Submodule

Open sonorancad/configuration/civreg_config.lua. Keep enabled = true and templateId = 7 for civilian character registration.

  1. Optional: Configure Database Sync Mode

If both Database Sync and its Character mapping are enabled in CAD, CivReg uses database mode automatically. Run the database sync AI configuration tool after starting the civilian registration submodule. This will automatically map any image field in your character record to the newly generated sonoran_mugshot database column.
On every start in database mode, CivReg runs ADD COLUMN IF NOT EXISTS to add a nullable sonoran_mugshot MEDIUMTEXT column. MEDIUMTEXT is required because a base64 portrait can exceed the 65,535-byte capacity of MySQL TEXT.The standard database targets are:
In database mode, CivReg does not create a second character through the CAD API. If CivReg cannot prepare portrait storage in your database, portrait updates stop and the server reports ERR-CR-106.
If your framework uses a customized table or character ID column, update databaseSync.qbCore or databaseSync.esx in civreg_config.lua. Keep the portrait column named sonoran_mugshot, then use that column in the CAD field mapping.

  1. (Optional) Customize Your Character Template

In CAD, open Admin > Customization > Custom Records and review the civilian character template. See Creating Custom Record and Report Types for editing fields and sections. Add an editable Image field if players should attach a selfie, and make that field required if a portrait is mandatory. In your database sync mapping configuration, the image field must be mapped to the sonoran_mugshot column that the CivReg plugin will automatically add to your players table. The database sync AI configuration tool will set this up for you automatically. In standalone mode, templates are cached for 60 seconds by default. After saving a template change, allow the cache to expire, then close and reopen /civreg to load the updated form. An already-open form does not refresh automatically.

  1. (Optional) Configure Optional Autofill and Portrait Uploads

For identity autofill, follow Framework Autofill. For templates with image fields, review Portrait Uploads and the image size limit.

Player Guide

Standalone Mode

  1. Run /civreg, or your server’s configured registration command.
  2. Fill out the character record form. Click on any image fields to take an automatic selfie.
  3. Select Register Character to create the record. Users can optionally use /link in-game to assign the character to their CAD account in the civilian panel.
In standalone mode, finish loading your character and any appearance changes, then click an image field to take a fresh selfie. Avoid changing characters or clothing while the photo is being taken. If the capture fails, wait until your appearance has finished loading and click the image field again.The portrait shows your character without masks, hats, glasses, ear accessories, or neck accessories. Those items stay on your in-game character; you do not need to remove or re-equip them for the photo.Character Photo section with the Click to take a selfie control above Cancel and Register CharacterScroll to an image field and select Click to take a selfie to capture your current in-game character.

Framework Autofill

Autofill is optional. Players can complete the registration form without a framework. To prefill supported identity values:
  1. Configure and enable Framework Support (ESX/QBCore).
  2. Start the supported framework before Sonoran CAD and set usingQBCore appropriately in frameworksupport_config.lua.
  3. Match autofillFieldIds in civreg_config.lua to your character template’s Field Mapping ID values.
  4. Restart Sonoran CAD and open a new registration form while playing a loaded framework character.
The left-hand keys describe the identity values supplied by the framework. The right-hand strings identify the destination fields in CAD:
For example, if your first-name field has the custom Field Mapping ID givenName, change only that entry to first = "givenName". These mappings control autofill; they do not create or rename template fields.Only values supplied by the framework and mapped to an existing template field are prefilled. Missing values leave the template’s default or an empty field for the player to complete. Prefilled fields remain editable unless marked read-only in CAD. These autofill settings apply to the API-mode form. Database mode updates only the sonoran_mugshot column; your existing CAD DB Sync mappings supply the remaining character fields.

Database Sync Mode

If your community has database sync enabled for civilian records, the CivReg submodule will automatically switch into database sync mode on startup.
  1. Select the character you want to play in QBCore or ESX and finish spawning into the server.
  2. Allow the character’s face, clothing, and accessories to finish loading. CivReg waits for 10 seconds with no appearance changes before taking a fresh portrait. Clothing changes during this wait restart it, so the photo may take longer than 10 seconds after joining.
  3. The portrait is saved to that framework character’s database record for CAD to display through your existing DB Sync image mapping.
The portrait excludes masks, hats, glasses, ear accessories, and neck accessories while leaving those items on your in-game character. If you switch characters or change your appearance during capture, the new photo is discarded and the previously saved portrait is kept.You do not need to run /civreg in this mode; it displays a reminder that registration and portraits are automatic. Selecting a character on the CAD civilian page does not take a new portrait. To retry an automatic capture, reselect the character in your server’s character menu and let it fully load again.

Portrait Uploads

Portraits are saved directly with the character data. You do not need to set up a public image address or host the photos separately. The default maximum photo size is 1 MiB; if a photo is rejected, retake it and review the displayed error with your server administrator.

Configuration Reference

Edit sonorancad/configuration/civreg_config.lua and restart the resource after changes.

Troubleshooting