# Installation

{% stepper %}
{% step %}

#### Install

Install the resource on your Keymaster after purchasing the script. <mark style="color:$primary;">(</mark>[<mark style="color:$primary;">https://portal.cfx.re/</mark>](https://portal.cfx.re/)<mark style="color:$primary;">)</mark>&#x20;

{% endstep %}

{% step %}

#### Drag And Drop

Please place the carplay resource on your base.

{% endstep %}

{% step %}

### Start

Next, please ensure that the carplay resource is included in your `server.cfg` or `resources.cfg`.

{% endstep %}

{% step %}

### Config script

You must first add your YouTube API key in the *`server.cfg`* file (the instructions are available in the README included with the script). Once this is done, you can configure the CarPlay settings in the *`config.lua`* file.
{% endstep %}
{% endstepper %}

<details>

<summary>Here is the <code>config.lua</code> file. ESX/QB</summary>

```lua
-----------------------------------------------
-- PCarplay - Main Configuration
-- Configuration principale
-----------------------------------------------

Config = {}

-----------------------------------------------
-- Debug Mode / Mode Debug
-----------------------------------------------
Config.Debug = false

-----------------------------------------------
-- Framework / Framework
-----------------------------------------------
Config.Framework = 'ESX' -- ESX / QBCore
-- FR: Framework utilisé (ESX ou QBCore)
-- EN: Framework used (ESX or QBCore)

-----------------------------------------------
-- ESX Version / Version ESX
-----------------------------------------------
Config.ESXVersion = 'new' -- 'old' / 'new'
-- FR: Version d'ESX ('old' = getSharedObject via TriggerEvent, 'new' = getSharedObject via export)
-- EN: ESX Version ('old' = getSharedObject via TriggerEvent, 'new' = getSharedObject via export)

-------------------------------------------------
--  Langue / Language
-------------------------------------------------
Config.Locale = 'en' -- fr / en / de / es / ru / zh
-- FR: Langue utilisée pour les messages et traductions
-- EN: Language used for messages and translations


-----------------------------------------------
-- ESX Resource Name / Nom de la ressource ESX
-----------------------------------------------
Config.ESXResource = 'es_extended'

-----------------------------------------------
-- QBCore Resource Name / Nom de la ressource QBCore
-----------------------------------------------
Config.QBResource = 'qb-core'

-----------------------------------------------
-- Notification System / Système de notifications
-----------------------------------------------
Config.Notifs = 'ESX' -- ESX / QB / PNotif / Custom
-- FR: Type de système de notifications utilisé
-- EN: Type of notification system used
-- ESX: Utilise les notifications ESX natives
-- QB: Utilise les notifications QBCore
-- PNotif: Utilise le système PNotif
-- Custom: Utilise un système personnalisé

-----------------------------------------------
-- Inventory System / Système d'inventaire
-----------------------------------------------
Config.Inventory = 'auto' -- auto / default / ox / qs / qb
-- FR: Système d'inventaire utilisé (auto = détection automatique)
-- EN: Inventory system used (auto = automatic detection)

-----------------------------------------------
-- Restricted Item / Item Restreint
-----------------------------------------------
Config.RestrictedItem = {
    enabled = true,
    itemName = 'carplay_device'
}
-- FR: Si enabled = true, les joueurs doivent avoir l'item pour utiliser CarPlay
-- EN: If enabled = true, players must have the item to use CarPlay
-- itemName: Nom de l'item requis

-----------------------------------------------
-- CarPlay Command / Commande CarPlay
-----------------------------------------------
Config.Command = 'carplay'

-----------------------------------------------
-- Audio Settings / Paramètres Audio
-----------------------------------------------
Config.MaxDistance = 10.0

Config.Volume = {
    default = 50,
    min = 0,
    max = 100
}

Config.AllowedInVehicle = true

Config.ShareWithPassengers = true

Config.FadeOutDistance = true

Config.FadeStart = 3.0

-----------------------------------------------
-- UI Settings / Paramètres Interface
-----------------------------------------------
Config.UIPosition = {
    enabled = true,
    x = 50,
    y = 50
}

-------------------------------------------------
-- Traductions / Locales
-------------------------------------------------
LOCALES = {}

function _U(str, ...)
    if LOCALES[Config.Locale] ~= nil then
        if LOCALES[Config.Locale][str] ~= nil then
            return string.format(LOCALES[Config.Locale][str], ...)
        else
            return 'Translation [' .. str .. '] does not exist'
        end
    else
        return 'Locale [' .. Config.Locale .. '] does not exist'
    end
end

```

</details>
