Installation

  • Go to _ITEMS folder and register the items in your inventory.

  • For this resource you need to create a Discord webhook where the images will be hosted, if you don't know how to create a webhook check this: Webhook Guide.

  • Go to av_cameras/server/framework/_framework.lua and place the webhook link in line 1, if you don't do this step the resource will NOT start and it will print an error in server console.

Vehicle Exports

  • For the vehicle cameras to work properly in owned vehicles you need to place the following exports in your Garage script, the first export needs to be added in the function where the vehicle is already spawned and properly created, the following example is for qb-garages:

qb-garages/client/main.lua line 288
-- exports['av_cameras']:vehicleOut(vehicle,plates) 
RegisterNetEvent('qb-garages:client:takeOutGarage', function(data)
    QBCore.Functions.TriggerCallback('qb-garages:server:IsSpawnOk', function(spawn)
        if spawn then
            local location = GetSpawnPoint(data.garage)
            if not location then return end
            QBCore.Functions.TriggerCallback('qb-garages:server:spawnvehicle', function(netId, properties, vehPlate)
                while not NetworkDoesNetworkIdExist(netId) do Wait(10) end
                local veh = NetworkGetEntityFromNetworkId(netId)
                Citizen.Await(CheckPlate(veh, vehPlate))
                QBCore.Functions.SetVehicleProperties(veh, properties)
                exports[Config.FuelResource]:SetFuel(veh, data.vehicle.fuel)
                TriggerServerEvent('qb-garages:server:updateVehicleState', 0, vehPlate)
                TriggerEvent('vehiclekeys:client:SetOwner', vehPlate)
                exports['av_cameras']:vehicleOut(veh,vehPlate)
                if Config.Warp then TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1) end
                if Config.VisuallyDamageCars then doCarDamage(veh, data.stats, properties) end
                SetVehicleEngineOn(veh, true, true, false)
            end, data.plate, data.vehicle, location, true)
        else
            QBCore.Functions.Notify(Lang:t('error.not_depot'), 'error', 5000)
        end
    end, data.plate, data.type)
end)
  • This is the needed export that you have to trigger when the vehicle is stored in the garage, this example is for qb-garages:

qb-garages/client/main.lua line 61
-- exports['av_cameras']:vehicleIn(vehicle,plate)
local function DepositVehicle(veh, data)
    local plate = QBCore.Functions.GetPlate(veh)
    QBCore.Functions.TriggerCallback('qb-garages:server:canDeposit', function(canDeposit)
        if canDeposit then
            local bodyDamage = math.ceil(GetVehicleBodyHealth(veh))
            local engineDamage = math.ceil(GetVehicleEngineHealth(veh))
            local totalFuel = exports[Config.FuelResource]:GetFuel(veh)
            TriggerServerEvent('qb-mechanicjob:server:SaveVehicleProps', QBCore.Functions.GetVehicleProperties(veh))
            TriggerServerEvent('qb-garages:server:updateVehicleStats', plate, totalFuel, engineDamage, bodyDamage)
            CheckPlayers(veh)
            if plate then TriggerServerEvent('qb-garages:server:UpdateOutsideVehicle', plate, nil) end
            exports['av_cameras']:vehicleIn(veh,plate)
            QBCore.Functions.Notify(Lang:t('success.vehicle_parked'), 'primary', 4500)
        else
            QBCore.Functions.Notify(Lang:t('error.not_owned'), 'error', 3500)
        end
    end, plate, data.type, data.indexgarage, 1)
end

Note: Since there's a lot of different garage scripts, I can't add a guide for each one of them, you are responsible to add this exports to your garage script, if you don't know where the function is located ask the author of the garage script.

Last updated