DH | Insurance

Framework Compatibility

DH Insurance works for TMC Only

Installation

  1. Download DHInsurance from your keymaster

  2. Drag the file into your resources folder and "ensure DHInsurance" in your server.cfg

  3. Make sure to configure these to in your Config.lua

Config.RequiredPoints = 1500
Config.ClaimAmount = 5000

RequiredPoints: How many points is required to get a insurance payout. 1 crash = 1 point.

ClaimAmount: How much money insurance will cover.

SQL

You need to execute this SQL into your databse


ALTER TABLE vehicles
ADD COLUMN insured BOOLEAN DEFAULT 0,
ADD COLUMN insuranceexpire DATE,
ADD COLUMN crashes INT DEFAULT 0;

Inventory/Config.lua

Add the following to your inventory/Config.lua. Under: This is to add the correct metadata to the insurance items.

    ItemDescriptionFormatters = {    
    
    ['insurancepaper'] = function(itemInfo)
        return string.format('<p> <strong>Plate: </strong><span>%s</span> <br/> <strong>Issued: </strong><span>%s</span> <br/> <strong>Expiry Date: </strong><span>%s</span></p>',
        itemInfo.plate,
        itemInfo.issued,
        itemInfo.expiry)
    end,
    ['fakeinsurance'] = function(itemInfo)
        return string.format('<p> <strong>Plate: </strong><span>%s</span> <br/> <strong>Issued: </strong><span>%s</span> <br/> <strong>Expiry Date: </strong><span>%s</span></p>',
        itemInfo.plate,
        itemInfo.issued,
        itemInfo.expiry)
    end,
    ['insurancecasefile'] = function(itemInfo)
        return string.format('<p> <strong>Plate: </strong><span>%s</span> <br/> <strong>Amount: </strong><span>%s</span></p>',
        itemInfo.plate,
        itemInfo.amount)
    end,

Adding the Items

Add the following items to your core/sharedgta.lua file

Add the images inside DHInsurance/INSTALL/images

   ["insurancepaper"] = {
        ["label"] = "Vehicle Insurance",
        ["weight"] = 0,
        ["type"] = "item",
        ["image"] = "insuranceimage.webp",
        ["unique"] = true,
        ["stackable"] = true,
        ["useable"] = true,
        ["shouldClose"] = false,
        ["description"] = "Vehicle insurance paper"
    },
    ["insurancecasefile"] = {
        ["label"] = "Case FIle",
        ["weight"] = 0,
        ["type"] = "item",
        ["image"] = "casefile.webp",
        ["unique"] = true,
        ["stackable"] = true,
        ["useable"] = true,
        ["shouldClose"] = false,
        ["description"] = "Insurance claim"
    },
    ["fakeinsurance"] = {
        ["label"] = "Vehicle Insurance",
        ["weight"] = 0,
        ["type"] = "item",
        ["image"] = "insuranceimage.webp",
        ["unique"] = true,
        ["stackable"] = true,
        ["useable"] = true,
        ["shouldClose"] = false,
        ["description"] = "Vehicle insurance paper"
    },

Radial Menu Integrations

Add the following code to your police sub menus in radialmenu/config.lua

"police:checkinsurance"

Add the following code below the other police menus. For example below this code:

    ['police:search'] = {
        title = "Search",
        icon = "magnifying-glass",
        iconCategory = 'solid',
        functionName = "police:client:SearchPlayer"
    },

Add this following code under police:search:

    ['police:checkinsurance'] = {
        title = "Insurance",
        icon = "fa-solid fa-car",
        iconCategory = 'solid',
        functionName = "DHInsurance:Client:PoliceSearchUI",
        enableMenu = function()
            return not isDead 
        end,
    },

Last updated