Weapons

Here, you'll find key exports for managing weapons. These exports allow you to register and update weapons as needed.


Type

type Weapon = {
    name: string,
    label: string, 
    serial: string, 
    notes: string, 
    evidences: {
        id: number,
        createdAt: string
    }[]
}

Exports

Search for a weapon

exports['redutzu-mdt']:SearchWeapon(serial: string) // WeaponType | null

Register a new weapon

local serialNumber = exports['redutzu-mdt']:GenerateWeaponSerial()

exports['redutzu-mdt']:RegisterWeapon({
  label = 'Pistol',
  name = 'weapon_pistol', -- this must be the same as in your GetWeapons function
  serial = serialNumber, -- you can generate your own serial number but it must be unique
  identifier = 'license:1234567890', -- owner identifier (QBCore: citizenid, ESX/Standalone: Identifier)
  notes = 'Weapon notes'
}) -- string (serial number)

Generate a weapon Serial

-- It returns a string
exports['redutzu-mdt']:GenerateWeaponSerial() // string (generates an UNIQUE serial number)

Update a weapons info

-- It returns a boolean (if it was successfully updated)
exports['redutzu-mdt']:UpdateWeapon('serialNumber', { notes = 'Updated notes' }) -- boolean

Last updated