# Installation and configuration

{% hint style="info" %}
All commands are in the top area of the locale file
{% endhint %}

This script does not interact with your database.

## 1. Framework

If you are using ESX or QB-Core/QBox, your framework is detected automatically. You don't have to change anything. All framework functions are in the `server/cusotm.lua` file, so if you have a custom framework, you can adjust that file to make the script compatible with your server. Only change something here if you know what you are doing.

## 2. Edit Config File

Now you have to edit the config.lua file to your liking. A full preview of the config file can be found [here](/loki-scripts-documentation/loki_prescriptions/home-en/config-preview.md).&#x20;

## 2.1 General

### 2.1.1 Databse Creation

```lua
Config.CreateDatabase = true
```

This setting automatically creates the database on script startup which is recommended.

### 2.1.2 NUI Style

```lua
Config.NuiStyle = "us"
Config.TimeFormat = "en-US"
```

The NUI Style can be `us`, `uk`, or `de` and will impact how the prescription looks. The time format will be used to format the date, recommended is to use time format fitting to your nui style so `en-US`, `en-UK`, or `de-DE`.

### 2.1.3 Language

```lua
Config.Locale = 'en'
```

Simply the language used in the script. Available are `de` for german, `en` for english and `es` for spanish. You can find the translations in the locales folder and edit the files for different languages. You can also create a new one, for example `fr.lua`, paste the english translations there and then translate it yourself to have your own locale file. In case you want to contribute your translations, open a ticket on our discord and send us your file so we can include it in a future update.

### 2.1.4 Target

```lua
Config.Target = true
```

This setting will disable/enable targeting. If disabled, a simple press E to interact will be used to interact with NPCs.

### 2.1.5 Jobs & Items

```lua
Config.PrescriptionJobs = {"ambulance", "pharmacy"}
Config.PrescriptionItem = 'prescription'
Config.PrescriptionPadItem = 'prescription_pad'
```

The prescription jobs are jobs that are allowed to issue prescriptions. This can also be nil/false to disable. The prescription item is what the player receives, the prescription pad item is what the doctor needs to have to create prescriptions.

### 2.1.6 Animation

```lua
Config.Anim = {
    enabled = true,
    dict = "amb@world_human_tourist_map@male@base",
    anim = "base",
    prop = {
        model = `prop_notepad_02`,
        bone = 28422,
        offsets = {0.1, 0.0, 0.0},
        rotations = {50.0, 0.0, 0.0}
    }
}
```

This animaion is played when the doctor is actively editing a prescription.

## 2.2 Medicine

```lua
Config.Medicine = {
    {
        item = 'tylacare',
        label = "Tylacare",
        cost = 200
    },
    {
        item = 'flurimax',
        label = "Flurimax",
        cost = 250
    },
    ....
}
```

These are all the medicines that can be chosen from in the prescription. Item is the recieved item from the pharmacy, label is shown in the NUI and cost is the price at the pharmacy.

## 2.4 Insurance

```lua
Config.Insurance = {
    duration = 60 --[[seconds]] * 60 --[[minutes]] * 24 --[[hours]] * 7 --[[days]], 
    reduction = 0.35,
    npc = {
        position = vector4(-291.5244, -430.6360, 29.2375, 341.2159),
        model = `ig_andreas`,
        anim = {dict = "amb@world_human_hang_out_street@female_arms_crossed@idle_a", anim = "idle_a", flags = 17}
    },
    blip = {
        sprite = 276,
        color = 3,
        label = "Health Insurance",
        shortRange = true,
        display = 4,
        scale = 1.0
    }
}
```

The duration is how long the insurance lasts after buying in seconds. Reduction indicates how much the price of medicine is reduced when having a prescription. 0.35 means 35% off.

## 2.5 Pharmacies

```lua
Config.Pharmacies = {
    { -- location inside our partners MLO: https://wx-maps.com/package/odeas-pharmacy
        position = vector4(-824.3629, -1116.6631, 10.1457, 271.4320),
        pedModel = `s_m_m_doctor_01`,
        anim = {dict = "amb@world_human_hang_out_street@female_arms_crossed@idle_a", anim = "idle_a", flags = 17},
        blip = {sprite = 153, color = 2, label = "Pharmacy", shortRange = true, display = 4, scale = 1.0}
    },
    {
        position = vector4(343.5782, -1398.8131, 31.5092, 50.1448),
        pedModel = `s_m_m_doctor_01`,
        anim = {dict = "amb@world_human_hang_out_street@female_arms_crossed@idle_a", anim = "idle_a", flags = 17},
        blip = {sprite = 153, color = 2, label = "Pharmacy", shortRange = true, display = 4, scale = 1.0}
    },
    ....
}
```

These are the locations of pharmacy NPCs where players can get their medicine.

## 2.3 Notifications

```lua
Config.Notification = 'esx'

function CustomNotify(type, msg, heading, src)
    print('customNotify')
end

```

These are you notification settings. Chose the script you use for notifications. If yours is not listed, add support for it yourself using the custom function (serversided).

## If you have any questions, open a ticket on our discord. If your script is not supported, you can ask us and we will try to add native support for it. <https://discord.gg/CfnuaArDBk>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lokiscripts.com/loki-scripts-documentation/loki_prescriptions/home-en/installation-and-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
