Installation
How to install tDetector on your FiveM server.
Prerequisites
- FiveM server with OneSync enabled (Infinity or Legacy)
- tLib — provides settings persistence, move mode, dialog system, and layout discovery
- Wraith ARS 2X (
wk_wars2x) — tDetector reads whether a player's radar antenna is active via its export. Without it no detection occurs, but the script loads cleanly.
Install
Extract the resource
Drop the tDetector folder into your resources directory (e.g., alongside other [tScripts]).
Patch Wraith ARS 2X
tDetector reads radar-gun state through an export that isn't in Wraith by default. Add it once to your wk_wars2x install:
wk_wars2x/fxmanifest.lua — add one line:
client_export "DetectorExport"wk_wars2x/cl_radar.lua — add anywhere at the top level:
function DetectorExport()
return RADAR
endRequired for detection to work
Without this export tDetector loads cleanly but cannot detect any active radar guns. The export is read-only and does not change Wraith's behavior.
Add to server.cfg
Order matters — tLib must start before tDetector, and wk_wars2x should be running for detection to work.
ensure tLib
ensure wk_wars2x
ensure tDetectorStart the server
No further setup is required. Per-player settings (speed unit, layout, HUD position) are stored in KVP. The server creates data.json automatically on first start to store the sound configuration.
Configuration
Open shared/config.lua to change the resource name, default speed unit, or enable QBCore item support:
Config = {}
-- Name of the Wraith ARS 2X resource
Config.wraithResourceName = "wk_wars2x"
-- Default speed unit: 'mph' or 'kph'
-- Players can override this per-session from /tDet
Config.speedUnit = "mph"
-- QBCore item support (optional)
-- Set useAsItem to true and ensure qb-core is running to allow the detector to be used as a QB item.
Config.useAsItem = false
Config.qbItemName = "radardetector"No config.lua restart needed for per-player settings
Speed unit, layout choice, and HUD position are all saved in player KVP via /tDet. You only need to edit shared/config.lua to change the server-wide default or point at a different radar resource.
QBCore item support (optional)
tDetector can be triggered as a useable inventory item instead of (or alongside) the /tDet toggle button.
Enable item usage
In shared/config.lua set:
Config.useAsItem = true
Config.qbItemName = "radardetector" -- must match your items.lua entryAdd the item to QB shared items
In qb-core/shared/items.lua:
['radardetector'] = {
['name'] = 'radardetector',
['label'] = '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.',
},Add the inventory image
Drop radardetector.png into qb-inventory/html/images/.
Restart
restart tDetectorUsing the item while in a vehicle toggles the detector on or off — identical to pressing the button in /tDet.
File layout
| Path | Purpose |
|---|---|
data.json | Auto-created on first start — stores sound key→file mappings and installed sounds |
shared/config.lua | Radar resource name, default speed unit, QB item config |
server/sv_admin.lua | Layout discovery, marketplace registration, sounds config persistence |
server/sv_sync.lua | Broadcasts active radar-gun list to all clients every second |
server/sv_item.lua | QBCore useable item handler (only runs when Config.useAsItem = true) |
client/cl_hud.lua | NUI toggle, move mode, layout switching, KVP persistence |
client/cl_detector.lua | Detection loop — finds the closest active radar gun each tick |
client/cl_settings.lua | /tDet settings dialog |
client/ui/ | Built NUI assets (do not edit) |
client/web/ | NUI source (SolidJS — build with bun run build) |
layouts/ | HUD layout skins (auto-discovered) |
Do not edit client/ui/
These are built NUI assets. The source lives in client/web/. To rebuild after modifying the SolidJS source, run bun run build from inside client/web/.
