Doesn't seem to be documented on wiki when events that spawn gas drop gasmask rather than other items. I don't know if this is fixed or randomized, but so far got gasmask drops from executing scripts which had these keywords written in letter informing about them:
1. "emergency brake". Also talks about keeping some guy (with randomly generated name) away from terminal until the author figures how to blacklist them.
2. "purge procedure"
If, on the other hand, tells to bring gasmask on your own or that it will be a quick run for the elevator, then it won't give gasmask (will give stimpack instead).
This is but a theory though, maybe it's random but at least first I encountered enough to notice it always gave me gasmask, and the second is proof that it can be completely different keyword and still gas spawned + gasmask drop.