Tommy's Scripts
  • Information
    • FiveM Escrow System
  • Paid Scripts
    • Tommy's ELS
    • Tommy's Radar Detector
    • Tommy's POV
    • Tommy's Radio
    • Tommy's HUD (Legacy V1)
    • Custom Unit Number
    • GTA:O Loading Screen
  • Free Scripts
    • Tommy's Lights Sync
    • Tommy's Discord API
    • Priority Status
Powered by GitBook
On this page
  1. Paid Scripts

Tommy's Radar Detector

Configuration guide, common issues & solutions, code snippets, and more.

Last updated 9 months ago

|

Escrow Encrypted: Yes

Requirements: Wraith ARS 2X

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.

Configuration: cl_config.lua:

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

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"
-- Enable this if you want to use the command to open the radar detector (disable if using it as an item).
Config.useAsCommand = false
Config.commandName = "youniden"
  • 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.

-- If using qbcore, enable this to allow the radar detector to be used as an item.
local useAsItem = true
local itemName = "radardetector"
local QBCore = exports['qb-core']:GetCoreObject()

list = {}
CreateThread(function()
    while true do
        Wait(1000)
        TriggerClientEvent('youniden:syncList', -1, list)
    end
end)

if useAsItem then
    QBCore.Functions.CreateUseableItem(itemName, function(source)
        TriggerClientEvent('youniden:radar', source)
    end)
end

RegisterNetEvent('youniden:updateList')
AddEventHandler('youniden:updateList', function(toggle)
    list[source] = toggle
end)
  • 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.

Add Code to cl_radar.lua
function DetectorExport()
	return RADAR;
end
  • 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.

QB Core Item
['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.',
},
  • 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.

FiveM Post
Store Page
Page cover image