Advanced Documentation

Developer Documentation and other Advanced Configuration Topics for the Evidence Camera

Custom Inventory Integration

If you wish to use a custom inventory please first ensure that use_custom_inventory is set to true in your config.lua

For all the handling of photo items please see the /server/inventory.lua file. In this file it is recommended that do the following:

Define your framework. Ex. Below

local QBCore = nil
if config.frameworks.use_qbcore then
    QBCore = exports["qb-core"]:GetCoreObject()
end

Begin your handling (All examples will be shown using QBCore)

First we will register our item with the framework. Ex. Below

        exports["qb-core"]:AddItem("sonoran_evidence_photo", {
            name = "sonoran_evidence_photo",
            label = "Photo",
            weight = 0,
            type = "item",
            image = "evidence.png",
            unique = true,
            useable = true,
            shouldClose = false,
            combinable = nil,
            description = "A sweet polaroid photo"
        })
        QBCore.Functions.CreateUseableItem("sonoran_evidence_photo", function(source, item)
            TriggerClientEvent("sonoran:lookphoto:qbcore", source, item)
        end)

Next we will make the item usable. Example below:

        QBCore.Functions.CreateUseableItem("sonoran_evidence_photo", function(source, item)
            TriggerClientEvent("sonoran:lookphoto:qbcore", source, item)
        end)

Now that our item is registered and usable we will begin the handling. The following event will be triggered when the photo is first put away. You will want to use this to cache the images link. Sononran:PutAway:Custom:First. The example handling will be used in the form of QBCore. See below for example.

    RegisterNetEvent("Sononran:PutAway:Custom:First", function(image)
        local Player = QBCore.Functions.GetPlayer(source)
        if not Player then
            return
        end
        local info = {}
        info.image_link = image
        Player.Functions.AddItem("sonoran_evidence_photo", 1, nil, info)
    end)

Passed Parameters To Sononran:PutAway:Custom:First

Parameter NameParameter Description

image

The direct image link

Last updated