I lived in costa rica for a year, and have some family in el salvador.
My grandmothers friend was murdered a couple years ago in his farm (in el salvador), but again this was in a jungle-type area, with no one near by. KEEP IN MIND THAT HIS FAMILY WAS THERE, AND SO WERE THE MAIDS. A family member was killed there(el salvador) about 3 years ago. They stole his car, and killed him.
Costa rica isnt that bad though, the people are just scared of burglers. It was cool though, the U.S. embasy had this white truck going around the neighborhood (we lived near the ambasador) full of guys with shotguns.
My advice is, stay with a group, and dont go exploring in the very remote area's, cause that's when problems happen. Even in the national parks, if you go, try to stay on a trail with many people. Those places, at least in Costa Rica, have only a couple of guards for a several square mile area.
If you take a gun, it will probabely be confiscated. When we moved to CR, they took them for about 3 months, then we went to the head of the customs people dealing with fire arms, and got him to sign a paper releasing them.
Have fun, and dont worry, thousands of people go to central america every year, and you dont often hear things about them getting hurt.