I seem to recall instances, at least in movies, whereby frontier town sheriffs imposed "no guns" allowed in their jurisdiction.
So when the "rowdies" came off the range, to town to get wasted drunk and play poker, they were disarmed.
Read some articles for yourselves
https://www.google.com/search?num=20&newwindow=1&source=hp&ei=G7m6WqGvINicjwPqsL_ADw&q=no+guns+in+western+towns&oq=no+guns+in+western+towns&gs_l=psy-ab.3..33i22i29i30k1.1488.6956.0.7369.25.24.0.0.0.0.187.2343.15j9.24.0..2..0...1.1.64.psy-ab..1.24.2338.0..0j46j35i39k1j0i131k1j0i46k1.0.Bmplz84FNLc
True enough, when the cowhands came into town after a drive, spent their pay on seldom available (otherwise) endless beer and liquor, and had the occasion to find (often alcohol fueled) conflict with those from their own or other outfits, the opportunities for conflict were unreal. Some towns did have no guns policies enforced by someone ( a marshal, sheriff, or deputies)
with a gun.
Still, today, there are nearly universal serious restrictions on possessing (carrying) firearms while under the influence of alcohol or other drugs, especially for concealed carry permit holders, and in some jurisdictions, on carrying them in establishments which serve alcoholic beverages, still enforced by people who carry guns as part of their job.
That, of course, is as effective as a gun free school zone (with the exception of the proprietor or their employees who may be armed in some cases) at protecting the patrons as the management at
Luby's was.
However, many of those "wild west" towns were not even in States (yet) but territories, and the level of violence is often exaggerated. When everyone is armed, people exhibit a distinct tendency to be polite, at least in rural areas.
That said, I feel safer in the hinterlands where the actions of predators are relatively predictable over the unpredictable and sometimes random violence of any modern urban area--not that I will ever give up my guns.
Regardless of such distractions, the purpose of the 2nd Amendment was so that a Government which exceeded the consent of the governed and was outside the boundaries of its just powers could be constrained, and, if necessary, changed. For this purpose, primarily, to secure the Rights, to guarantee the security of a Free State, the people were to be armed and that Right sacrosanct.
The concepts of hunting and self-defense against any predator were so fundamental they never entered into the question.