When one is in mortal sin, he is unable to gain merit: this is correct and a de fide doctrine. This is true for any good work, be it of service or prayer (so much for Catholics believing in “justification by works”).
Now for the technicalese. Strictly speaking, one in mortal sin cannot merit “de condigno”, that is, as a matter of justice. In other words, outside of the state of grace, one does not gain any supernatural reward because simply put, they both do not deserve it and their souls are unable to receive it. So crudely speaking, God does not “owe” them anything. Merit “de condigno” is merit in justice, something God has bound himself to bestow under a certain set of circumstances. This set of circumstances of course is good works done in the state of sanctifying grace.
BUT: One in mortal sin can merit “de congruo”, that is, God sends reward due to nothing else but his own goodness, not because he “owes” them, so to speak. For the person in mortal sin, this often comes in the form of actual grace, prodding and prompting the soul to repentance so that he can be reconciled and restored to the state of grace. In prayers for others, such as sinner can merit such graces for others as well, “de congruo”. It’s not something that one can bank on, as it is dependent solely upon God’s free decision and not upon something he bound himself to, unlike strict merit “de condigno.” He is free to bestow such rewards or not.
So in light of these teachings, one must hold that God does hear and accept the prayers of one in mortal sin. It is in fact, good to do so because it disposes the soul to be restored to the state of sanctifying grace.
As for “credit”, no. If one falls into mortal sin, any merits already gained due to good works performed in the state of grace are completely lost. However, they revive upon reconciliation. For any works done in mortal sin, however, they do not stand to merit anything (that is, de condigno, i.e. salutary); there is no “credit.” This is only true for sacramental grace, not salutary merit.