In some countries they scan you ID and likely keep it some database when you buy drugs or enter bars or clubs. In others they just look at your ID card if you don't look old enough.
The first example is bad, the second is tolerable.
But the reason most kids don't smoke is that the parents and the teachers instilled in them that it was bad. If a kid wants to smoke or drink, they can surely get an older friend or a friend of a friend to sell them the cigarettes or alcohol. Anyone can buy 20 bottles of hard liquor and 50 packs of cigarettes, sell them to a 15 year old who can then sell them to their friends. That doesn't happen often not because a surprise police raid will show up and bust the seller but because there isn't enough demand. If there is demand from the kids and the parents don't care, kids will get their hands on drugs. Maybe not 9 year olds but certainly the teens.
> But the reason most kids don't smoke is that the parents and the teachers instilled in them that it was bad.
Big honking "citation needed" there. I think it's far more likely that laws against advertising to minors, and tightening enforcement of prohibiting the sale to minors, is what did it.
On top of it all, smoking has decreased among adults too. Part of that is certainly cutting off a big chunk of the teen-to-adult smoking pipeline, but part of it is also just that adults don't think it's so cool anymore (and "going out for a smoke" is no longer a social or even professional activity), and are more aware of the health risks.