If any person offend against any of the provisions of Sections 97-39-1 to 97-39-11, Mississippi Code of 1972, headed Dueling, such person shall be a competent witness against any other person offending in the same transaction, and may be compelled to appear and give evidence in the same manner as other witnesses; but the testimony so given shall not be used in any prosecution or proceeding, civil or criminal, against the person so testifying, except for perjury in giving such testimony; and the fact that he testified thereof shall be a bar to any prosecution against him for such transaction.