Your situation raises some very complex issues that need to be thoroughly discussed with an attorney, who can work in conjunction with a mental health care professional to assess your condition. Depending on the findings it could have an impact on the defenses you can raise and/or the potential sentence and disposition that you should try to obtain. If you are able to afford a private attorney, I suggest that you contact a few. Many of us on Avvo provide a free consultation.
That's rough. You probably don't want to tell a judge that they are sentencing a mentally unstable person with a drug problem and a tendency to carry a gun. If a plea agreement results in probation and some term if days you may be able to "do your time" on an alternative program to jail including house arrest or working for the sherriff. Talk to the public defender's office about what is available in your area.
Any person, including a person with alleged metal issues has to have a competent attorney handling any incidental or arising matters in pending criminal cases. The narrative your described is already complex enough to see that that particular case must have a competent legal counsel to evaluate the client's mental state and properly address the issues in court as criminal cases cannot be tried on Avvo forums.
DISCLAIMER The answer given above by the lawyer serves for educational purposes only and provides general information and a basic understanding of the applicable law. Take notice that the answer above does not create an attorney-client relationship as this website is not intended to provide anyone a specific legal advice. Anyone using the site expressly consents that there is no attorney client privilege between any person and any attorney responding. Further take notice that the site should not be used as a crude substitute for any professional and competent legal advice by a licensed professional attorney in the applicable jurisdiction. The attorney above attempted to provide competent professional information, however, the law and its applications may change frequently and vary greatly from other U.S. jurisdictions and locales. Therefore, any information and materials provided above are general in nature, and may not apply to specific factual and legal circumstances related to one's personal legal issues. Contact an experienced lawyer admitted to practice in your State under an attorney-client privilege to further receive a competent legal advice before making any important decisions about your particular legal issue. For further inquiries please contact: Attorney Alexander Ivakhnenko 1021 West Adams, 102, Chicago, Illinois 60607 773-562-8602 http://alexanderivakhnenko.com