> For the complete documentation index, see [llms.txt](https://docs.thummie.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.thummie.com/docs/vision/finance/installation.md).

# Installation

{% hint style="warning" %}
It is important to follow all the steps for the script to work properly
{% endhint %}

* Download and unzip vision\_finance.zip
* Add "ensure vision\_finance" to your server.cfg
* Import the finance.sql into your databse.
* Follow the steps on this page
* (re)start your server and enjoy

#### How to import SQL

If you don't understand how this works why are you creating a fivem server? But for you fools you can download HeidiSQL, open the database and press ***file > Load SQL File (select finance.sql) > Run SQL File (select finance.sql)*** and you are done.

#### Server-sided exports

{% hint style="info" %}
Before implementing make sure you understand how these work
{% endhint %}

```lua
-- Update a loan, all the values can be skipped to leave them the same (not recomended)
exports.vision_finance:UpdateLoan(loanId, {
    amount_paid = 0,
    remaining_amount = 15000,
    periods_paid = 1,
    periods_remaining = 6,
    last_payment_date = os.date('%Y-%m-%d %H:%M:%S'),
    next_payment_date = os.date('%Y-%m-%d %H:%M:%S', os.time() (7 * 24 * 60 * 60)) -- Example for 1 week
}

-- update the status of a loan
exports.vision_finance:UpdateLoan(loanId, {
    status = 'suspended'
}
```

#### Status types

There are six types for status, each has influence on the possible payments for a player.

```lua
'active' -- Current loan is active
'reminder' -- Player has 3 days left to pay for the missed period.
'suspended' -- After 3 days of not paying the 'reminder' the loan is suspended.
'repossessed' -- Within a day of the suspended loan the vehicle or house will be repossessed.
'completed' -- All payments have been made, the property or vehicle is paid off and is now yours
'cancelled' -- The loan is cancelled by the player, any paid money is lost as well as the property or vehicle.
```

#### Add new rod types (optional)

```lua
Config.Rods = {
    ['pro_rod'] = {
        label = locale('rod.pro'),
        modifier = 1.8  -- x1.8 (Almost double)
    }
}
```
