From 9c4c60b5a615fdc45ceda4cf19490efeca088789 Mon Sep 17 00:00:00 2001 From: WillFJS Date: Sat, 31 Jan 2026 13:39:04 -0600 Subject: [PATCH] added ace perms for tablet --- build/sonoranradio/config.CHANGEME.lua | 1 + lua/cl_main.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/build/sonoranradio/config.CHANGEME.lua b/build/sonoranradio/config.CHANGEME.lua index e536775..c4ec918 100644 --- a/build/sonoranradio/config.CHANGEME.lua +++ b/build/sonoranradio/config.CHANGEME.lua @@ -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 diff --git a/lua/cl_main.lua b/lua/cl_main.lua index 1058723..b9e1c1a 100644 --- a/lua/cl_main.lua +++ b/lua/cl_main.lua @@ -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() @@ -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 @@ -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') + end + return false + end local function emergencyCallRedialNotif() local crashout = false