Peter asks this question to emphasize that there is nothing praiseworthy about suffering for doing something wrong. Alternate translation: "For there is no credit ... while being afflicted." (See: [[rc://en/ta/man/translate/figs-rquestion]])
Here the word "afflicted" is a metonym for "punished." This can be stated in active form. Alternate translation: "while someone afflicts you" or "while someone punishes you" (See: [[rc://en/ta/man/translate/figs-activepassive]] or [[rc://en/ta/man/translate/figs-metonymy]])