Studios
Evidencehouse-3.jpg

Examples

SoonEvidenceQbox
PAGE 04 OF 06  ·  CONFIGURATION → EXAMPLES → TROUBLESHOOTINGdocs.glitchstudios.dev
Browse docs

Hook qbx_police#

install/qbx_police.lua replaces the stock evidence handlers on the server side. The client scripts keep firing the stock events. This is the casing handler from that file:

local function evidence() return GetResourceState('glitch-evidence') == 'started' and exports['glitch-evidence'] end

RegisterNetEvent('evidence:server:CreateCasing', function(weapon, serial, coords)
    local src = source
    local ev = evidence()
    local spot = groundNear(src, coords)
    if not ev or not spot then return end
    local current = exports.ox_inventory:GetCurrentWeapon(src)
    ev:AddCasing(src, weapon, current and current.metadata and current.metadata.serial or serial, spot)
end)

The blood and fingerprint handlers in the same file use AddBlood and AddPrint. Take the citizen ID from the server, never from what the client sent.

Taser AFID tags#

Call this where your taser script handles a shot, with the shooter's source:

exports['glitch-evidence']:AddAfid(coords, weaponSerial, src)

Add evidence from your own script#

-- a fingerprint left on a door, with a short note about where
exports['glitch-evidence']:AddPrint(source, vec3(x, y, z), 'Front door handle')

-- a blood stain for a character
local player = exports.qbx_core:GetPlayer(source)
exports['glitch-evidence']:AddBlood(player.PlayerData.citizenid, player.PlayerData.metadata.bloodtype, vec3(x, y, z), source)

Each export returns the record ID, or nothing when the call was refused.

Clear a scene from a command#

Inside your own clean-up command, trigger this on the officer. The first argument lists the kinds to clear and the second is the progress bar label:

TriggerClientEvent('glitch-evidence:client:clearArea', source, { 'casing', 'afid' }, 'Clearing casings...')
TriggerClientEvent('glitch-evidence:client:clearArea', source, { 'blood' }, 'Clearing blood...')

Test a scene#

  1. Give a test officer a flashlight and an empty evidence bag, and set them on duty with a job of type leo.
  2. Fire a weapon or call an export near them.
  3. Equip the flashlight, hold the right mouse button and sweep the spot. The find is marked, and the card opens when it sits near the centre of the beam.
  4. Use the ox_target option on the marked find to bag or destroy it.