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
1 change: 1 addition & 0 deletions build/sonoranradio/config.CHANGEME.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Config.acePermsForScanners = false -- Restrict using the scanner to an ace permi
Config.acePermsForRadio = false -- Restrict usage of the radio to an ace permission
Config.acePermsForRadioGuests = false -- Restrict users joining the radio as a guest to an ace permission
Config.acePermsForRadioUsers = false -- Restrict usage of /radiousers to an ace permission
Config.acePermsForRadioTablet = false -- Restrict usage of the radio tablet to an ace permission
Config.enforceRadioItem = false
Config.RadioItem = { -- Note: Changes to this item will require a server restart to take effect
name = 'sonoran_radio', -- Item name in your inventory
Expand Down
19 changes: 19 additions & 0 deletions lua/cl_main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,10 @@ function initClient()
end
setGeoAutoSwitch(not autoGeoSwitchEnabled, true)
elseif action == 'tablet' then
if not tabletHasPermission() then
SendNotification('Tablet/Dispatch: ~r~No Permission~r~')
return
end
setDispatchVisible(true)
else
radioToggle()
Expand All @@ -574,6 +578,10 @@ function initClient()
RegisterCommand('sonradradio', radioToggle)

RegisterCommand('showdispatch', function()
if not tabletHasPermission() then
SendNotification('Tablet/Dispatch: ~r~No Permission~r~')
return
end
if dispatchOpen then
SetNuiFocus(true, true)
return
Expand Down Expand Up @@ -981,6 +989,17 @@ function initClient()
RegisterKeyMapping(geoCommand, 'Toggle Geo Channels Auto-Switch', 'keyboard', getConfigKeybind('toggleGeoSwitch'))
TriggerEvent('chat:addSuggestion', '/' .. geoCommand, 'Toggle geo channel auto-switch', {})

function tabletHasPermission()
if not Config.acePermsForRadioTablet then
return true
end
if IsPlayerAceAllowed then
local playerId = PlayerId()
local serverId = GetPlayerServerId(playerId)
return IsPlayerAceAllowed(playerId, 'sonoranradio.tablet') or IsPlayerAceAllowed(serverId, 'sonoranradio.tablet')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsPlayerAceAllowed is not exposed to the client side and must be called from the server files. I would recommend sending the full user permissions in the event SonoranRadio::CheckPermissions found on line 604 of sv_main.lua

end
return false
end

local function emergencyCallRedialNotif()
local crashout = false
Expand Down