Now that I know they were BB guns, and about the waving of one of the guns, and the fact that you had other people in the car. . . the picture is a bit clearer.
If nobody was holding the BB guns, and they were in your car, you are responsible for them. Even if someone is concealing a gun, BB or otherwise, it's your car and you'd have a hard time proving you didn't have knowledge of it's presence.
Do what you can to get the friend who was waving the gun around to admit his actions.
Be absolutely honest with the Judge, because they know when you're giving them a story.
Main thing, get a lawyer to represent you, IMMEDIATELY.
You're damn lucky that the cops didn't shoot first and figure out what happened later. They're scared as hell when they roll up on a scenario like this, and they're thinking that they might not make it home to their families. Damn lucky, kid.
If I had to guess, and it's ONLY a guess, you won't do jail time if it's a first offense and you have bail money. They might require bail if they think your a flight risk or that you might not show for the next court appearence. But you'll increase your chances of this not being as bad if you get a lawyer.
I would hope, and imagine, that the Judge will impose some hefty fines and mandatory programs for you. You'll most likely have this affect your driving record, which will increase your insurance.
That's the best I can give ya, and don't do something that damn stupid again. Next time you might get shot or wrapped around a tree trunk.