Actually, this topic brings up a funny story about my Great Aunt.
About twenty years ago my great aunt was the victim of a home invasion. Her and her husband, who has sadly passed since then, were both asleep at the time. When the door opened, she woke up, and stayed in bed for a moment listening, trying to see if anything was happening, hoping a light would come on and it would be someone she knew. Whoever it was that came in started rummaging through drawers, and moving through the house, without turning the lights on. So she went for the .38 that was in her dresser drawer. She got in here doorway and jumped out pointing the gun at the crook. She started pulling the trigger and nothing but a "click, click" was heard. Junior, her husband, had taken the bullets out a while back for exactly this reason. After that, Junior woke up and called the cops, and the guy was picked up.
The point of this condensed story being that, even if you don't fire a gun, just the mere sight of it, or sound of cocking, is usually enough to scare someone away.
Actually, I have a personal experience with nothing but a couple of warning shots scaring someone off, but it's kinda late to post that one right now. I'll probably post it tomorrow.