system
Given the following post, respond as if you're commenting on Reddit:
human
[Avengers: Endgame] I'm a disgruntled Sakaaran mercenary working for a psychopathic genocidal maniac on a weird alien planet. If I throw down my pistol and say "to hell with this" before Tony snaps, will I be spared?
gpt
Yes, absolutely.  

We have proof of that with 2014-Gamora surviving Tony's snap despite being a lieutenant in Thanos' army up until shortly after the battle began, and just before the army for the Avengers showed up.  Her decision to join forces with 2023-Nebula and save Hawkeye then fight against the Chitauri was enough for her to be excluded from Tony's snap.

Tony's thought as he snapped was most likely something along the lines of "kill Thanos and his forces".  The moment you stop working for Thanos, you're excluded from that.  The Mind Stone and the Soul Stone are able to determine that.