Yes, but, people are still dumb and in the litigious world we live in, you can still get taken to court and have to hire a lawyer which could cost you thousands just to defend yourself.
The question you asked is qualified by "legal" and the degree of pain relief requested.
What is FAR more needed by most is some basic medical knowledge and training. Once you have that, you will know what painkillers to use and how to properly use them so your question will be moot.
To the best of my knowledge there is no "legal" pain killer that will allow one to amputate a leg and significantly reduce the pain of it, which is why Ether and Chloroform were so revolutionary to medicine.
Prepping is not about the things/supplies you gather. It is MUCH MORE about the knowledge you store between your ears.