JCKSDocs
JCKS JobsV2Funkce

Evidence and forensics

Evidence locker with chain of custody, traces created by the server (blood, casings with calibre, impacts, fingerprints on vehicles and doors, gunshot residue), forensic mode, flashlight view, rain, evidence bags and the lab.

Client options are in settings/config.dispatch.lua (Config.Forensics, Config.Evidence), server only options in settings/server/config.lua. Only jobs in Config.Evidence.jobs (police and sheriff by default) see, collect and analyse traces.

Traces

Trace When it is created
Blood Someone loses bloodThreshold health in one hit or bleeds, also inside vehicles
Casing A gun is fired. It lies at the shooter's feet with the weapon class, the calibre and, with ox_inventory, the weapon serial
Impact Where a bullet landed, with the calibre
Fingerprint A vehicle is touched without gloves, or a door from /jobadmin, Doors is opened or locked without gloves
Gunshot residue On the shooter's hands for gsrMinutes, swimming washes it off (see washMinSeconds)

The server creates every trace from its own data: the position of the shooter, the selected weapon, the serial. A player's game only reports that it fired or got hurt, it cannot place evidence where it likes. Impacts farther than impactDistance from the shooter are dropped, at most one casing and impact per player every shotInterval ms, and more than floodLimit reports in 10 seconds are logged as an exploit and dropped.

Shots are read from the ammo count every 150 ms while a gun is in hand. Nothing runs per frame and nothing at all without a weapon. With casing, impact and gsr all false (and Config.Alerts.shooting off) the game does not watch shots.

Gloves are read from the arms drawable of the ped: a value in bareHands means bare hands. Jobs in doorPrintsSkipJobs leave no prints on doors, so their own station doors stay clean.

Calibres

A weapon in Config.Forensics.weapons wins, otherwise its class in calibres. Classes in noCasing leave no casing, impacts still.

lua
Config.Forensics.calibres = { pistol = '9mm', smg = '9mm', rifle = '5.56mm', mg = '7.62mm', shotgun = '12 gauge', sniper = '.308', firearm = 'unknown calibre' }
Config.Forensics.noCasing = {}

weapons sets 16 weapons by default, for example WEAPON_PISTOL50 = '.50 AE', WEAPON_REVOLVER = '.44 Magnum', WEAPON_ASSAULTRIFLE = '7.62x39mm', WEAPON_HEAVYSNIPER = '.50 BMG'.

Finding and collecting

Police see traces two ways:

  • Forensic mode (/forensics or its key) highlights every trace within view.drawDistance. With viewItems set the officer needs one of those items, for example a UV light.
  • Flashlight: aiming a weapon from view.flashlights (or a gun with its flashlight attachment on, view.weaponLights) shows the traces inside its light cone, up to view.lightRange.

Only traces within viewRadius are sent to the officer, and only while looking. At most view.maxDrawn are drawn, the closest win.

E on a trace collects it in collectTime ms. It uses up one evidence_bag (collectItem, with consumeBag), logs the evidence in the locker with the case number (asked when askCaseNumber is on) and gives an evidence_sealed item (bagItem) with the evidence number, the trace and the case in its metadata. ox_inventory shows it on the item, qb-inventory keeps it in info. With a full inventory the evidence goes to the locker only. /searchtraces collects every blood trace, casing and fingerprint of the closest vehicle in vehicleCollectTime ms.

/gsr tests the closest person, /fingerprint takes fingerprints and DNA of a restrained or downed person (sampleRequiresRestraint). Both within sampleDistance.

Rain

Players' games report rain every rain.check seconds. The server believes it when more than half of the players say so, so one modified game cannot wash a crime scene. A weather script can decide instead:

lua
exports.jcks_jobs:SetRaining(true)
exports.jcks_jobs:SetRaining(nil)
local raining = exports.jcks_jobs:IsRaining()

nil hands the decision back to the players. After rainSeconds of rain the trace kinds in rainWash are gone from the street. Traces inside interiors and in vehicles stay.

Limits

Traces expire after lifetime seconds per kind. The map is cut into squares of areaSize metres with at most maxPerArea traces each, a new trace replaces the oldest in its square. The whole server keeps at most maxTraces. A long shootout in one street never fills the server and officers get a short list.

Evidence locker

/evidence or the MDT. Every item has a category, a case number, an optional person (picked by name) and plate, and the position where it was logged. Items move through In locker, At the lab, Court, Released and Destroyed, every step lands in the chain of custody. Grades from destroyMinGrade mark evidence as destroyed, which cannot be undone.

At the lab, Run lab analysis starts labMinigame. A passed game writes the result: the DNA or fingerprint code is compared with the biometrics on file and names the person, a casing with a serial points to the owner in the firearms registry (MDT, Firearms). A failed game writes nothing and the officer can try again. DNA and fingerprint codes are salted per server with salt.

Client options

Key Type Default What it changes
Config.Forensics.enabled boolean true Forensics
types table blood, casing, impact, fingerprint, gsr all true Trace kinds created, false = never created or reported
shotInterval number 400 ms, at most one casing and impact per player in this time, 100 to 5000
view.toggle boolean true Forensic mode, false = command off
view.flashlight boolean true Traces in the light of a flashlight
view.weaponLights boolean true A gun with its flashlight on works like a flashlight while aiming
view.flashlights table { 'WEAPON_FLASHLIGHT' } Weapons that count as a flashlight
view.drawDistance number 18.0 Metres the forensic mode highlights, 2 to 60
view.lightRange number 14.0 Metres a flashlight shows traces, 2 to 60
view.lightCone number 30 Degrees from the middle of the screen a trace is still lit, 5 to 90
view.markerSize number 0.07 Size of the dot on a trace in metres
view.maxDrawn number 40 Most traces drawn at once
rain.enabled boolean true Rain washes traces
rain.check number 15 Seconds between two checks on each player's game
rain.level number 0.2 Rain level 0.0 to 1.0 from which it counts
key string '' Forensic mode key, players bind it
commands table mode = 'forensics', gsr = 'gsr', sample = 'fingerprint', vehicle = 'searchtraces' Commands
askCaseNumber boolean true Ask for a case number when collecting
collectTime number 4000 ms to collect one trace
vehicleCollectTime number 9000 ms to collect every trace of a vehicle
bloodThreshold number 8 Health lost in one hit before blood drops
bareHands table 22 arm drawables Arms drawables that count as no gloves
labMinigame string 'faulty' Minigame before a lab result, 'none', a built in type or 'custom:<id>'
labDifficulty string 'medium' easy, medium or hard
Config.Evidence.enabled boolean true Evidence locker
Config.Evidence.command string 'evidence' Command
Config.Evidence.categories table blood, fingerprint, weapon, casing, document, device, recording, other Categories. device is seized phones and laptops, recording bodycam and dashcam clips
Config.Evidence.jobs table { police = true, sheriff = true } Jobs that log, search, transfer and see traces
Config.Evidence.destroyMinGrade number 3 Lowest grade that marks evidence as destroyed

Server only options

Key Type Default What it changes
collectItem string 'evidence_bag' Item needed to collect, '' = none
consumeBag boolean true Each trace uses up one collectItem, false = only needed in the inventory
bagItem string 'evidence_sealed' Sealed bag the officer gets, '' = locker only
viewItems table {} Items needed for the forensic mode, {} = none. The flashlight way always needs a flashlight
requireDuty boolean false Only officers on duty see traces
sampleRequiresRestraint boolean true Fingerprints and DNA only from restrained or downed people
viewRadius number 40.0 Metres of traces sent to a looking officer, 5 to 200
collectDistance number 3.0 Metres to a trace on the ground
vehicleDistance number 4.0 Metres to a vehicle for /searchtraces
sampleDistance number 3.0 Metres to a person for GSR, fingerprints and DNA
gsrMinutes number 30 Minutes residue stays on the hands
washMinSeconds number 30 Seconds after the last shot before swimming can wash residue off, 10 to 3600
washSeaLevel number 2.0 A wash counts only below this height in metres (the sea) or inside washPoints
washPoints table {} Lakes, rivers and pools above sea level that wash residue, { x, y, z, radius }
lifetime table blood = 3600, casing = 5400, impact = 5400, fingerprint = 7200 Seconds a trace stays, 30 to 604800
maxTraces number 1500 Traces on the whole server, 50 to 20000
areaSize number 50.0 Square size in metres
maxPerArea number 60 Traces per square
impactDistance number 150.0 Metres from the shooter an impact may be, 10 to 1000
floodLimit number 60 Trace reports per player in 10 seconds, 10 to 500
rainWash table blood = true, others false Trace kinds rain washes off the street
rainSeconds number 300 Seconds of rain until a washable trace is gone, 0 to 86400
doorPrints boolean true Doors keep fingerprints
doorPrintsSkipJobs table { police = true, sheriff = true } Jobs that leave no prints on doors
weapons table 16 weapons Calibre per weapon
noCasing table {} Weapon classes without casings
salt string 'change-me' Salt of DNA and fingerprint codes. 'change-me' or '' = a random salt is generated once and kept. Changing it later changes every stored code

All keys above are under Config.Forensics. Live in /jobadmin, Server settings, Forensics: enabled, askCaseNumber, collectTime, bloodThreshold, view.toggle, view.flashlight, rain.enabled, consumeBag, maxPerArea.

Items

evidence_bag (stackable) and evidence_sealed (not stackable, carries metadata) are in install/ox_inventory.lua, install/qb-core-items.lua and install/esx-items.sql.

Exports

Export Description
AddEvidence(data) Logs an item in the locker: label, category, caseRef, identifier, plate, coords, ref. Returns the id
AddTrace(trace) Adds a trace: type (blood, casing, fingerprint, impact) with coords or plate, optional dna, fingerprint, serial, weapon, calibre, place, indoor. Returns the id
GetBiometricProfile(identifier) DNA and fingerprint codes of a character
SetRaining(state), IsRaining() Rain from a weather script, see above