> For the complete documentation index, see [llms.txt](https://codestudio5m.gitbook.io/codestudio/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codestudio5m.gitbook.io/codestudio/our-scripts/car-radio-car-play-pro/setup.md).

# Setup

This is a detailed setup guide for Car Play Pro. If you have any questions before making a purchase, you can contact us on Discord

## Installation

1. **Download & Extract**: Place the script in your `resources` folder
2. **Note:** Ensure that [**xsound** ](https://github.com/Xogy/xsound/archive/refs/tags/1.4.3.zip)is installed and running. *(Required Dependency)*
3. **Add to Server CFG**: Add `ensure cs_carplay` & `ensure xsound` in your `server.cfg`
4. **Configure Settings**: Modify `config.lua` as needed
5. **Add Inventory Items `(Only QB & ESX) (Optional)`**:
   * **Ox Inventory:** Add the following to `ox_inventory/data/items.lua`:

     ```lua
     ['carplay'] = {
         label = 'Car Play',
         weight = 500,
         stack = false,
         description = "A CarPlay device"
     },
     ['radioinstaller'] = {
         label = 'Radio Installer',
         weight = 500,
         stack = false,
         description = "Used to install CarPlay devices into vehicles"
     },
     ```
   * **QB Inventory:** Add the following to `qb-core/shared/items.lua`:

     ```lua
     ["carplay"] = { 
         name = "carplay", 
         label = "Car Play", 
         weight = 500, 
         type = "item", 
         image = "carplay.png", 
         unique = true, 
         useable = true, 
         shouldClose = true, 
         description = "A CarPlay device"
     },
     ["radioinstaller"] = { 
         name = "radioinstaller", 
         label = "Radio Installer", 
         weight = 200, 
         type = "item", 
         image = "radioinstaller.png", 
         unique = false, 
         useable = true, 
         shouldClose = true, 
         description = "Used to install CarPlay devices into vehicles." 
     },

     ```
   * **ESX Inventory:** Run the following SQL query in your database:

     ```lua
     INSERT INTO items (name, label, weight, rare, can_remove) VALUES 
     ('carplay', 'Car Play', 1, 0, 1),
     ('radioinstaller', 'Radio Installer', 1, 0, 1);
     ```

## Configuration

Modify the `config.lua` file to customize the script:

#### General Framework Settings

```lua
CodeStudio.ServerType = 'QB'  -- Choose the framework:
                              -- 'QB' for QBCore Framework
                              -- 'ESX' for ESX Framework
                              -- false for Standalone Mode
```

## Car Play Access

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FbXnjtuiJ1reFcd8W1coC%2Fimage.png?alt=media&amp;token=85d17148-51bc-48b6-afa8-f4107b55d038" alt=""><figcaption></figcaption></figure>

* **UseWithCommand** → Enables or disables CarPlay activation using a chat command (default: `/carplay`). If enabled, players can type the command to open CarPlay.
* **UseWithKey** → Allows players to open CarPlay using a keybind (default: `J`). If disabled, the keybind will not work.
* **UseWithItem** → Restricts CarPlay usage to an inventory item (`carplay`). If enabled, players must have the item in their inventory to use CarPlay.
* **Restrict\_Radio** → Limits CarPlay access to specific **jobs, gangs, Ace permissions, or Discord roles**. If left empty, everyone can use it.
* **RadioInstall** → Requires mechanics to **install CarPlay in vehicles manually** before it can be used. Optionally, this can be restricted to **only player-owned vehicles** and requires specific items (`carplay` and `radioinstaller`)

## Extra Options

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FqYxiwJQ5B4UMjMkI6nIO%2Fimage.png?alt=media&amp;token=40c58fab-25db-473c-8a20-a39f00966589" alt=""><figcaption></figcaption></figure>

## Discord Logs

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FBBqpypOvV0WQnf8Lfkuw%2Fimage.png?alt=media&amp;token=c7945977-fa18-4300-99a2-f80f344a9c72" alt="" width="375"><figcaption></figcaption></figure>

Every time a player plays music in CarPlay, it will **send a log message** to the specified Discord channel

## Default Playlist

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2Fc65tpi5ph3hjgfRGNUQg%2Fimage.png?alt=media&amp;token=43041de9-addd-4781-a3a7-0ee244182668" alt="" width="563"><figcaption></figcaption></figure>

When players open CarPlay, they will see these **preloaded songs** and can play them instantly

## Restriction System

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FcNZJLwth47eEqxfswdlO%2Fimage.png?alt=media&amp;token=d1f0e717-dda6-4039-8737-fdb8b01d16e1" alt="" width="563"><figcaption></figcaption></figure>

This setting controls **which vehicles can or cannot** use the **CarPlay system**. You can either **blacklist** (block) or **whitelist** (allow only specific vehicles).

## Free Google AI Integration → [Click For Tutorial Guide](https://youtu.be/Gu3L9mqwBYc?si=8C3qtkLEtrymhky7)

<figure><img src="https://1034396727-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FBXIsRWbAXJHBnjtE4Gxk%2Fuploads%2FdZjJ6bzll0eSMBYWcBe1%2Fimage.png?alt=media&amp;token=614ef193-660a-46a8-bb47-00ef8807d07b" alt=""><figcaption></figcaption></figure>

* **`EnableAIChat = false`** → Enables or disables AI chat inside CarPlay.
* **`apiKey = "YOUR_GOOGLE_GEMINI_API_KEY"`** → Replace with your **Google Gemini API key** to activate AI chat.
* **`model = "gemini-2.0-flash"`** → AI model to use (`"gemini-1.5-pro"` for better responses).
