> For the complete documentation index, see [llms.txt](https://tommys-scripts.gitbook.io/fivem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tommys-scripts.gitbook.io/fivem/paid-scripts/tommys-radar-detector.md).

# Tommy's Radar Detector

{% embed url="<https://www.youtube.com/watch?v=GPMLoupUSYk>" %}

[FiveM Post](https://forum.cfx.re/t/paid-standalone-qbcore-youniden-radar-detector/4929675) | [Store Page](https://tommy141x.tebex.io/)

#### Escrow Encrypted: Yes

#### Requirements: Wraith ARS 2X

#### Live Test Server

If you would like to test it out yourself, come [check it out](fivem://connect/kqj4l6):

1. Open FiveM & Press F8
2. Type `connect 152.53.89.119` & hit enter.
3. Once loaded in, hit the `/youniden` command to open the detector

{% hint style="info" %}
You need another player actively running radar via wraith to detect any radar bands.
{% endhint %}

Features:

* Works with Wraith ARS 2X and can be configured to work with other frameworks.
* Displays the direction and strength of radar signals.
* The UI can be easily resized and moved, with individual positions saved for each player.
* UI resizing and positioning can be done using the `/youniden_layout` command, with + and - for size adjustment and mouse for position adjustment.
* Audio control with mute toggle and volume adjustment commands
* Individual audio settings are saved per player and persist across sessions

<div><figure><img src="/files/oGnrQXXS9n9lsyqtoQCT" alt=""><figcaption></figcaption></figure> <figure><img src="/files/T0zDj7zfIHBrFD1YSssR" alt=""><figcaption></figcaption></figure> <figure><img src="/files/7lkRPvGY4pdf1hA9cB2G" alt=""><figcaption></figcaption></figure></div>

**Commands:**

* `/youniden` - Toggle the radar detector on/off (if useAsCommand is enabled)
* `/youniden_layout` - Enter layout editing mode to resize and reposition the UI
  * Press `+` (equals key) to increase size
  * Press `-` (minus key) to decrease size
  * Click and drag to move the radar
  * Press `ESC` to save your layout
* **`/youniden_mute`** - Toggle audio on/off for all radar detector sounds
* **`/youniden_volume [0-100]`** - Set the volume level (0 = silent, 100 = full volume)
  * Example: `/youniden_volume 50` sets volume to 50%

**Configuration:**&#x20;

**cl\_config.lua:**

This file contains client-side configuration options for the radar detector script.

```lua
Config = {} -- Tommy's Radar Detector Script v1.0
-- The name of the Wraith ARS 2X resource.
Config.wraithResourceName = "wk_wars2x"
-- Choose either 'mph' or 'kph'
Config.speedUnit = "mph"
-- This is for weather you want to enable the command to open the radar detector, disable this if you are using it as an item.
Config.useAsCommand = false
Config.commandName = "youniden"
-- Enable debug logging (set to false in production)
Config.debug = false
```

* `wraithResourceName`: Specifies the name of the Wraith ARS 2X resource. Make sure to set it correctly based on your resource name.
* `speedUnit`: Allows you to choose the unit of measurement for the radar detector. Options are "mph" or "kph".
* `useAsCommand`: Set this option to true if you want to use the /youniden command to open the radar detector. If using it as an item, set it to false.
* `commandName`: Specifies the command name to open the radar detector if `useAsCommand` is enabled.

**sv\_config.lua:**

This file contains server-side configuration options for the radar detector script.

```lua
-- If using qbcore, enable this to allow the radar detector to be used as an item.
local useAsItem = false
local itemName = "radardetector"
-- Enable debug logging (set to false in production)
local debug = false
```

* `useAsItem`: Set this option to true if you are using the QBCore framework and want to allow the radar detector to be used as an item. Set it to false otherwise.
* `itemName`: Specifies the name of the radar detector item if `useAsItem` is enabled.
* `QBCore`: Retrieves the core object of the QBCore framework.
* `list`: A table that stores the radar detector toggle status for each player.
* `CreateThread`: A function used to create a thread that continuously updates the radar detector toggle status.
* `TriggerClientEvent`: Sends the radar detector toggle status to all clients.
* `QBCore.Functions.CreateUseableItem`: Creates a usable item for the radar detector if `useAsItem` is enabled.

Additional Instructions:

* For all users using WK\_WARS2X, add the following line to the `fxmanifest.lua` file of the Wraith resource: `export "DetectorExport"`. Additionally, add the provided code anywhere within the `cl_radar.lua` file within the Wraith resource folder.

{% code title="Add Code to cl\_radar.lua" %}

```lua
function DetectorExport()
	return RADAR;
end
```

{% endcode %}

* For QBCore users who wish to make this an item, include the provided code in your `qbcore/shared/items.lua` file. Also, make sure to drag the `radardetector.png` file into the `qb-inventory/html/images` directory.

{% code title="QB Core Item" %}

```lua
['radardetector'] = {
  ['name'] = 'radardetector',
  ['label'] = 'Youniden Radar Detector',
  ['weight'] = 3000,
  ['type'] = 'item',
  ['image'] = 'radardetector.png',
  ['unique'] = true,
  ['useable'] = true,
  ['shouldClose'] = true,
  ['combinable'] = nil,
  ['description'] = 'We are not liable for your reckless driving.',
},
```

{% endcode %}

* Finally, enable the "useAsItem" function in the config file to activate the radar detector as an item.

**Please** ensure that you follow these instructions carefully to ensure proper functionality and integration with the Wraith ARS 2X and QBCore frameworks.
