When your website is under constant attack of Ddos, is there any existing script or method to follow, to permanently get rid of this thread?

The problem is, that in my Country, our IP n's is not dedicated, and more than one person shares exactly the same ip number, therefore, banning the IP in .htaccess will also deny legitimate visitors with the same IP.

Is there any suggestions at all on this?