NR_CarPlay

A fully-featured vehicle dashboard with a custom React UI featuring YouTube music playback, GPS navigation, backup camera with proximity sensors, vehicle controls, weather display, and Discord avatar integration.

Features

Dependencies

Resource Description Required
ox_lib UI library (notifications, callbacks) Yes
xsound YouTube audio playback Yes

Installation

Step 1: Download

Download NR_CarPlay from your Tebex purchase and extract it to your resources folder:

server/
  └── resources/
      └── [nightrider]/
          └── NR_CarPlay/

Step 2: server.cfg

Add the resource to your server configuration. ox_lib and xsound must start before NR_CarPlay:

ensure ox_lib
ensure xsound
ensure NR_CarPlay

Step 3: Discord Setup (Optional)

To enable Discord avatar integration, edit Configs/sv_config.lua:

SVConfig = {}

SVConfig.Discord = {
    BotToken = "YOUR_BOT_TOKEN_HERE",
    GuildId = "YOUR_DISCORD_SERVER_ID"
}

Your Discord bot must have the Server Members Intent enabled and be a member of your Discord server.

Step 4: Configure

Edit Configs/config.lua to customize the dashboard (see Configuration section below).

Step 5: Restart

Restart your server to load the resource.

⚠️ Important

xsound must be started before NR_CarPlay in your server.cfg. Without xsound, music playback will not work.

How It Works

1. Opening the Dashboard

Enter any vehicle and press F5 (configurable keybind) or use /opendashboard to open the dashboard. The dashboard only opens when inside a vehicle.

2. Home Page

The home screen shows the current time, date, weather temperature, location name, your Discord avatar, and the music player. A header bar displays live weather and location data.

3. Music Player

Enter a YouTube URL (full, short, or just the video ID) and click Play. The script auto-detects and converts partial URLs. Features include:

4. Camera Page

The backup camera provides proximity detection using raycasts in three zones (left, right, rear). Warnings are color-coded:

Warning Level Distance Beep Interval
Green Within 5.0m 1000ms
Yellow Within 3.0m 500ms
Red Within 1.0m 200ms

The camera also tracks vehicle speed, steering angle, and reverse gear status.

5. Vehicle Controls

Control your vehicle directly from the dashboard UI:

6. GPS Navigation

When a waypoint is set on the in-game map, the dashboard displays:

Configuration

General Settings (Configs/config.lua)

Config.Keybind = 'F5'          -- Key to open dashboard
Config.UIColor = "#00FFFF"     -- Accent color (hex)
Config.Logo = "https://..."    -- Logo URL displayed in dashboard
Config.Debug = false           -- Enable debug mode

Backup Camera

Config.BackupCamera = {
    AutoActivateInReverse = false,  -- Auto-open camera in reverse
    AutoDeactivate = true,          -- Auto-close when leaving reverse
    ShowGridLines = true,           -- Display grid overlay
    ShowDistanceWarning = true,     -- Show distance warnings
    ProximityBeeping = true,        -- Audible proximity beeps
    BeepIntervals = {
        green = 1000,               -- ms between beeps (far)
        yellow = 500,               -- ms between beeps (medium)
        red = 200                   -- ms between beeps (close)
    }
}

Discord Integration

Config.Discord = {
    Enabled = true       -- Enable Discord avatar fetching
}

Config.Cache = {
    AvatarCacheTime = 300000,  -- Cache duration (5 minutes)
    RetryAttempts = 3,         -- API retry attempts
    RetryDelay = 1000          -- Delay between retries (ms)
}

Config.DefaultAvatar = "https://cdn.discordapp.com/embed/avatars/0.png"

Vehicle Controls

Config.DoorControls = {
    left_door = 0,
    right_door = 1,
    rear_left_door = 2,
    rear_right_door = 3
}

Config.WindowControls = {
    left_window = 0,
    right_window = 1,
    rear_left_window = 2,
    rear_right_window = 3
}

Config.SeatControls = {
    driver_seat = -1,
    passenger_seat = 0,
    rear_left_seat = 1,
    rear_right_seat = 2,
    rear_middle_seat = 3,
    rear_extra_seat = 4
}

Config.OtherControls = {
    trunk = 5,
    hood = 4
}

Config.SeatSwitchCooldown = 2      -- Seconds between seat switches
Config.EngineStartSound = true     -- Play sound on engine start

Custom Notifications

Config.Notifications = {
    seatCooldown = 'Please wait before switching seats again',
    seatOccupied = 'That seat is occupied',
    engineStarted = 'Engine started',
    radioOn = 'Radio turned on',
    radioOff = 'Radio turned off'
}

Server Config (Configs/sv_config.lua)

SVConfig = {}

SVConfig.Discord = {
    BotToken = "YOUR_BOT_TOKEN_HERE",   -- Discord bot token
    GuildId = "YOUR_SERVER_ID"          -- Discord server ID
}

YouTube URL Formats

The music player accepts the following formats:

-- Full URL
https://www.youtube.com/watch?v=dQw4w9WgXcQ

-- Short URL
https://youtu.be/dQw4w9WgXcQ

-- Embed URL
https://www.youtube.com/embed/dQw4w9WgXcQ

-- Video ID only
dQw4w9WgXcQ

The script auto-converts partial URLs by prepending https://www.youtube.com/watch?v=. Song title and artist are fetched automatically from YouTube's oEmbed API.

Commands

Command Description Permission
/opendashboard Open the vehicle dashboard In vehicle
/streamer Toggle streamer mode (mutes audio, UI stays functional) Everyone

Debug Commands

Available when Config.Debug = true:

Command Description
/backupcam Toggle backup camera manually
/camproximity Print proximity sensor status
/gpsinfo Print GPS waypoint debug info
/weatherinfo Print weather detection info
/debugavatar Force refresh Discord avatar
/testdiscord Test Discord API connection (server)
/clearcache Clear avatar cache (server)

Discord Bot Setup

To use Discord avatar integration:

⚠️ Security

Never share your Discord bot token. Keep sv_config.lua server-side only. The token is escrowed and cannot be accessed by clients.

Weather System

The dashboard displays real-time weather data pulled from in-game conditions:

Customization

Changing the Accent Color

Set Config.UIColor to any hex color. The entire UI theme updates dynamically:

Config.UIColor = "#00FFFF"  -- Cyan (default)
Config.UIColor = "#FF6B6B"  -- Red
Config.UIColor = "#9b59b6"  -- Purple
Config.UIColor = "#2ecc71"  -- Green

Changing the Logo

Set Config.Logo to any direct image URL. The logo appears in the top-left corner of the dashboard.

Dynamic UI Updates

Other scripts can update the UI theme at runtime using the export:

exports['NR_CarPlay']:UpdateUIConfig("#FF0000", "https://your-logo-url.png")

Troubleshooting

Dashboard not opening

No music playing

Discord avatar not showing

Backup camera beeping not working

Weather showing incorrect data

Seat switching not working

Support

For paid script support, open a ticket in our Discord server for priority assistance.