I don't know where do you want to attach the gun to or how to make a gun shoot a vehicle but you can get the ID of the player that is in the vehicle with https://sampwiki.blast.hk/wiki/GetPlayerVehicleID and then minus his health using SetPlayerHealth.