# Plate Change

A robust and framework-integrated **plate changing system** that allows players to customize license plates using a command or item — with full validation, ownership checks, blacklist filtering, and server-side persistence.

***

### Features

* Supports **command** (`/setplate`) and **usable item** (e.g. `customplate`)
* Framework-aware: checks ownership via player jobs and `citizenid`
* Validates new plates:
  * Length (min/max)
  * Illegal characters (based on configurable regex)
  * Blacklisted words
  * Prevents reusing plates already taken
* Optionally requires specific job to use (item or command)
* Transfers:
  * Vehicle status
  * NOS level and colors
  * Xenon colors
  * Trunk/glovebox inventories (QBCore support)
* Vehicle is updated live and player receives new keys

***

### How It Works

### Client Side

* Players trigger the menu via:
  * `/setplate` (command)
  * Using an item (e.g. `customplate`)
* Nearby vehicle is checked for:
  * Ownership
  * Not parked/hard-locked
* Menu asks for a new plate input (up to 8 characters)
* Validation runs:
  * Length limits
  * Allowed characters via `Config.PlateChange.Filter`
  * Phrase blacklist
  * Already-in-use check
* If valid:
  * Server receives plate change request
  * Progress animations (clipboard prop) play during the process

### Server Side

* Checks if:
  * New plate is available (not already used)
  * Vehicle owner is online (to prevent offline abuse)
* Changes plate in the database and on the entity
* Transfers:
  * `VehicleStatus` from old plate to new
  * NOS data (`VehicleNitrous`, `nosColour`)
  * Trunk/glovebox inventories (for QBCore if QBX not active)
* Gives updated vehicle keys to the owner

***

### Security and Validation

* Vehicle ownership checks using `citizenid`
* Hard-parked vehicles are blocked (with jim-parking)
* New plate cannot be set if owner is offline
* Blacklisted words and illegal characters are rejected

***

### Notes

* Configurable via `Config.PlateChange`:
  * Job/item restrictions
  * Allowed characters (`Filter`)
  * Min/Max character length
  * Phrase blacklist
* Works with QBCore, QBOX, OX\_Core (ESX-safe)
* Uses statebags and local caching for `VehicleStatus` updates
* Compatible with custom mod handling and Nos integrations

***
