Skip to content

Commit

Permalink
Removed double notifications and checked min/max frequencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Cocodrulo committed Nov 10, 2024
1 parent ea5a2ab commit 80b314e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ local function SplitStr(inputstr, sep)
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] and PlayerData.job.onduty then
QBCore.Functions.Notify(Lang:t('restricted_channel_error'), 'error')
Expand Down Expand Up @@ -212,7 +213,6 @@ end)
RegisterNUICallback("increaseradiochannel", function(_, cb)
local newChannel = RadioChannel + 1
local canaccess = connecttoradio(newChannel)
if canaccess then QBCore.Functions.Notify(Lang:t("increase_decrease_radio_channel", {value = newChannel}), "success") end
cb({
canaccess = canaccess,
channel = newChannel
Expand All @@ -224,7 +224,6 @@ RegisterNUICallback("decreaseradiochannel", function(_, cb)
local newChannel = RadioChannel - 1
if newChannel >= 1 then
local canaccess = connecttoradio(newChannel)
if canaccess then QBCore.Functions.Notify(Lang:t("increase_decrease_radio_channel", {value = newChannel}), "success") end
cb({
canaccess = canaccess,
channel = newChannel
Expand Down

0 comments on commit 80b314e

Please sign in to comment.