legacy-idcard
Overview
What legacy-idcard does and how it fits together.
legacy-idcard
legacy-idcard is a database-backed ID card and license system. Players use physical inventory items (ID card, driver's license, weapon license, hunting license, or any custom type created by admins) to display a styled card UI to nearby players. Police can look up, report, or revoke cards by serial number through a dedicated NUI panel, and server admins get a full React-based admin panel (/idadmin) for managing card types and issued player cards.
Key features
- Realistic card display — using an item triggers
legacy-idcard:showCardon the closest nearby player (or the user themselves), rendering a themed card with mugshot, name, DOB, sex, nationality, and citizen ID (each field toggleable per card type). - Serial number system — every issued card gets a unique serial number that can be looked up, reported as lost/stolen, or revoked by police via NUI (
legacy-idcard:lookupSerial,legacy-idcard:reportCard,legacy-idcard:revokeBySerial). - Admin panel —
/idadminopens a React/Vite-built NUI panel for creating, editing, and deleting card types, and for searching players and revoking their cards. - Exports for integration — other resources can issue, revoke, and query cards programmatically via
IssueCard,RevokeCard,HasCard, andGetPlayerCards. - Discord webhook logging — card issuance, revocation, and card-type creation/deletion can be logged to Discord.
- Optional cityhall sync — card status changes are mirrored into a
cityhall_documentstable if thelegacy-cityhallresource's schema is present.
Architecture
- Database-backed, not config-backed: card types live entirely in the
legacy_card_typestable and issued cards inlegacy_player_cards. There are no hardcoded card types inconfig.lua— everything is managed through the admin panel or direct SQL/exports. server/init.luawires up thelegacy-libFramework/Inventory bridges, locale loading, admin permission checks, serial number generation, and theCardTypescache (loaded asynchronously from the database on startup).server/server.luaimplements theuseCardox_inventory export, the internal item-used flow, the public card exports, and police lookup callbacks.server/admin.luaimplements the admin-only CRUD callbacks backing the/idadminpanel.client/client.luahandles NUI display, the show-ID animation, and the admin/lookup panel bridges.web/is a separate React/Vite project that must be built toweb/distfor the NUI panels to load in-game.
See Installation for setup steps, Configuration for tunable options, and Integration for exports/events you can call from your own resources.