ScriptsM CarRadio

ScriptsM Car Radio

Hi there! Today i wanna present my realistic Car Radio system for you! This script improves default gta 5 radio, adding 3 types of Radio and UI with different features. Signal system, radio noise, station tuning, radio theft & more! Everything for real realism and atmosphere is here!

Installation

Download a resource (opens in a new tab) from keymaster or buy it by buttons at the top

Install all resource dependencies

Resource start order

It's important for your resources to start in a logical order to prevent errors from missing dependencies.

start oxmysql
start your_framework
start interact-sound
start Radio

Set up the InteractSound (opens in a new tab)

To get sounds working, you need to install sound files from zip archive following this guide:

  1. Add radiobug.ogg and radiotune.ogg from zip archive to InteractSound/client/html/sounds
  2. Open __resource.lua and modify following portion:
files({
    'client/html/index.html',
    'client/html/sounds/*'
    ...
})
  1. Now you are done with sounds

Set up database

To get script working with Config.UseItems enabled you need to setup database

Import radio.sql from resource to your database.

If you don't wanna use Config.UseItems, delete @oxmysql/lib/MySQL.lua from fxmanifest.lua

Setup server.lua

  1. Open server.lua in our script
  2. Modify following code
for _, item in ipairs(Config.RadioItems) do
    ESX.RegisterUsableItem(item.name, function(source)
    	TriggerClientEvent('InstallRadio', source, item)
    end)
end
 
for _, item in ipairs(Config.RadioItems) do
    QBCore.Functions.CreateUseableItem(item.name, function(source)
      TriggerClientEvent('InstallRadio', source, item)
    end)
end
  1. If you don't using any frameworks replace code to this:
--[[for _, item in ipairs(Config.RadioItems) do
    ESX.RegisterUsableItem(item.name, function(source)
    	TriggerClientEvent('InstallRadio', source, item)
    end)
end
 
for _, item in ipairs(Config.RadioItems) do
    QBCore.Functions.CreateUseableItem(item.name, function(source)
      TriggerClientEvent('InstallRadio', source, item)
    end)
end--]]
  1. If you using esx:
for _, item in ipairs(Config.RadioItems) do
    ESX.RegisterUsableItem(item.name, function(source)
    	TriggerClientEvent('InstallRadio', source, item)
    end)
end
 
--[[for _, item in ipairs(Config.RadioItems) do
    QBCore.Functions.CreateUseableItem(item.name, function(source)
      TriggerClientEvent('InstallRadio', source, item)
    end)
end--]]
  1. If you using qb:
--[[for _, item in ipairs(Config.RadioItems) do
    ESX.RegisterUsableItem(item.name, function(source)
    	TriggerClientEvent('InstallRadio', source, item)
    end)
end--]]
 
for _, item in ipairs(Config.RadioItems) do
    QBCore.Functions.CreateUseableItem(item.name, function(source)
      TriggerClientEvent('InstallRadio', source, item)
    end)
end

Config

There you can find an config of resource with description for all params

Config = {}
 
Config.RadioItems = { -- Radio items for frameworks
	{name = 'oldradio', type='old'}, -- name is item name, type is old / normal / auto
	{name = 'normalradio', type='normal'},
	{name = 'autoradio', type='auto'},
}
 
Config.Framework = 'esx' -- esx / qb / none
 
Config.UseItems = true -- Use radio items for frameworks
 
Config.ProgressBarInstall = function() -- progress bar for installing radio export
local UseProgress = true
local time = 3000
--[[
Just an example, do it like this
exports.rprogress:Custom({
	Label = 'Installing radio',
    Radius = 30,
    Stroke = 30,
    ShowTimer = false,
})
--]]
if UseProgress == false then time = 0 end
return time
end
 
Config.ProgressBarRemove = function() -- progress bar for removing radio export
local UseProgress = true
local time = 6000
--[[
Just an example, do it like this
exports.rprogress:Custom({
	Label = 'Removing radio',
    Radius = 30,
    Stroke = 30,
    ShowTimer = false,
})--]]
if UseProgress == false then time = 0 end
return time
end
 
Config.NoRadio = function() -- Notification when removing non-existing radio
	-- no radio in vehicle notify
end
 
Config.Locales = { -- localization
	['command_description'] = 'Remove radio from car', -- /removeradio command description
}
 
Config.RadioTypes = { -- Radio type in different vehicle. To use this you need to turn off Config.UseItems
	{hash = 'towtruck2', type='old'}, -- hash is vehicle model name, type is old / normal / auto
	{hash = 'utillitruck3', type='normal'},
	{hash = 'sadler2', type='normal'},
	{hash = 'utillitruck', type='normal'},
	{hash = 'tractor2', type='old'},
	{hash = 'utillitruck2', type='normal'},
	{hash = 'sadler', type='normal'},
	{hash = 'towtruck', type='old'},
	{hash = 'tractor3', type='old'},
	{hash = 'scrap', type='old'},
  -- ... more in full version