diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 4ec929ece..04d057ff9 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -56,4 +56,5 @@ 31. [esx-qalle-jail]: fix: fix lint error @bitpredator 32. [esx_multicaracter]: fix: fix lint error @bitpredator 33. [esx_dmvschool]: fix: fix lint error @bitpredator -34. [oxmysql]: chore: update to version 2.7.6 @bitpredator \ No newline at end of file +34. [oxmysql]: chore: update to version 2.7.6 @bitpredator +35. [esx-radio] fix: fixed No such export addChannelCheck in resource pma-voice @bitpredator \ No newline at end of file diff --git a/server-data/resources/[phone]/esx-radio/client.lua b/server-data/resources/[phone]/esx-radio/client.lua index 91d74c898..eab07d61d 100644 --- a/server-data/resources/[phone]/esx-radio/client.lua +++ b/server-data/resources/[phone]/esx-radio/client.lua @@ -1,4 +1,3 @@ ---- For Support join https://discord.gg/pyKDCByzUk local radioMenu, onRadio = false, false local RadioChannel = 0 local RadioVolume = 50 @@ -34,9 +33,9 @@ local function connecttoradio(channel) end exports["pma-voice"]:setRadioChannel(channel) if SplitStr(tostring(channel), ".")[2] ~= nil and SplitStr(tostring(channel), ".")[2] ~= "" then - Config.ClientNotification(Config.messages['joined to radio'] ..channel.. ' MHz', 'success') + Config.ClientNotification(Config.messages['joined to radio'] ..channel.. ' MHz', 'success') else - Config.ClientNotification(Config.messages['joined to radio'] ..channel.. '.00 MHz', 'success') + Config.ClientNotification(Config.messages['joined to radio'] ..channel.. '.00 MHz', 'success') end end @@ -115,19 +114,19 @@ RegisterNUICallback('joinRadio', function(data, cb) connecttoradio(rchannel) end else - Config.ClientNotification(Config.messages['you on radio'] , 'error') + Config.ClientNotification(Config.messages['you on radio'] , 'error') end else - Config.ClientNotification(Config.messages['invalid radio'] , 'error') + Config.ClientNotification(Config.messages['invalid radio'] , 'error') end else - Config.ClientNotification(Config.messages['invalid radio'] , 'error') + Config.ClientNotification(Config.messages['invalid radio'] , 'error') end end) RegisterNUICallback('leaveRadio', function(data, cb) if RadioChannel == 0 then - Config.ClientNotification(Config.messages['not on radio'], 'error') + Config.ClientNotification(Config.messages['not on radio'], 'error') else leaveradio() end @@ -139,7 +138,7 @@ RegisterNUICallback("volumeUp", function() Config.ClientNotification(Config.messages["volume radio"] .. RadioVolume, "success") exports["pma-voice"]:setRadioVolume(RadioVolume) else - Config.ClientNotification(Config.messages["decrease radio volume"], "error") + Config.ClientNotification(Config.messages["decrease radio volume"], "error") end end) @@ -149,7 +148,7 @@ RegisterNUICallback("volumeDown", function() Config.ClientNotification(Config.messages["volume radio"] .. RadioVolume, "success") exports["pma-voice"]:setRadioVolume(RadioVolume) else - Config.ClientNotification(Config.messages["increase radio volume"], "error") + Config.ClientNotification(Config.messages["increase radio volume"], "error") end end) diff --git a/server-data/resources/[phone]/esx-radio/config.lua b/server-data/resources/[phone]/esx-radio/config.lua index d6cae1428..c915f64ea 100644 --- a/server-data/resources/[phone]/esx-radio/config.lua +++ b/server-data/resources/[phone]/esx-radio/config.lua @@ -6,7 +6,7 @@ Config.Item = { } Config.KeyMappings = { - Enabled = true, + Enabled = true, Key = "UP" } diff --git a/server-data/resources/[phone]/esx-radio/server.lua b/server-data/resources/[phone]/esx-radio/server.lua index 8f23eaef7..be02525c9 100644 --- a/server-data/resources/[phone]/esx-radio/server.lua +++ b/server-data/resources/[phone]/esx-radio/server.lua @@ -1,9 +1,10 @@ -for channel, config in pairs(Config.RestrictedChannels) do - exports['pma-voice']:addChannelCheck(channel, function(source) - local xPlayer = ESX.GetPlayerFromId(source) - return config[xPlayer.job.name] - end) -end +CreateThread(function() + for channel, jobs in pairs(Config.RestrictedChannels) do + exports['pma-voice']:addChannelCheck(channel, function(source) + return jobs[Player(source).state.job.name] + end) + end +end) if Config.Item.Require then ESX.RegisterUsableItem(Config.Item.name, function(source)