Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
75 changes: 35 additions & 40 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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