Maybe shine a light into the water to scare them away or attract them to something besides your boat?
For those who don’t sail in fresh water and have not had the pleasure of having carp impact your sleep, just try to imagine (with no exaggeration) someone banging (not tapping) on your hull with a hammer. On my lake, carp travel in large schools and they tend to 7-10 pounds. Carp are sucker feeders and are attracted to the slime that accumulates on the hull. While fresh water boats do not incur the type of growth found in salt water, even a recently painted or scrubbed hull will develop a thin layer of slime. That is feast food for carp. Carp are extremely fond of protected marinas and less active in more open waters. As the water gets warmer, the carp get more active. Bright lights do seem to run them off, but unless you can install very bright lights that penetrate feet below the surface and around the clock, that solution only works whey they start hammering on the hull and drive you topside with your bright flashlight or spotlight. Also, keep in mind that in a marina, the noise traveling thru the water from neighboring boats is just as bad as if they are attacking your boat.
I recently observed our state fish and wildlife folks driving through our 1,000 boat marina with a nice electronic shocking system that stuns carp and they scoop them up. Unfortunately, not a system an available or legal for the rest of us. Can be fun to bow fish, but then again, you only hunt after they wake you up.
if any of you have found the magic bullet to solve this problem,, would love to hear about it.