Solution.

Citizen.CreateThread(function()
    while true do
    Citizen.Wait(0)
        if IsPedInAnyPoliceVehicle(GetPlayerPed(PlayerId())) then
            local veh = GetVehiclePedIsUsing(GetPlayerPed(PlayerId()), false)
            if (GetPedInVehicleSeat(veh, -1) == GetPlayerPed(PlayerId())) then
                if (PlayerData.job.name ~= 'police' and PlayerData.job.name ~= 'ambulance') then
                  ESX.ShowNotification("This vehicle is not permitted for non police personal..")
                  SetVehicleUndriveable(veh, true)
                end
            end
        end
    end
end)