For the pain, you can take painkillers, but you should get it treated also. To find out about the cause of pain, you shade share your pics with mouth open and close position and if needed x ray of tooth also. And get the treatment accordingly. Painkiller will give relief from pain but will not treat underlying problem.
Next Steps
consult the dentist and get the tooth treated to prevent it from progressing to untreatable stage.
Health Tips
prolonged use of painkillers not recommended..