Hi Welcome to HealthCareMagic
common cause for the pain in the scrotum
is epidydimo orchitis
... but since The pain is there only on cough
, you must get clinically evaluated to rule out hernia
... The treatment is antibiotics taxim 200mg twice a day for 5 to 7 days for epidydimoorchitis... surgery is the treatment for hernia...Hope i have answered your question..