Prerequisites
- FiveM server with OneSync enabled (Infinity or Legacy)
- tLib — provides settings persistence, move mode, dialog system, and layout discovery
- At least one supported radar resource (see below). tDetector loads cleanly without one, but nothing will be detected.
Supported radar resources
| Resource | Notes |
|---|---|
Wraith ARS 2X (wk_wars2x) | Requires a one-time export patch (see below) |
Seeker Dual (seeker_dual) | Requires a one-time export patch (see below) |
Both can run simultaneously — tDetector checks each one and stops at the first active hit.
Install
Extract the resource
Drop the tDetector folder into your resources directory (e.g., alongside other [tScripts]).
Patch your radar resource(s)
tDetector reads radar-gun state through a client export named IsRadarActive. Add it once to whichever radar resource(s) you run.
Wraith ARS 2X (wk_wars2x)
wk_wars2x/fxmanifest.lua — add one line before the client scripts block:
client_export "IsRadarActive"wk_wars2x/cl_radar.lua — add anywhere at the top level (after the RADAR table is defined):
exports('IsRadarActive', function()
return RADAR:IsPowerOn() and RADAR:IsEitherAntennaOn()
end)Seeker Dual (seeker_dual)
seeker_dual/fxmanifest.lua — add one line before the client scripts block:
client_export "IsRadarActive"seeker_dual/client/exports.lua (or any client script) — add:
exports('IsRadarActive', function()
return Radar.power and (Radar.frontXmit or Radar.rearXmit)
end)Required 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 the radar resource's behavior.
Add to server.cfg
tLib must start before tDetector. Your radar resource(s) should also be running.
server.cfg
ensure tLib
ensure wk_wars2x # and/or seeker_dual
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:
shared/config.lua
Config = {}
-- List every radar resource tDetector should listen for.
-- Each must expose a client export named IsRadarActive() → boolean.
-- Resources that are not running are skipped silently.
Config.radarResources = {
"wk_wars2x",
"seeker_dual",
}
-- Default speed unit: 'mph' or 'kph'
-- Players can override this per-session from /tDet
Config.speedUnit = "mph"
-- Who can open /tDet — "everyone", "ace", or "item" (see Access control below)
Config.accessMode = "everyone"
Config.acePermission = "tdetector.use"
-- 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"config.lua restart required
Unlike per-player settings, Config.accessMode and Config.acePermission are read on resource
start. Run restart tDetector after changing them.
Access control
Config.accessMode controls who can toggle the detector:
| Mode | Behavior |
|---|---|
"everyone" | Default. Anyone can run /tDet and use the toggle button. |
"ace" | Only players granted Config.acePermission can run /tDet at all. Everyone else gets a chat message and the dialog never opens. |
"item" | /tDet still opens for everyone — speed unit, HUD layout, and reposition all still work — but the toggle button is disabled. The detector can only be enabled/disabled through the QBCore item, which this mode turns on by itself (Config.useAsItem does not need to be set). |
The "ace" check runs server-side on every /tDet invocation, so granting or revoking the permission takes effect immediately — no reconnect needed. "item" mode's toggle lock is decided client-side (it just reads Config.accessMode, which is a shared script) since it's a UI restriction, not a permission check.
To grant the ace permission in server.cfg:
server.cfg
add_ace group.mechanic tdetector.use allow
add_principal identifier.license:xxxxxxxx group.mechanic(Swap group.mechanic and the permission name for whatever fits your server — Config.acePermission can be renamed to anything.)
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 add/remove radar resources.
QBCore item support (optional)
tDetector can be triggered as a useable inventory item instead of (or alongside) the /tDet toggle button.
Already using accessMode = "item"?
That mode enables the item hook by itself — skip straight to Add the item to QB shared
items. Config.useAsItem below is only for running the item
alongside an active /tDet command (accessMode "everyone" or "ace").
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, access mode, QB item config |
server/sv_admin.lua | Layout discovery, marketplace registration, sounds config persistence, /tDet access gate |
server/sv_sync.lua | Broadcasts active radar-gun list to all clients every second |
server/sv_item.lua | QBCore useable item handler (runs when Config.useAsItem = true or Config.accessMode = "item") |
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/.
