Skip to content

Commit

Permalink
fix: fixed No such export addChannelCheck in resource pma-voice
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Nov 20, 2023
1 parent 6df41ae commit 7fe4da8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
34. [oxmysql]: chore: update to version 2.7.6 @bitpredator
35. [esx-radio] fix: fixed No such export addChannelCheck in resource pma-voice @bitpredator
17 changes: 8 additions & 9 deletions server-data/resources/[phone]/esx-radio/client.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--- For Support join https://discord.gg/pyKDCByzUk
local radioMenu, onRadio = false, false
local RadioChannel = 0
local RadioVolume = 50
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion server-data/resources/[phone]/esx-radio/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Config.Item = {
}

Config.KeyMappings = {
Enabled = true,
Enabled = true,
Key = "UP"
}

Expand Down
13 changes: 7 additions & 6 deletions server-data/resources/[phone]/esx-radio/server.lua
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 7fe4da8

Please sign in to comment.