Hamlet suffers both as a result of his own flaw and as a result of other people's sins. When the play begins, he is miserably unhappy because of the sudden death of his father as well as the hasty remarriage of his mother, Gertrude, to his father's brother and Hamlet's own uncle, Claudius. Then, he learns from his dead father's ghost that it was actually Claudius, the new king and Hamlet's new step-father, who murdered him. All of these circumstances relate to other people's sinful behavior, and they make him quite miserable.
However, Hamlet's unhappiness is extended by the fact that he is so reticent to avenge his father's death, as he's been charged to do by the ghost; this isn't really a sin, but his inability to act is a flaw. He spends almost the entirety of the play wondering how he could be so cowardly, but then he continues to do very little to actually exact his revenge. Even once he becomes convinced that Claudius really did kill his father, Hamlet stalls and does nothing of import until the final scene (when, really, he has to because he's about to die, himself). His inability to act decisively is his major flaw, and it makes him very unhappy too.