This is what I wrote for our policejob to have ai cops supplement the players if wanted. You can see that it checks for a config setting for disabling wanted level or not, then a configurable number of cops to be online whether it should be enabled for a person stealing cars and finally whether they are a police officer. That’s exactly the type of thing that the OP discusses. Create your config settings, use that for your policejob wanted loop and this will do exactly what was being discussed.
-- Disable wanted level
firstLoop = 'yes'
Citizen.CreateThread(function()
while true do
if firstLoop then
Citizen.Wait(10000)
else
Citizen.Wait(0)
end
if ((Config.DisableWantedLevel or copCount >= Config.EnoughCopsOnline) and carThief == false and wantedToggle ~= 'on') or (wantedToggle == 'off' and carThief == false) or PlayerData.job.name == 'police' then
local playerId = PlayerId()
if GetPlayerWantedLevel(playerId) ~= 0 then
SetPlayerWantedLevel(playerId, 0, false)
SetPlayerWantedLevelNow(playerId, false)
end
end
firstLoop = nil
end
end)
Then it’s of course going to throw an error as you’re not defining ESX/xplayer, etc. That loop was to be placed in the policejob where the original loop sits. You can’t just throw that into it’s own resource without making that resource ESX-compliant.