I am not an addon maker so please excuse me if I say anything incorrect.
You have this option, but, the person shooting out of the window would have to be in the gunner position of the vehicle. So, if the gunner position was set up so the player looks as if he has a M4 sticking out of the window, it would work. However, the M4 would always be sticking out of the window.
P.S. I don't think cars can have gunners, so using cars is not possible. Setting a car model for an armored vehicle also wouldn't work, because the armored vehicles settings are hard-coded into the game. The car would be able to turn like a tank, etc.