Configuration

Below we have explained some of the key features found in our Config file within the Vehicle Insurance Script.


Framework

Select your framework (by default the script will auto detect)

Config.Framework = 'qbcore' -- 'qbcore', 'qbox'

Inventory

If you have an inventory system that is not one of the listed types then this means the script doesn't support

it as of this moment in time.

Config.InventorySystem = 'qs' --'qb' = [qb-inventory], 'ox' = [ox_inventory], 'qs' = [qs-inventory]

Target System

The script supports both qb-target and ox_target to allow the 3rd eye functions within this script.

Config.Target = 'auto' -- 'qb-target', 'ox_target', or 'auto' for auto-detection

Location

Location setting is critical to allowing your players to get access to the insurance interface, the default location is inside Big Bank in Vinewood. If you have an interior you wish to place the ped in you can always set it here.

Config.InsuranceLocation = {
    coords = vector4(234.49, 226.13, 106.29, 246.05), --vector4(243.63, 226.25, 106.29, 157.3)
    blipSprite = 606,
    blipColor = 3,
    blipScale = 0.8,
    blipLabel = "Vehicle Insurance"
}

Insurance Prices

You can set the vehicles insurance price by category in the config file. This allows you reduce the amount or increase to suit your economy.

Config.InsurancePrices = {
    compacts = 500,
    sedans = 750,
    suvs = 1000,
    coupes = 850,
    muscle = 1200,
    sportsclassics = 1500,
    sports = 2000,
    super = 3000,
    motorcycles = 400,
    offroad = 900,
    industrial = 800,
    utility = 600,
    vans = 700,
    cycles = 50,
    boats = 2500,
    helicopters = 5000,
    planes = 7500,
    service = 600,
    emergency = 1000,
    military = 2000,
    commercial = 1500,
    trains = 10000
}

Direct Debit

Your players can pay outright or by monthly installments with a direct debit, configuring the below settings will let you decide how frequently they are billed and how much interest they will pay for spreading the cost. The late fee is a last resort and rarely gets used but you don't want players driving around with no insurance.

Config.DirectDebit = {
    enabled = true,
    intervalDays = 7, -- Payment every 30 days
    APR = 0.239,
    lateFeePenalty = 0.1 -- 10% penalty for late payments
}

Using qs-inventory

If you are using qs-inventory you will need to add the following code to qs-inventory -> shared -> items.lua.

        ['vehicle_insurance_policy']                  = {
        ['name'] = 'vehicle_insurance_policy',
        ['label'] = 'Vehicle Insurance Policy',
        ['weight'] = 0,
        ['type'] = 'item',
        ['image'] = 'vehicle_insurance_policy.png',
        ['unique'] = true,
        ['useable'] = true,
        ['shouldClose'] = true,
        ['combinable'] = nil,
        ['description'] = 'Insurance Policy for personal vehicle'},

To Display Metadata and depending on your version of qs-inventory you will need to add the following snippet below the existing id_card in this file qs-inventory -> config -> metadata.js.

        } else if (itemData.name == "vehicle_insurance_policy") {
            $(".item-info-title").html("<p>" + `${itemData.info.label || label}` + "</p>");
            $(".item-info-description").html(
                "<p><strong>Vehicle Insurance Policy</strong></p>" +
                "<p><strong>Vehicle: </strong><span>" +
                (itemData.info.vehicleName !== undefined ? itemData.info.vehicleName : 'Unknown') +
                "</span></p><p><strong>License Plate: </strong><span>" +
                (itemData.info.vehiclePlate !== undefined ? itemData.info.vehiclePlate : 'Unknown') +
                "</span></p><p><strong>Expiry Date: </strong><span>" +
                (itemData.info.expiryDate !== undefined ? itemData.info.expiryDate : 'Unknown') +
                "</span></p><p><strong>Citizen ID: </strong><span>" +
                (itemData.info.citizenID !== undefined ? itemData.info.citizenID : 'Unknown') +
                "</span></p><p><strong>Payment Plan: </strong><span>" +
                (itemData.info.paymentPlan !== undefined ? itemData.info.paymentPlan : 'Unknown') +
                "</span></p>"
            );

Using ox_intentory

If you are using ox_inventory you will need to add the following code to ox_inventory -> data -> items.lua.

['vehicle_insurance_policy'] = {
    label = 'Vehicle Insurance Paper',
    weight = 50,
    stack = false,
    close = true,
    description = '',
    metadata = {
        plate = 'UNKNOWN',
        expiry = 'N/A',
        citizenid = 'N/A'
    },
},


Using qb-core

If you are using qb-inventory you will need to add the following code to qb-core -> shared -> items.lua.

['vehicle_insurance_policy']       = {['name'] = 'vehicle_insurance_policy',      ['label'] = 'Vehicle Insurance Policy',   ['weight'] = 0,         ['type'] = 'item',      ['image'] = 'vehicle_insurance_policy.png',     ['unique'] = true,      ['useable'] = true,     ['shouldClose'] = true,    ['combinable'] = nil,   ['description'] = 'Insurance Policy for personal vehicle'},

Config File before edits

Config = {}
Config.Framework = 'qbcore' -- 'qbcore', 'qbox'
Config.InventorySystem = 'qs' --'qb' = [qb-inventory], 'ox' = [ox_inventory], 'qs' = [qs-inventory]
Config.Currency = '£' -- Currency symbol for the insurance prices
Config.ViewPolicy_distance = 3.0 -- (METERS) This is the distance needed to be able to see the Insurance Policy UI when the item has been used by a player
Config.InsuranceLocation = {
    coords = vector4(234.49, 226.13, 106.29, 246.05), --vector4(243.63, 226.25, 106.29, 157.3)
    blipSprite = 606,
    blipColor = 3,
    blipScale = 0.8,
    blipLabel = "Vehicle Insurance"
}
Config.Target = 'auto' -- 'qb-target', 'ox_target', or 'auto' for auto-detection
Config.InsurancePrices = {
    compacts = 500,
    sedans = 750,
    suvs = 1000,
    coupes = 850,
    muscle = 1200,
    sportsclassics = 1500,
    sports = 2000,
    super = 3000,
    motorcycles = 400,
    offroad = 900,
    industrial = 800,
    utility = 600,
    vans = 700,
    cycles = 50,
    boats = 2500,
    helicopters = 5000,
    planes = 7500,
    service = 600,
    emergency = 1000,
    military = 2000,
    commercial = 1500,
    trains = 10000
}
Config.DirectDebit = {
    enabled = true,
    intervalDays = 7, -- Payment every 30 days
    APR = 0.239,
    lateFeePenalty = 0.1 -- 10% penalty for late payments
}
Config.InsurancePed = {
    model = 'a_m_m_prolhost_01',
    scenario = 'WORLD_HUMAN_CLIPBOARD'
}

Last updated