HEX
HexscriptsPhone AppsRadio App

Configurations

Here you will get all configurations & open source files that are included within this script.

Config Files

Config = {}

Config.Debug = false -- Set to true to enable debug messages in the console
Config.Locale = 'automatic' -- automatic, en, de, es, fr, it, nl, pl, pt, tr, ar
Config.Framework = 'automatic' -- automatic, esx, qbcore, standalone
Config.VoiceSystem = 'automatic' -- automatic, saltychat, 'pma-voice'

Config.Item = {
    name = 'phone', -- The item name of the phone in your database
    remove = true -- If the player has no phone, remove it from the radio.
}

Config.LeaveRadioWhenDead = false -- If true, the player will leave the radio when they die. If false, they will stay in the radio when they die.

Config.UseSecondary = true

Config.RadioAccess = {
    ['1'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['2'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['3'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['4'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['5'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['6'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['7'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['8'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['9'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['10'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['11'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['12'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['13'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['14'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['15'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'Anwaeltemanson', 'LSFD', 'mkj' },
    ['16'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['17'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['18'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['19'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['20'] = { 'finance', 'abschlepper' },
    ['21'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'Senat', 'LSFD', 'mkj' },
    ['23'] = { 'finance', 'police', 'ambulance', 'fib', 'sheriff', 'army', 'shadowops', 'Doj', 'Ssmc', 'navy', 'ANWAELTELAWRENCE', 'Senat', 'LSFD', 'mkj' },
    ['25'] = { 'finance', 'taxi' },
    ['1337'] = { 'finance' },
    ['777'] = { 'finance', 'casino' },
    ['23316'] = { 'finance', 'lsc' },
}

Opensource Files

if Config.Framework ~= 'esx' then return end

local ESX = nil

function loadFramework()
    local status, ESXLOAD = pcall(function()
        return exports['es_extended']:getSharedObject()
    end)

    ESX = ESXLOAD

    if not status then
        while not ESX do
            TriggerEvent("esx:getSharedObject", function(object) ESX = object end)
            Citizen.Wait(50)
        end
    end

    while ESX.GetPlayerData().job == nil do
        Citizen.Wait(50)
    end

    while not ESX.IsPlayerLoaded() do
        Citizen.Wait(50)
    end

    ESX.PlayerData = ESX.GetPlayerData()
end

function TriggerServerCallback(name, cb, ...)
    ESX.TriggerServerCallback(name, function(result)
        cb(result)
    end, ...)
end

RegisterNetEvent('esx:setJob', function(job)
    ESX.PlayerData.job = job
end)

function GetJobName()
    return ESX.PlayerData.job.name
end

RegisterNetEvent('esx:addInventoryItem', function(item, count)
	for k, v in ipairs(ESX.PlayerData.inventory) do
		if v.name == item then
			ESX.PlayerData.inventory[k].count = count
			break
		end
	end
end)

RegisterNetEvent('esx:removeInventoryItem', function(item, count)
	for k, v in ipairs(ESX.PlayerData.inventory) do
		if v.name == item then
			ESX.PlayerData.inventory[k].count = count
			break
		end
	end

    if Config.Item.remove and item == Config.Item.name then
        for k, v in pairs(ESX.PlayerData.inventory) do
            if v.name == item and v.count <= 0 then
                radioApp.removeRadio()
                break
            end
        end
    end
end)

AddEventHandler('esx:onPlayerDeath', function()
    if not Config.LeaveRadioWhenDead then return end

    radioApp.removeRadio()
end)