Skip to main content

Installation

Step-by-step installation guide for Code9 Carplay V2

This section

Installation

This guide walks through every step required to get Carplay V2 running on your server: dependencies, resource extraction, database, optional Discord bot setup, optional inventory item registration, and configuration.

Requirements

DependencyRequired?Notes
oxmysqlYesDatabase driver — used by all SQL queries
code9_soundYes3D positional audio engine for the music player + equalizer (ships with the bundle)
code9_carplayPropYes (for DUI)Streams the in-vehicle screen prop (mdigou_boombox_car_prop_02) used by the DUI screen feature. Not strictly required if Config.Screen.enabled = false and you don't use the in-world screen at all
FiveM Server 5848+YesMinimum artifact version
es_extendedOptionalESX framework support (auto-detected)
qb-coreOptionalQBCore framework support (auto-detected)
qbx_coreOptionalQBox framework support (auto-detected)
ox_libOptionalUsed only when Config.NotificationSystem = "ox_lib"

Steps

1. Extract Resource

Place the code9_carplayv2 folder into your server's resources/ directory. The folder name must remain code9_carplayv2 — it is referenced by the in-vehicle DUI screen URL.

2. Add to server.cfg

ensure oxmysql
ensure es_extended # or qb-core / qbx_core, depending on your framework
ensure code9_sound
ensure code9_carplayProp # only needed if you use the in-vehicle screen
ensure code9_carplayv2

3. Database

There is no manual SQL import required — the script creates all tables automatically on first server boot via oxmysql.query.await. The following tables are created:

TablePurpose
code9_carplay2Per-player settings, liked songs, playlist, volume
code9_carplay2_mileageInternal mileage tracking (per plate)
code9_carplay2_dashcamUploaded dashcam / security cam recordings

If you prefer manual SQL import, the same schema is in the included data.sql file.

4. Open shared/config.lua

This is the main config file and contains every public option (everything except secrets). Set:

  • Config.Locale"en", "tr", "es", "de", "fr", "nl", "pt" (or add your own — see Locale System)
  • Config.IdentifierType"license", "steam", "discord", "license2"
  • Config.NotificationSystem"gta", "ox_lib", "esx", "qb"
  • Config.FuelSystem — your fuel resource
  • Config.VehicleLockSystem — your key/lock resource
  • Config.MileageSystem"auto", "internal", "jg-vehiclemileage", "cd_garage"
  • Config.InventorySystem"auto" or a specific provider

See General Settings for the full list.

5. Open server/config.lua (Secrets)

This is the server-only config file. It is escrow-ignored, so server owners can edit it. Add:

lua
ServerConfig.YouTubeAPIKey = "YOUR_YOUTUBE_API_KEY" -- required for music search

YouTube API key is free — get one at console.cloud.google.com and enable YouTube Data API v3.

For optional features, set:

  • ServerConfig.DiscordBotToken + DiscordGuildId — for Discord role permissions (see step 7)
  • ServerConfig.DashCamFivemanageApiKey — for dashcam recording uploads
  • ServerConfig.DashCamDiscordWebhook — alternative upload method (25MB Discord limit)
  • ServerConfig.SecurityCamFivemanageApiKey / SecurityCamDiscordWebhook — separate destinations for security cam (or leave empty to use dashcam settings)

See Server Config for the full list.

6. Choose How Players Open Carplay

In shared/config.lua, you have three opening methods:

Option A — Command (default)

lua
Config.Command = "carplay"
Config.UseItem = false

Players type /carplay in chat while in the driver seat.

Option B — Keybind

lua
Config.EnableKey = true
Config.DefaultKey = "F10"
Config.BindingDescription = "Open Carplay"
Config.UseItem = false

The keybind appears under Settings → Keybinds → FiveM in-game where players can rebind it.

Option C — Inventory Item

lua
Config.UseItem = true
Config.ItemName = "carplay"

When item-based opening is enabled, the command and keybind are automatically disabled. You then need to register the item in your inventory:

For ox_inventory

Add to ox_inventory/data/items.lua:

lua
['carplay'] = {
label = 'Carplay',
weight = 100,
server = {
export = 'code9_carplayv2.carplayItem'
},
},
For qs-inventory

The script automatically calls exports['qs-inventory']:CreateUsableItem('carplay', ...) on resource start. Just make sure the item exists in your qs-inventory items list.

For codem-inventory

Same as qs-inventory — automatically registered via exports['codem-inventory']:CreateUsableItem.

For ESX / QBCore / QBox

The script automatically calls ESX.RegisterUsableItem / QBCore.Functions.CreateUseableItem / QBX.Functions.CreateUseableItem on resource start. Just make sure the item exists in your items table or items config.

7. (Optional) Discord Role Permissions

If you want per-feature, per-app Discord role gating (in addition to job-based gating), set up a Discord bot:

  1. Go to discord.com/developers/applicationsNew Application
  2. Add a Bot to the application and copy the Bot Token
  3. Under Privileged Gateway Intents, enable Server Members Intent
  4. Invite the bot to your Discord server with the bot scope and at minimum View Server Members permission
  5. Right-click your Discord server → Copy Server ID (enable Developer Mode if needed)
  6. In server/config.lua:
lua
ServerConfig.DiscordBotToken = "YOUR_BOT_TOKEN"
ServerConfig.DiscordGuildId = "YOUR_GUILD_ID"
ServerConfig.DiscordCacheDuration = 120 -- seconds

The script's built-in fetcher will pull each player's Discord roles via the Discord API and cache them. You can then reference role IDs in any discordRoles array throughout Config.

To get a role ID: in Discord with Developer Mode on, right-click any role → Copy Role ID.

8. (Optional) Camera Recording Uploads

If you want DashCam or Security Camera recordings uploaded to permanent storage:

  1. Sign up at fivemanage.com
  2. Create an API key with video upload permission
  3. In server/config.lua:
lua
ServerConfig.DashCamUploadProvider = "fivemanage"
ServerConfig.DashCamFivemanageApiKey = "YOUR_API_KEY"

Discord Webhook (25MB limit, ~1.5 min recording)

  1. In your Discord server, create a channel for recordings
  2. Channel settings → Integrations → Webhooks → New Webhook → copy the URL
  3. In server/config.lua:
lua
ServerConfig.DashCamUploadProvider = "discord"
ServerConfig.DashCamDiscordWebhook = "YOUR_WEBHOOK_URL"

9. (Optional) In-Vehicle Screen Prop

The DUI screen mounts a physical prop onto the vehicle dashboard which mirrors the tablet live. This is opt-in:

lua
Config.Screen.enabled = true
Config.Screen.requiredToUse = false -- set true to require a screen item to use Carplay
Config.Screen.item = 'carplay_screen' -- inventory item name

The default prop is mdigou_boombox_car_prop_02 — change Config.Screen.propModel, textureDict and textureName to use your own.

See In-Vehicle Screen Settings for full details.

10. Restart Server

Restart your server (or just ensure code9_carplayv2). The first time you open Carplay, you will see the setup wizard — name, avatar, theme. After that you land on the home screen.

Verification Checklist

After installation, verify each of these works:

  • /carplay opens the tablet inside a vehicle
  • First-run wizard appears for new players
  • All apps are accessible from the sidebar
  • Music search works (YouTube API key set?)
  • DashCam recording uploads to Fivemanage / Discord (if enabled)
  • Discord roles show up correctly (if enabled — check F8 console for [DISCORD] logs)
  • Locale strings match your Config.Locale setting
  • Resource usage is 0.00–0.02 ms idle (resmon in F8)

If any check fails, set Config.DebugPrint = true in shared/config.lua and restart — verbose logs will appear in the F8 console with [code9_carplay2] prefixes.