Skip to content

noobsystems/evidences

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evidences

Evidences is an advanced FiveM script adding evidences like blood, fingerprints and magazines to your server.

Getting Started

  1. Make sure you have the scripts ox_lib, oxmysql, ox_inventory, ox_target and one of the frameworks ESX Legacy ND Framework Community Ox Qbox Project installed on your server (or implemented your custom one). Make sure that these scripts are started before the evidence script.
    We recommand using our ox_target fork that improves targetting of vehicle doors.
    This script uses the locale module of ox_lib for language selection and provides English, German and Czech translations by default. You change to selected language by setting the convar setr ox:locale. You can also add more languages or edit messages in a existing language file at evidences/locales/. Feel free to open a PR.

  2. Create the required items by adding the file content from 🇬🇧, 🇩🇪, 🇨🇿 or 🇹🇷 to ox_inventory/data/items.lua.

  3. Make the evidence_box a container item if your ox_inventory's version is < 2.44.4 by pasting this code to ox_inventory/modules/items/containers.lua:

    setContainerProperties('evidence_box', {
        slots = 20,
        maxWeight = 5000
    })
  4. Download the item images from here and upload them to your ox_inventory/web/images/ folder.
    Credits for some of those images go to https://docs.rainmad.com/development-guide/finding-item-images. All other images were created by ChatGPT and Gemini, which, however, were edited by us afterwards to suit our preferences.

  5. Finally, download the evidence-script, upload it into your server's resource folder and ensure it.

Warning

The script isn't working? Check your server's live-console for related errors. These will tell you if dependencies are missing or if other setup steps aren't completed. You receive support and can share your ideas at GitHub's Discussions.

How to use this script?

This item-based script provides law enforcement authorities with all the information they need to reconstruct the sequence of events of a crime, identify the perpetrators, and prove their guilt later on. If the criminals acted without caution, fingerprints and DNA traces can be secured at the crime scene and compared with database records of previous offenders. In addition, dropped magazines provide information about the weapon used at the crime scene.

Below, we show all scenarios in which evidence is created, how criminals can destroy it, and how the police can obtain relevant information from seized evidence using the evidence laptop.

🫆 Fingerprints

Players leave fingerprints on vehicle doors when interacting with them or on the whole vehicle if it has no doors (e.g. boats and bikes). Players leave fingerprints on weapon items when equipping them. Fingerprints can be removed by using hydrogen_peroxide while the weapon is equipped. One fingerprint at a time can be stored on a fingerprint scanner. This requires a police officer to use the fingerprint_scanner item and the fingerprinted player to target the scanner in the officer's hand.
By default, players don't leave fingerprints when wearing gloves. If you have custom clothing on your server, you need to add the ids of hands without gloves to the exceptions-list in config.lua:
16      config.isPedWearingGloves = function()
17          local handsVariation = GetPedDrawableVariation(cache.ped, 3)
18          local exceptions = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 
                13, 14, 15, 112, 113, 114, 184, 196, 198}
19
20          return not lib.table.contains(exceptions, handsVariation)
21      end
Important: Fingerprints are only created if the function returns false! This means you have to ability to add further conditions, which have to be fulfilled in order for a player not to leave any fingerprints.
If the fingerprint is not already present on an item (like a weapon), it must be transferred to a fingerprint_taken in order to continue working with it. Therefore, the evidence has to be collected by targetting on it or its holder (this requires a fingerprint_brush) before it gets destroyed by another player using hydrogen_peroxide.

🧬 DNA

Player's blood is left on ground if they loose more then 5 hp. If they are inside a vehicle the blood is left at their current seat in that vehicle. Player's blood is left on every weapon item used to attack them in a melee. Blood can be removed by using hydrogen_peroxide while the weapon is equipped.
If the blood is not already present on an item, it must be transferred to a baggy_blood in order to continue working with it. Therefore, the evidence has to be collected by targetting on it or its holder (this requires a baggy_empty) before it gets destroyed by another player using hydrogen_peroxide or rain.

Magazines

When reloading their weapon, players drop their old magazine on the ground or into the footwell of their current vehicle. Collecting magazines requires a baggy_empty item. A collected baggy_magazine doesn't need to be analyzed as the serial number and name of the associated weapon will be attached to its description.

Evidence Laptop

By using the evidence_laptop item, players can place evidence laptops on a table. After that, they can target the laptop to flip it open and access it. Once placed, the laptop will remain in its position (even persisting through server restarts) until it's picked up again.

Important

Please make sure to set your mouse input method to "Raw Input" (this is the default setting) in your game settings as otherwise you won't be able to use the laptop interface.

Only players with an authorized job can access those laptops. They log into their user account automatically, so there is no need for creating/deleting accounts and no one has to remember their password. You can edit the list of allowed jobs in config.lua:

25     config.permissions = {
26         pickup = {
27             police = 3, -- Only players with police job and a grade >= 3 or
28             fib = 0     -- players with job fib can pick up laptops
29         },
30         ...

Within that config option, you can define jobs and grades the player must have in order to perform other actions:

31         place = { -- Allowed jobs and their minimum grades required to place a laptop
32             police = 0,
33             fib = 0
34         },
35 
36         access = { -- Allowed jobs and their minimum grades required to access (log into) the laptop
37             police = 0,
38             fib = 0
39         },
40 
41         collect = { -- Allowed jobs and their minimum grades required to collect evidence
42             police = 0,
43             fib = 0
44         }
45     }

Tip

You can change the laptop's background image and app icons by replacing the png files at html/dui/laptop/src/assets/.

Fingerprint and DNA App

If you have an item holding a fingerprint/DNA, you can analyze it on the evidence laptop by using the fingerprint/DNA app.

On the left side of the app, all those items in your inventory and evidence boxes are displayed. By selecting an item from the sidebar, you can apply changes to the crime scene, time of collection and additional information (this data is always pre-filled on evidences that you collect), as well as the displayed database entry to the label of the evidence. If a database record exists for a fingerprint/DNA on the selected piece of evidence, it is displayed on the lower half of the app and can be edited; otherwise, a new record can be created.

📁 Database App

The database app allows you to view, edit and delete all database entries that are associated to a fingerprint or DNA:

Evidence Box

The evidence_box item allows you to store evidence in a structured and space-saving manner. They can be labeled with the corresponding crime scene or case file, for example.

All evidence-holding items placed in an evidence box in your inventory will be displayed in the fingerprint and DNA app in the same way as evidence held directly in your inventory.

How to use the built-in api (server only)

You can create or delete evidences in custom scenarios using the built-in api.

First, you need to get the object that represents the owner of an evidence type. Available evidence types are: FINGERPRINT or DNA, which reference a player ID or biometric data as the owner, and WEAPON, which references a serial number.

local evidence <const> = exports.evidences:get(evidenceType, owner)

Now you can make multiple entity, vehicle seat, vehicle door, player, item or a specific location hold that evidence or remove it from them:

-- Binds the evidence to an entity. It can be destroyed or collected by targetting the entity.
-- While destroying the evidence triggers the removeFromEntity() function, collecting the evidence also transfers it to an item created for that purpose.
---@param entity number The netId of the entity the evidence should be bound to
---@param metadata? table
evidence:atEntity(entity, metadata)
evidence:removeFromEntity(entity)

-- Binds the evidence to a seat of a vehicle. Targetting the evidence requires the player to sit on this seat inside the vehicle.
-- A maximum of one evidence is bound to the vehicle, whereby a separate key is stored in the data of the evidence at the entity for each individual seat.
---@param vehicle number The netId of the vehicle the evidence should be bound to
---@param seatId number The id of the seat (look at https://docs.fivem.net/natives/?_0x22AC59A870E6A669 for a list of seat indices)
---@param metadata? table
evidence:atVehicleSeat(vehicle, seatId, metadata)
evidence:removeFromVehicleSeats(vehicle, seatIds)

-- Binds the evidence to a door of a vehicle. If 0 < vehicle door count ≤ 4 targetting the evidence requires the player to look at exactly that door otherwise targetting the vehicle is sufficient.
-- The storing of multiple pieces of evidence of one owner on different doors of the same vehicle is similar to the procedure for vehicle seats (see above).
---@param vehicle number The netId of the vehicle the evidence should be bound to
---@param doorId number The id of the door (look at https://docs.fivem.net/natives/?_0x93D9BD300D7789E5 for a list of door indices)
---@param metadata? table
evidence:atVehicleDoor(vehicle, doorId, metadata)
evidence:removeFromVehicleDoors(vehicle, doorIds)

-- Binds the evidence to a player. It can be destroyed or collected by targetting the player.
-- While destroying the evidence triggers the removeFromPlayer() function, collecting the evidence also transfers it to an item created for that purpose.
---@param playerId number The serverId of the player the evidence should be bound to
---@param metadata? table
evidence:atPlayer(playerId, metadata)
evidence:removeFromPlayer(playerId)

-- Creates an collectable evidence at the given coords.
-- While destroying the evidence triggers the removeFromCoords() function, collecting the evidence also transfers it to an item created for that purpose.
---@param coords vector3 The coords of for that evidence
---@param metadata? table
evidence:atCoords(coords, metadata)
evidence:removeFromCoords(coords)

-- Binds the evidence to an item. Items can hold only one evidence of each type at a time. The currently stored evidence of this type on the item is overwritten.
-- Those items holding evidences inventories or inside containers in the inventories are listet in the dna and fingerprint app on the evidence laptop.
-- Items holding magazine type evidences are labeled with some of the given data.
---@param inventory table|string|number The inventory of the item holding the evidence (cf. https://coxdocs.dev/ox_inventory/Functions/Server#additem)
---@param slot number The slot of the item in the inventory
---@param data? table
evidence:atItem(inventory, slot, data)

-- Removes the evidence from the given item.
---@param inventory table|string|number The inventory of the item holding the evidence (cf. https://coxdocs.dev/ox_inventory/Functions/Server#additem)
---@param slot number The slot of the item in the inventory
evidence:removeFromItem(inventory, slot)

-- Binds the evidence to the last item a player used.
---@param playerId number The serverId of the player
---@param data? table
evidence:atLastUsedItemOf(playerId, data)

-- Binds the evidence to the current weapon of a player.
---@param playerId number The serverId of the player
---@param data? table
evidence:atWeaponOf(attacker, data)

Moreover, you can get a player's biometric data by calling:

exports.evidences:getFingerprint(playerId)
exports.evidences:getDNA(playerId)

License

This project is licensed under the GNU General Public License v3.0 or later. See the LICENSE file for the full text.
Copyright © 2025 noobsystems (https://github.com/noobsystems)