# QBCore Installation

## Framework Compatibility

DH Insurance works for QBCore

## Installation

1. Download DHInsuranceQB from your keymaster
2. Drag the file into your resources folder and "ensure DHInsuranceQB" in your server.cfg
3. Make sure to configure these to in your Config.lua

```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 database

```sql

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

```

## Items

Add the following items to qb-core/shared/items.lua

add the images from INSTALL/ folder into your inventory script.

```lua

 insurancepaper = {
    name = 'insurancepaper',
    label = 'Insurance',
    weight = 0,
    type = 'item',
    image = 'insurancepaper.png',
    unique = true,
    useable = true,
    shouldClose = false,
    description = 'Permit to show you can drive a vehicle',
    metadata = {
        plate = '',
        issued = '',
        expiry = ''
    }
},

fakeinsurance = {
    name = 'fakeinsurance',
    label = 'Insurance',
    weight = 0,
    type = 'item',
    image = 'insurancepaper.png',
    unique = true,
    useable = true,
    shouldClose = false,
    description = 'Permit to show you can drive a vehicle',
    metadata = {
        plate = '',
        issued = '',
        expiry = ''
    }
},
insurancecasefile = {
    name = 'insurancecasefile',
    label = 'Case file',
    weight = 0,
    type = 'item',
    image = 'casefile.png',
    unique = true,
    useable = true,
    shouldClose = false,
    description = 'Casefile for insurance',
    metadata = {
        plate = '',
        amount = 0,
    }
},

```

## Integrations

Event to trigger to show the menu: (this is a client event)

```lua
"DHInsurance:Client:OpenUI"
```

Event to close the menu: (this is a client event)

```lua
"DHInsurance:Client:CloseUI"
```

You can integrate this to radial menus, or other ways to toggle the menu. In our script its by default by interacting with a ped. also option for a command. We are happy to help you with your integration if you need some help.
