# Radar

[**Buy Here**](https://codesign.pro/product/5155713)

[**FiveM Forums Post**](https://forum.cfx.re/t/paid-codesign-police-alpr-radar/4891890?u=codesign)

[**YouTube Showcase Video**](https://www.youtube.com/watch?v=ESLlIdzzelc)

This resource can be purchased as part of a bundle for a discount [here](https://codesign.pro/package/5162629).

#### Translate

* [Click here to translate this page.](https://docs-codesign-pro.translate.goog/paid-scripts/radar?_x_tr_sl=en&_x_tr_tl=es&_x_tr_hl=en-GB&_x_tr_pto=nui)
* [How do I change language?](https://gyazo.com/38606313ac9a7c290dc2c72b6793bde6)

## INSTALLATION GUIDE

### Step 0 - First Steps

{% hint style="warning" %}
**1.** Download your resource from [FiveM’s Keymaster](https://keymaster.fivem.net/asset-grants). &#x20;

**2.** Unzip the `cd_radar.zip` folder and place this folder in your server's resource folder.

**3.** Add the resource to your server start config (server.cfg): `ensure cd_radar`. If you are using a framework, it must be placed anywhere below your framework resource e.g., es\_extended, not above.

```
ensure es_extended
ensure cd_radar
```

{% endhint %}

### Step 1 - Fxmanifest

{% hint style="warning" %}
Depending on your framework and dependencies, you may need to make some changes inside the **`[cd_radar/fxmanifest.lua]`**. We have made this easier by [commenting ](https://i.imgur.com/bbb0dam.png)on the lines you possibly need to change.
{% endhint %}

### Step 2 - Configure Resource

{% hint style="warning" %}
You **MUST** read all configurable options inside the **`[cd_radar/configs/config.lua]`** file and configure them to suit your server's needs. Please read the [”commented out help text”](https://i.imgur.com/QCja8UZ.png) at the end of each line so you can understand what each config option does.

**The most important sections are the options under the** [**Framework** ](https://i.imgur.com/4ukCTZr.png)**and** [**Important** ](https://i.imgur.com/IVm7E8l.png)**sections at the top of the `config.lua`. Everything else is optional.**

> [**NEW: Auto Framework Detect!**](https://i.imgur.com/zNW8Kpg.png)
>
> Introducing our new 'auto\_detect' feature! It automatically identifies your framework and SQL database resource, and applies the appropriate default settings.
> {% endhint %}

### Step 3 - Configure Key Binds

{% hint style="warning" %}
Before starting this resource on your main/live server, we highly advise configuring your key binds because this resource uses [Fivem's Key Mapping](https://docs.codesign.pro/helpful-guides/register-key-mapping).

**Where can I configure my key binds?**

You can configure key binds in the [Keys and Commands](https://i.imgur.com/bTvuXLZ.png) section near the bottom of the **`[cd_radar/configs/config.lua]`**.

> **Why do I need to do this?**
>
> Well long story short;- once a player has joined your server with this resource running you can no longer force change their key binds for this resource through the config.lua, only they can change it in the in-game [pause menu settings](https://imgur.com/GRWKelR). Although it will change for the players who join after you have changed it.
>
> The benefit of this system is that it's much more optimised and players can easily change their key binds on keyboards or controllers. You can also check out the [Default Keybinds](#default-keybinds) for this resource.
> {% endhint %}

##

## OPTIONAL FEATURES

This section is to help you understand how the built-in features of this resource work, and if applicable, how you can make them compatible with other resources. These features are not required, they are optional and can be configured in the `[configs/config.lua]`.

### Vehicles Data

> **What is Vehicles Data used for?**
>
> When using ESX or QBCore we take information that most servers will already have stored to get the vehicles to display names of custom vehicles.

{% tabs %}
{% tab title="ESX" %}
On ESX we will grab the vehicle's display names from the `"vehicles"` database table as this is very common in esx servers.

**Multiple "vehicles" database tables**

We were informed that some servers use multiple "vehicles" database tables for donator vehicle&#x73;**,** emergency vehicles etc. So all you need to do is add the names of these database tables into the `Config.VehiclesData.VehicleDatabase_TableNames` in the config,lua.
{% endtab %}

{% tab title="QBCore" %}
On QBCore we will grab the vehicle's display names from the `qb-core/shared.lua/QBShared.Vehicles` as this is very common in QBCore servers.
{% endtab %}

{% tab title="Standalone" %}
If `Config.VehiclesData` is disabled, the script will get the vehicle's display names from the vehicle handling files `vehicles.meta`. Example: `<gameName>Adder</gameName>`.
{% endtab %}

{% tab title="Other" %}
If `Config.VehiclesData` is disabled, the script will get the vehicle's display names from the vehicle handling files `vehicles.meta`. Example: `<gameName>Adder</gameName>`.
{% endtab %}
{% endtabs %}

### Adding/Removing BOLOs & Markers from other resources

> **Why do I need this?**
>
> This is optional, but it is possible to add BOLOs and Markers from other resources, such as MDTs or police resources.

{% tabs %}
{% tab title="Adding BOLOs & Markers" %}

{% tabs %}
{% tab title="client-side to server-side" %}
{% code title="This is a template." %}

```lua
TriggerServerEvent('cd_radar:RadarDatabase_ADD', {
    plate = CHANGE_ME,
    model = CHANGE_ME,
    colour = CHANGE_ME,
    reason = CHANGE_ME,
    type = CHANGE_ME,
    name = nil,
    notes = nil,
    date = nil,
})
```

{% endcode %}

{% code title="This is an example of how this can be formatted." %}

```lua
TriggerServerEvent('cd_radar:RadarDatabase_ADD', {
    plate = 'CODESIGN',
    model = 'Adder',
    colour = 'Blue',
    reason = 'Drugs',
    type = 'bolo',
    name = nil, 
    notes = 'Pablo Escobar wannabe (selling drugs)',
    date = nil,
})
```

{% endcode %}

{% hint style="info" %}
When triggering the event from client-side to server-side, the player triggering the event must have an authorised job.&#x20;
{% endhint %}
{% endtab %}

{% tab title="server-side to server-side" %}
{% code title="This is a template." %}

```lua
TriggerEvent('cd_radar:RadarDatabase_ADD', {
    plate = CHANGE_ME,
    model = CHANGE_ME,
    colour = CHANGE_ME,
    reason = CHANGE_ME,
    type = CHANGE_ME,
    name = nil,
    notes = nil,
    date = nil,
})
```

{% endcode %}

{% code title="This is an example of how this can be formatted." %}

```lua
TriggerEvent('cd_radar:RadarDatabase_ADD', {
    plate = 'CODESIGN',
    model = 'Adder',
    colour = 'Blue',
    reason = 'Drugs',
    type = 'bolo',
    name = nil, 
    notes = 'Pablo Escobar wannabe (selling drugs)',
    date = nil,
})
```

{% endcode %}

{% hint style="info" %}
When triggering the event from the server-side to server-side, cd\_radar can not get a character's name as the source will not be defined.
{% endhint %}
{% endtab %}
{% endtabs %}

####

#### What does each of the variables above mean?

* **plate:** The vehicle's plate (string).
* **model:** The vehicle's display name (string).
* **colour:** The vehicle's colour (string).
* **reason:** The reason must match one of the reasons in the "**`reasonList`**" in the `[configs/config_ui.js]` (string).
* **type:** Choose between "**`bolo`**" or "**`marker`**" (string).
* **name:** \[*OPTIONAL]* The character's name (string).
  * *If left as `nil` then cd\_radar auto-fill this for you.*
* **notes:** \[*OPTIONAL]* Notes left by the officer who issued the bolo/marker (string).
* **date:** \[*OPTIONAL]* The time this bolo/marker was issued (string).
  * *If left as `nil` then cd\_radar auto-fill this for you.*
    {% endtab %}

{% tab title="Removing BOLOs & Markers" %}

{% tabs %}
{% tab title="client-side to server-side" %}
{% code title="The vehicles plate must be defined in the 1st argument." %}

```lua
TriggerServerEvent('cd_radar:RadarDatabase_REMOVE', plate)
```

{% endcode %}

{% hint style="info" %}
When triggering the event from client-side to server-side, the player triggering the event must have an authorised job.&#x20;
{% endhint %}
{% endtab %}

{% tab title="server-side to server-side" %}
{% code title="The vehicles plate must be defined in the 1st argument." %}

```lua
TriggerEvent('cd_radar:RadarDatabase_REMOVE', plate)
```

{% endcode %}

{% hint style="info" %}
When triggering the event from the server-side to server-side, cd\_radar can not get a character's name as the source will not be defined.
{% endhint %}
{% endtab %}
{% endtabs %}

{% endtab %}
{% endtabs %}

##

## INFORMATION

### Default Key Binds

These keys can be modified and/or disabled in the [Keys and Commands](https://i.imgur.com/bTvuXLZ.png) section of the `[configs/config.lua]`.

Please make sure you understand how [Key Mapping](https://docs.codesign.pro/coding-information/register-key-mapping) works.

| Key     | Description                   |
| ------- | ----------------------------- |
| **`J`** | Interact with the radar’s UI. |
| **`O`** | Toggle the radar lock.        |

### Chat Commands

These chat commands can be renamed and/or disabled in the [Keys and Commands](https://i.imgur.com/bTvuXLZ.png) section of the `[configs/config.lua]`.

The exact usage for each command will be displayed in the chat suggestions when using the commands in-game.

| Command              | Description                     |
| -------------------- | ------------------------------- |
| **`/radarsettings`** | Interact with the radar’s UI.   |
| **`/radartoggle`**   | Toggle the radar UI visibility. |
| **`/radarlock`**     | Toggle the radar lock.          |

### Events

These events are completely optional; you can use them if needed.

{% tabs %}
{% tab title="client-side to client-side" %}
**Interact With Radar**

{% code title="Interact With Radar UI with your mouse." %}

```lua
TriggerEvent('cd_radar:InteractWithRadar')
```

{% endcode %}

**Toggle Radar**

{% code title="Toggle the radar UI visibility." %}

```lua
TriggerEvent('cd_radar:ToggleRadar')
```

{% endcode %}

**Show Radar**

{% code title="Show the radar UI." %}

```lua
TriggerEvent('cd_radar:ShowRadar')
```

{% endcode %}

**Hide Radar**

{% code title="Hide the radar UI." %}

```lua
TriggerEvent('cd_radar:HideRadar')
```

{% endcode %}

**Toggle Radar Lock**

{% code title="Toggle the radar lock." %}

```lua
TriggerEvent('cd_radar:ToggleRadarLock')
```

{% endcode %}
{% endtab %}
{% endtabs %}

##

## COMMON ISSUES

Please check out our [**Troubleshooting Guide**](https://docs.codesign.pro/coding-information/self-debugging#troubleshooting) before contacting our support.

🔔 <mark style="color:red;">**Folder Name**</mark> Make sure the name of the folder is `cd_radar`.

🔔 <mark style="color:red;">**Encrypted Files**</mark> Do not edit the encrypted files in any way.

> <mark style="color:red;">**Radar Ignores Emergency Vehicles?**</mark>
>
> eg., if your radar is ignoring emergency vehicles.
>
> {% code overflow="wrap" %}
>
> ```
> ✔️ This is normal; by design we have made it so the radar ignores emergency vehicles; as during police chases this could get really annoying. So please be aware of this if testing the resource out emergency vehicles aren't being seen by the speed limit radar.
> ```
>
> {% endcode %}

> <mark style="color:red;">**Radar Locking Below The Limit I Set?**</mark>
>
> eg., if you have your radar to lock vehicles at 70mph but they are locking at 30mph.
>
> {% code overflow="wrap" %}
>
> ```
> ✔️ This is because you have not set the limit for all 4 cameras. Each camera has its own individual speed limit for locking vehicles. Set them all to the new limit individually.
> ```
>
> {% endcode %}

> <mark style="color:red;">**Radar Not Visible But I Have The Correct Job/perms?**</mark>
>
> eg., if you are confident you have the correct job/perms, but the radar still isn’t visible when in a vehicle.
>
> {% code overflow="wrap" %}
>
> ```
> ✔️ This is because the radar is set to only be visible when you are in an emergancy vehicle. To test this theory, spawn in a default gta police car (/car police), then it should work. If a default gta police car works, but your custom police car does not, then the vehicle class for your custom car is not set as an emergancy vehicle (VC_EMERGENCY) in the vehicles.meta.
> ```
>
> {% endcode %}

> <mark style="color:red;">**I'm Not Able To Add Plates To The Radar's Database?**</mark>
>
> eg., if you are trying to add plates to the radar's database manually or through another script but it doesn't get added and there are no errors.
>
> {% code overflow="wrap" %}
>
> ```
> ✔️ The most common reason for this is because you do not have permission to use the radar (your job is not in the Config.AllowList table in the config.lua). The only way the script will allow you to add a plate to the radar's database is if your job has permission or the event is being triggered from the server side. There will be no visible error if you try to add a plate to the radar's database without proper permissions.
> ```
>
> {% endcode %}

## ERROR CODES

If you see an error code not listed below please open a script support ticket in the [Codesign Discord](https://discord.gg/codesign).

{% tabs %}
{% tab title="Server" %} <mark style="color:red;">**468454**</mark> - You do not have the `vehicles` database table, so you need to disable `Config.VehiclesData` by setting the ENABLE option to false.

<mark style="color:red;">**3364**</mark> - You are triggering the `cd_radar:RadarDatabase_REMOVE` server event to remove bolos/markers, but this vehicle does not have a bolo/marker on it.

<mark style="color:red;">**8800**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, you need to send a **`table`**, but you are not.

<mark style="color:red;">**8801**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`plate`** variable is not a string or is nil.

<mark style="color:red;">**8802**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`model`** variable is not a string or is nil.

<mark style="color:red;">**8803**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`colour`** variable is not a string or is nil.

<mark style="color:red;">**8804**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`reason`** variable is not a string or is nil.

<mark style="color:red;">**8805**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`type`** variable is not a string or is nil.

<mark style="color:red;">**8806**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`reason`** variable is not defined in the `config_ui.js`'s **`reasonList`** table. The strings must be an exact match (case sensitive).

<mark style="color:red;">**8807**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`plate`** variable is either more than 8 characters or is an empty string.

<mark style="color:red;">**8808**</mark> - When triggering the `cd_radar:RadarDatabase_ADD` server event to add bolos/markers, the **`type`** variable can only be either `bolo` or `marker`, but you are sending something different.
{% endtab %}

{% tab title="Client" %}
N/A
{% endtab %}
{% endtabs %}

## CHANGELOG

> **Files Changed**
>
> Not every update requires you to replace the whole folder. We do this because we understand it's a pain to redo the configs for every update.

* **All Files -** This means you should **make a backup of the `JSON Files`** folder, delete your old `cd_radar` folder, download and add in the latest version, replace the new JSON Files folder with the one you made a backup of, configure the configs folder and restart your server.
* **All Files Except config.lua -** This means you should do all of the above (in the All Files section) but additionally **make a backup of the `config.lua`** file and replace the new config.lua file with the one you made a backup of.
* **Specific Files -** This means you can copy and paste the **SPECIFIC** new files over the old ones and restart the server.

{% hint style="danger" %}
**PLEASE READ! (JSON files)**

When updating a resource that uses JSON files as a database as this one does, **DO NOT** delete/replace the files/folders inside the **`JSON files`** folder, as this will overwrite your saved database.
{% endhint %}

{% hint style="warning" %}
**Skipping Updates**

If you are attempting to update to the latest version but have skipped previous updates, you should update all files just to be safe. For example., let's say you are currently on v4.0.1, you did not update when v4.0.2 was released, and now v4.0.3 is released, and you want to update; you should always use the “All Files” update method.
{% endhint %}

{% tabs %}
{% tab title="v1.0.6" %}

### 02/09/2025

**Files Changed**:&#x20;

* [ ] All Files
* [ ] All Files Except config.lua
* [x] Specific Files

```lua
fxmanifest.lua
client/client.lua
```

**Update Type**:

* [ ] Mandatory
* [x] Optional

**Changelog:**

{% hint style="warning" %}
**Fix**

* Significantly improved the radars vehicle detection.
  {% endhint %}
  {% endtab %}

{% tab title="v1.0.5" %}

### 03/05/2023

**Files Changed**:&#x20;

* [x] All Files
* [ ] All Files Except config.lua
* [ ] Specific Files

**Update Type**:

* [ ] Mandatory
* [x] Optional

**Changelog:**

{% hint style="success" %}
**Add**

* Added Turkish locales thanks to Lumisaphy.
* Added pre-configured notification events/exports for some notification scripts that are auto-set by the auto\_detect.
* Added "Config.ClearDatabaseOnRestart" config option to delete the BOLO/marker database on script start.
  {% endhint %}

{% hint style="info" %}
Edit

* Optimised the events and data that sync the radar's database.
* Error codes will now tell you which script the errors came from for easier debugging.
* Removed unnecessary script start prints.
  {% endhint %}

{% hint style="warning" %}
**Fix**

* Fixed the radar database not sometimes syncing when joining the server off-duty and then going on duty on QBCore.
  {% endhint %}
  {% endtab %}

{% tab title="v1.0.4" %}

### 15/02/2023

**Files Changed**:&#x20;

* [ ] All Files
* [x] All Files Except config.lua
* [ ] Specific Files

**Update Type**:

* [ ] Mandatory
* [x] Optional

**Changelog:**

{% hint style="success" %}
**Add**

* Added pre-configured cd\_dispatch integrations.
  {% endhint %}

{% hint style="warning" %}
**Fix**

* Fixed some minor issues with the discord webhook.
  {% endhint %}
  {% endtab %}

{% tab title="v1.0.2" %}

### 06/02/2023

**Files Changed**:&#x20;

* [x] All Files
* [ ] All Files Except config.lua
* [ ] Specific Files

**Update Type**:

* [ ] Mandatory
* [x] Optional

**Changelog:**

{% hint style="danger" %}
**YOUR RADAR DATABASE WILL BE DELETED IF YOU DON'T READ THIS.**

**Copy all of the data inside the  \[`radar_database.txt]`  file and paste them inside the  \[`JSON Files/radar_database.json]`  file.**
{% endhint %}

{% hint style="success" %}
**Add**

* Added `Config.UseFrameworkDutySystem` so you can choose whether you want to use your framework's built-in duty system.
  {% endhint %}

{% hint style="info" %}
**Edit**

* Updated the debug prints.
* The remove bolo/marker event now only requires the plate to be sent instead of the whole table.
* Removed the SQL query to get a character name on esx and replaced it with the ESX getName function.
  {% endhint %}

{% hint style="warning" %}
**Fix**

* Fixed the radar database not being synced when switching jobs.
* Added an auto fix for the QB-shared vehicle misconfigured files.
* Fixed some locales on the UI.
  {% endhint %}
  {% endtab %}

{% tab title="v1.0.3" %}

### 09/02/2023

**Files Changed**:&#x20;

* [x] All Files
* [ ] All Files Except config.lua
* [ ] Specific Files

**Update Type**:

* [ ] Mandatory
* [x] Optional

**Changelog:**

{% hint style="success" %}
**Add**

* **Auto Framework Detection** - We have added a new feature we are calling '**auto\_detect**', which will automatically identify your framework resource and framework notifications and apply the appropriate default settings.
* **Multiple Choice Permissions Access:** With this new feature, you are no longer forced to choose 1 way of adding permissions, you can use multiple all at the same time. You can choose from the framework's job, discord roles, ace perms and identifiers all at the same time!
  {% endhint %}

{% hint style="warning" %}
**Fix**

* Fixed the errors when removing a bolo/marker.
* Fixed the errors with owner check.
  {% endhint %}
  {% endtab %}

{% tab title="v1.0.1" %}

### 15/08/2022

**Files Changed**:&#x20;

* [x] All Files
* [ ] All Files Except config.lua
* [ ] Specific Files

**Update Type**:

* [ ] Mandatory
* [x] Optional

**Changelog:**

{% hint style="success" %}
**Add**

* Added configurable debug prints.
  {% endhint %}

{% hint style="info" %}
**Edit**

* Cleaned up some of the unused/unneeded code.
  {% endhint %}

{% hint style="warning" %}
**Fix**

* Fixed an issue with the standalone perms checks.
  {% endhint %}
  {% endtab %}

{% tab title="v1.0.0" %}

### 18/06/2022

**Files Changed**:&#x20;

* [x] All Files
* [ ] All Files Except config.lua
* [ ] Specific Files

**Update Type**:

* [x] Mandatory
* [ ] Optional

**Changelog:**

{% hint style="success" %}
&#x20;**STATUS**

* **Development Stage:** COMPLETE
* **Alpha Test Stage:** COMPLETE
* **Beta Test Stage:** COMPLETE
  {% endhint %}
  {% endtab %}
  {% endtabs %}
