From 6cbd709a738f281567fe736019a02e7de68f2ec5 Mon Sep 17 00:00:00 2001 From: L1quidSn4ke Date: Sat, 20 Sep 2025 15:13:34 -0700 Subject: [PATCH] Change job name to job type --- client.lua | 2 +- config.lua | 75 +++++++++++++++++++++++++----------------------------- server.lua | 2 +- 3 files changed, 37 insertions(+), 42 deletions(-) diff --git a/client.lua b/client.lua index f97a84e..ffec505 100644 --- a/client.lua +++ b/client.lua @@ -31,7 +31,7 @@ end local function connecttoradio(channel) if channel > Config.MaxFrequency or channel <= 0 then QBCore.Functions.Notify(Lang:t('restricted_channel_error'), 'error') return false end if Config.RestrictedChannels[channel] ~= nil then - if not Config.RestrictedChannels[channel][PlayerData.job.name] or not PlayerData.job.onduty then + if not Config.RestrictedChannels[channel][PlayerData.job.type] or not PlayerData.job.onduty then QBCore.Functions.Notify(Lang:t('restricted_channel_error'), 'error') return false end diff --git a/config.lua b/config.lua index 014d126..532116d 100644 --- a/config.lua +++ b/config.lua @@ -3,46 +3,41 @@ Config = {} Config.RadioItem = 'radio' Config.RestrictedChannels = { - [1] = { - police = true, - ambulance = true - }, - [2] = { - police = true, - ambulance = true - }, - [3] = { - police = true, - ambulance = true - }, - [4] = { - police = true, - ambulance = true - }, - [5] = { - police = true, - ambulance = true - }, - [6] = { - police = true, - ambulance = true - }, - [7] = { - police = true, - ambulance = true - }, - [8] = { - police = true, - ambulance = true - }, - [9] = { - police = true, - ambulance = true - }, - [10] = { - police = true, - ambulance = true - } + [1] = { leo = true, ems = true }, -- LSPD + [2] = { leo = true, ems = true }, -- SAST + [3] = { leo = true, ems = true }, -- BCSO + [4] = { leo = true, ems = true }, -- PBP + [5] = { leo = true, ems = true }, -- RANGER + [6] = { leo = true, ems = true }, -- EMS + [7] = { leo = true, ems = true }, -- FIRE + [8] = { leo = true, ems = true }, -- All Departments + [9] = { leo = true, ems = true }, -- Emergency 1 + [10] = { leo = true, ems = true }, -- Emergency 2 + + [11] = { leo = true }, -- SWAT Ops + [12] = { leo = true }, -- Detective Bureau + [13] = { leo = true }, -- Traffic Enforcement + [14] = { leo = true }, -- Air Support + [15] = { leo = true }, -- K9 Unit + [16] = { ems = true }, -- Medical Command + [17] = { fire = true }, -- Fire Command + [18] = { leo = true, fire = true }, -- Search & Rescue + [19] = { leo = true, ems = true, fire = true }, -- Dispatch Coordination + + -- Civilian & utility (optional restrictions) + [20] = {}, + [21] = {}, + [22] = {}, + [23] = {}, + [24] = {}, + + -- Gang channels (optional: restrict or leave open) + [30] = {}, + [31] = {}, + [32] = {}, + [33] = {}, + [34] = {}, + [35] = {}, } Config.MaxFrequency = 500 \ No newline at end of file diff --git a/server.lua b/server.lua index 86cf7d4..3866679 100644 --- a/server.lua +++ b/server.lua @@ -7,6 +7,6 @@ end) for channel, config in pairs(Config.RestrictedChannels) do exports['pma-voice']:addChannelCheck(channel, function(source) local Player = QBCore.Functions.GetPlayer(source) - return config[Player.PlayerData.job.name] and Player.PlayerData.job.onduty + return config[Player.PlayerData.job.type] and Player.PlayerData.job.onduty end) end