# UK Plate Project

<figure><img src="/files/B4ojMV6h8nlJroEFbZi5" alt=""><figcaption></figcaption></figure>

This resource by **BNT Modding** does two independent things to vehicles:

1. Replaces the physical plate texture with a custom British-style plate graphic
2. Rewrites the plate text on eligible vehicles to match the UK registration format

These two systems are entirely separate and can function without each other.

***

### How It Works

#### Part 1 — UK Plate Models

The main function of this script is to replace base game traffic with UK plate models to enhance the realism of your server. This is done through the script streaming in 50+ replacement vehicle models and using a shared texture dictionary which contains the updated textures. This is the background texture applied to the licence plate mesh on every vehicle in the game.

This is a **visual-only, client-side change** — it affects how the plate looks (fonts, background, colours, badge) but has no effect on the plate text itself.

#### Part 2 — UK Plate Text Generation

Every 500 ms, the script loops through all vehicles currently loaded in the game world. For each vehicle it checks two conditions:

* The plate text contains **no spaces**
* The vehicle's model spawncode is **in the whitelist** (if the whitelist is enabled)

If both conditions pass, the plate text is overwritten with a randomly generated plate in the **current UK registration format**:

| Part      | Example | Meaning                     |
| --------- | ------- | --------------------------- |
| 2 letters | `LA`    | DVLA memory tag (area code) |
| 2 digits  | `06`    | Year of registration        |
| Space     |         | Separator                   |
| 3 letters | `ABC`   | Random sequence             |

Example output: `LA06 ABC`, `LX23 TRV`, `LM17 JKN`

Once a plate has been set by this script it will contain a space, so the script will never overwrite it again.

***

### Garage Scripts

If your server is using garage scripts that store vehicles based on their license plate then, there are some factors you must be aware of. Because, this script changes the plates of vehicles once they have spawned, if a vehicle with the license plate of `LMTY` is pulled out of a garage system - the script will spot that it has no spaces (and hence, doesn't follow the UK format) and edit the plate to the format listed in the previous section. This vehicle can then not be returned to the garage as the license plate no longer matches the original.

There are 2 methods to get around this issue:

#### Fix 1: Enable Whitelist

With our new whitelist feature - found in `config.lua` - you can enable the whitelist so that only certain vehicles will have their plate text changed. For example, only the vehicles with the UK plate model. All of our provided vehicles are listed in the whitelist already. But, you can add as many vehicles as you wish to this system.

#### Fix 2: Ensure all Plates Include a Space

This is the best fix for new servers or servers that have not yet introduced a garage system into the server. Our script causes no issues if there are no saved vehicles in a garage system - any vehicle purchased or spawned will automatically be assigned a UK format plate and when added to the garage system - this will be the assigned plate (and will no longer be changed by the script).

> As our script only checks that their is a single space in a plate. This allows servers to still provide/sell personalised plates such as `ILUV RP` . Although this plate doesn't match the UK plate format - it still includes a space and is hence unchanged by the script.

***

### The Difference Between Streamed Models and Plate Text

This is the most important distinction to understand when configuring the resource.

|                                  | Streamed Models                                                        | Plate Text Generation                                                                            |
| -------------------------------- | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| **What it changes**              | The vehicle's 3D model and textures                                    | The text shown on the plate                                                                      |
| **Where it's configured**        | Files in `stream/` folder                                              | `Config.Whitelist` in `client/config.lua`                                                        |
| **How it works**                 | FiveM streams replacement `.yft`/`.ytd` files to clients automatically | A Lua loop rewrites the plate text at runtime                                                    |
| **What controls it**             | Presence of files in `stream/vehiclename/`                             | `Config.UseWhitelist` and `Config.Whitelist`                                                     |
| **Requires a restart to change** | Yes — adding/removing stream files                                     | No — changes to the whitelist take effect on resource restart only, but no server restart needed |

**Example:** The vehicle `fusilade` has a streamed `.ytd` in this resource (custom textures) but its plate text will also be rewritten by the Lua script because `fusilade` is in `Config.Whitelist`. Both systems apply independently — you could stream a custom model for a vehicle without changing its plate text, or change its plate text without streaming a replacement model.

***

### Configuration

All user-facing options live in `client/config.lua`.

#### `Config.UseWhitelist`

```lua
Config.UseWhitelist = true
```

| Value   | Behaviour                                                                                             |
| ------- | ----------------------------------------------------------------------------------------------------- |
| `true`  | Only vehicles whose spawncode is listed in `Config.Whitelist` will have their plate text changed      |
| `false` | **Every** vehicle in the game world without a space in its plate will be changed, regardless of model |

Setting this to `false` effectively makes the script a server-wide plate formatter for all traffic.

#### `Config.Whitelist`

```lua
Config.Whitelist = {
    'felon',
    'sultan2',
    -- etc.
}
```

A plain array of vehicle spawncode strings. Only used when `Config.UseWhitelist = true`. Spawncodes are the internal model names used by the game (the same names used in `/car` commands or `SpawnVehicle` calls).

To add a vehicle, append its spawncode to the list. To remove one, delete its entry. Spawncodes are **not** case-sensitive at runtime (the script uses `GetHashKey` internally) but lowercase is conventional.

***

### File Structure

```
BNT_PlateProject/
├── client/
│   ├── config.lua          -- Whitelist toggle and vehicle list
│   └── client.lua          -- Texture replacement + plate text logic
├── stream/
│   ├── my_plates.ytd       -- Custom plate texture (applied globally)
│   └── <vehiclename>/      -- Per-vehicle model/texture replacements
│       ├── vehicle.yft
│       ├── vehicle.ytd
│       └── vehicle_hi.yft
├── popgroups.ymt           -- Population group definitions
└── fxmanifest.lua          -- Resource manifest
```

***

### Installation

1. Drop the `BNT_PlateProject` folder into your server's `resources` directory
2. Add `ensure BNT_PlateProject` to your `server.cfg`
3. Configure `client/config.lua` as needed
4. Restart the resource or reboot the server

***

### Notes

* The texture replacement and plate text changes are **client-side only**. Other players will see the changes only if they also have this resource running.
* Plates are only changed once per vehicle entity. After a space is present, the script leaves the plate alone.
* If you are using a garage script that stores plate text as a vehicle identifier, please refer to the 2 workarounds listed earlier in this page


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bnt-modding.gitbook.io/support-hub/our-products/scripts/uk-plate-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
