legacy-idcard
Installation
Dependencies and setup steps for legacy-idcard.
Installation
Dependencies
legacy-idcard requires the following resources to be installed and started before it:
legacy-lib— framework/inventory bridges, locale loading, version checkingox_lib— callbacks, notifications, utility functionsoxmysql— database access- An inventory resource compatible with the
useCardexport flow —ox_inventoryis what theuseCardexport is designed for (also referenced:qb-inventoryorqs-inventoryas alternatives, thoughuseCard's signature matches ox_inventory's item-use contract) - Optional:
MugShotBase64— enables mugshot capture (legacy-idcard:captureMugshot). Without it, mugshots are simply not captured. - Optional:
legacy-cityhall— if present, card status changes are synced to itscityhall_documentstable.
Steps
-
Import the database schema.
mysql -u your_user -p your_database < sql/schema.sqlThis creates
legacy_card_typesandlegacy_player_cards, and seeds four default card types:id_card,driver_license,weaponlicense,hunting_license.⚠️ This script DROPs both tables if they already exist. Never re-run it against a live server without a backup — you will lose all issued cards and custom card types.
-
Add matching inventory item definitions. For every card type (including the four seeded defaults and any you create later in the admin panel), add an item definition to your inventory system that routes to the
useCardexport:-- ox_inventory/data/items.lua ['id_card'] = { label = 'Identity Card', weight = 0, stack = false, consume = 0, server = { export = 'legacy-idcard.useCard', }, },The item name must match the card type's
namecolumn exactly, andconsumemust be0. The admin panel provides a copy-to-clipboard button with this exact snippet for any card type you create through/idadmin— creating a card type in the panel does not create the item automatically. -
Set resource start order. Ensure
legacy-idcardstarts afterlegacy-lib,ox_lib,oxmysql, and your inventory resource, e.g. inserver.cfg:ensure legacy-lib ensure ox_lib ensure oxmysql ensure ox_inventory ensure legacy-idcard -
(Optional) Cityhall integration. If you run
legacy-cityhall, setConfig.DocumentProvider = 'legacy_idcard'in that resource's config file (not in legacy-idcard itself) to enable status syncing. -
(Web UI developers only) The admin panel is a React/Vite project under
web/. If you need to modify it:cd web npm install npm run buildnpm run buildproducesweb/dist, which is what the in-game NUI actually loads.npm run dev/npm run previeware available for local development, but editingweb/srcalone has no effect in-game until you runnpm run build.