The value of ‘ESX’ is nil and never changes so that would mean ‘sourceXPlayer’ would also be nil thus leading to nothing below the loop working because you’re exiting with ‘return’
ESX = nil
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
PlayerData = ESX.GetPlayerData()
end
end)
local done = false
RegisterCommand("duty", function(source, args, rawCommand)
if PlayerData.job and PlayerData.job.name == 'police' then
exports["rp-radio"]:GivePlayerAccessToFrequencies(1, 2, 3)
elseif PlayerData.job and PlayerData.job.name == 'ambulance' then
exports["rp-radio"]:GivePlayerAccessToFrequencies(1, 2, 3)
elseif PlayerData.job and PlayerData.job.name == 'mechanic' then
exports["rp-radio"]:GivePlayerAccessToFrequency(3)
else
exports["rp-radio"]:RemovePlayerAccessToFrequencies(1, 2, 3)
end, false)