Companion ped only reacts after I'm hit and doesn't attack all enemies

function isPlayerInVehicle()
	if not buddy then return end

	local playerPed = PlayerPedId()
	local vehicle = GetVehiclePedIsIn(playerPed, false)

	if vehicle and vehicle ~= 0 then
		if not inVehicle then
			local seat = Config.seatIndex
			TaskEnterVehicle(buddy, vehicle, -1, seat, 1.0, 1, 0)
			inVehicle = true
		end
	else
		if inVehicle then
			TaskLeaveVehicle(buddy, vehicle, 0)
			inVehicle = false
			TaskFollowToOffsetOfEntity(buddy, playerPed, 1.0, 0.0, 0.0, 1.0, -1, 0.0, true)
		end
	end
end

How can I make my companion ped automatically attack hostile peds before they hit me?