FiveM car radio script

Car Radio documentation

Car radio for FiveM: play YouTube or direct audio links from any car. The music comes out of the car itself and everyone nearby hears the same song at the same moment (players who arrive late join mid-song).

Features

  • 🎛️ Car stereo panel: play / pause, previous / next, stop, volume, repeat (off / all / one), shuffle.
  • 🎵 Real song titles, artist and cover on the display (YouTube oEmbed — no API key needed).
  • 📜 Queue: "Play now" or "Queue", jump to / remove any song, up to 30 songs per car.
  • ⭐ Favorites per player (saved on their PC), queue them all with one click.
  • 🔊 3D sound on the car, heard by everyone around it and fully synced.
  • 🚪 Muffled outside the car: quieter with everything closed, louder with windows down, doors open, convertible roof down or on bikes.
  • 💿 Local station: drop your own MP3s in the music/ folder and they appear in the Emisora local / Local station tab of the radio (you can rename it). Anyone can play them, queue them, search them or press Play all. No internet link that can break: the files come with the resource.
  • 📻 Live channels with a DJ: a DJ broadcasts on "Radio Ciudad" (or any channel you create) and every car tuned to it plays the same song at the same time. /radiodj opens the DJ booth.
  • ⌨️ Quick keys without opening the panel: volume up / down, pause, next song (rebindable).
  • 👥 The driver decides if the front passenger can use the radio.
  • 🔑 Engine off: the music pauses and resumes when the engine starts (or stops, configurable).
  • 🚫 Restrictions: blocked vehicle classes and models, optional car stereo item that must be installed in the car (with an export for mechanic scripts).
  • 🛡️ Anti-spam and moderation: cooldown between songs, blacklist of links / words, Discord logs, admin commands /radiooff, /radiooffall and /radiomusica (list the local station songs).
  • 🔇 Optional: game radio always off in every vehicle.
  • 🌍 Spanish and English included (locales/), framework agnostic (QBCore, Qbox or standalone).

Dependencies

Installation

  1. Put rolo_carradio in your resources folder.
  2. In server.cfg, after ox_lib and xsound:
    ensure rolo_carradio
    
  3. Permissions (optional, ace):
    add_ace group.admin rolo_carradio.admin allow   # /radiooff, /radiooffall, /radiomusica
    add_ace group.admin rolo_carradio.dj allow      # /radiodj
    
    Framework admins are detected automatically; DJs can also be given by job (Config.DJJobs).
  4. Restart the server. In game: /radio inside a car (or bind a key in Settings > Key Bindings > FiveM).

Local station (your own MP3s)

  1. Put your .mp3 / .ogg / .m4a files in rolo_carradio/music/ (no subfolders).
  2. Name them Artist - Song.mp3 to show the artist and the song.
  3. restart rolo_carradio. The console prints how many songs it found.

Players download these files with the resource, so keep them at normal quality (128-192 kbps). The folder is read with the file API that ships with FXServer (server/music_list.js, Node's fs): no shell or console command is used, so it works on Windows and Linux hosts alike. If the console still says 0 songs while the folder has files, list the file names in Config.LocalStation.songs.

A song doesn't show up?

  1. The file goes directly in rolo_carradio/music/ (no subfolder) and ends in .mp3, .ogg or .m4a (upper case works too).
  2. After adding songs run refresh and then restart rolo_carradio (or restart the server). The players download the new files when the resource starts.
  3. Look at the server console on start: rolo_carradio: X canción(es) en music/.
    • 0 and a red line saying it can't find songs: the server couldn't read the folder. Write the file names in Config.LocalStation.songs = { 'Artista - Cancion.mp3' }.
    • "ninguno es .mp3": the files have another extension.
  4. /radiomusica (admin, or the server console) reads the folder again and prints the list of songs.
  5. Admins opening the radio see in the empty "Emisora local" tab why it's empty (host can't read the folder / no audio files / folder empty) and what to do. Players only see "no songs yet".

Optional car stereo item

  • qb-inventory / QBCore: registered automatically as a usable item.
  • ox_inventory / origen_inventory: add to the item client = { export = 'rolo_carradio.useStereo' }.
  • Image: copy items/images/car_stereo.png into your inventory's images folder.

Other scripts can manage stereos with:

exports['rolo_carradio']:InstallStereo(plate)
exports['rolo_carradio']:HasStereo(plate)
exports['rolo_carradio']:RemoveStereo(plate)

Configuration (config.lua)

Option What it does
Config.Locale 'es' or 'en'
Config.Framework / Config.Inventory 'auto' detects them; 'custom' = your own in bridge/server.lua
Config.Notify / Config.TextUI / Config.Progress 'auto' uses rolo_notify when it runs; 'custom' = your own in bridge/client.lua
Config.Command / Config.Key / Config.QuickKeys commands and default keys
Config.PassengerControl front passenger allowed by default
Config.BlockedClasses / Config.BlockedModels vehicles without radio
Config.Stereo stereo item required to use the radio
Config.Distance / Config.MaxVolume / Config.OutsideVolume how it sounds
Config.EngineOff 'pause', 'stop' or 'none'
Config.MaxQueue / Config.PlayCooldown / Config.Blacklist queue and anti-spam
Config.Stations fixed station buttons
Config.LocalStation the local station tab (your MP3s in music/): on / off, name, shuffle for Play all
Config.Channels / Config.DJJobs live channels and who can DJ
config_server.lua Discord logs webhook (server only)

Open files (not escrowed)

  • config.lua
  • locales/*.lua — every text of the script and the panel
  • bridge/client.lua — notifications, progress bar
  • bridge/server.lua — framework detection, admin / DJ permissions, items, Bridge.CanUseRadio, Discord logs

Notes

  • Some YouTube videos block playback outside YouTube (mostly music labels); those links won't play.
  • The real audio is played by xsound, so the equalizer on the display is an animation (it moves while music plays).
  • The music belongs to the car: if the car is deleted or stored, it stops.
  • No shell commands: the local station lists music/ with FXServer's built-in Node file API (server/music_list.js, readable).

ROLO SCRIPT · Support and updates on our Discord.

Secrets: config_server.lua

Discord webhooks and API keys go in config_server.lua, not in config.lua. config.lua is sent to every player's game (FiveM shares it), so anything in it can be read by a cheater; config_server.lua is loaded only by the server. Paste your webhooks there and leave config.lua without secrets.

Stuck?

Write to us in the Discord support channel with the script, your framework and the console error.