Yes, law makers can prevent mass shootings. Human beings are subject to law and order. Instinctively, we like to be under the law. Only, the law can stop us being what we want to be. It is this law and order that makes human being different from animals. The law has more power than the Divine God. It is evident that people have more fear for the law than for God.
This question assumes that the laws that are made by law makers can prevent mass-shootings.. and note that "prevent" is absolute, unlike "reduce".
Laws are only as good as those that follow them. Laws keep "Honest people honest", but do nothing in actually enforcing the behavior.
Also consider the psychology of the mass-murderer.. more often than not, mass-murderers suffer from mental illness or are mentally incapacitated in some way (drugs, alcohol etc). More often than not, mass-murderers suffer from depression and/or have a deathwish, often when that deathwish is not appeased, the mass-murderer commits suicide... people who want to die or kill themselves have no need or consideration for laws.
So no... no law written by a lawmaker can prevent mass shootings. I'd suggest that depending on the law, that a lawmaker could potentially reduce (or increase) mass-shootings, but certainly not prevent them as the question suggests.
Lawmakers have proved unable to stop other "vices" such as prostitution, illegal immigration, and the drug trade. All of these things are technically illegal, yet millions of people a year still commit these "crimes." If a person is crazy enough to want to commit mass murder, he is not going to stop his actions simply because it is illegal to do so.
Mass killings can not be prevented if the killer is determined to kill. These people are deranged, and will find a way if they really want to. That doesn't mean we shouldn't try and limit the weapons that are available, but if someone is bent on murdering a group of people, they will find a way.