Use ZR as A button replacement when choosing your attack. maybe hold a sec after clicked with ZR on the attack. Then, even when the Pokemons HP doesn't get to 0, the Pokemon is fainted. But if you are fighting vs trainers with more than two Pokemon, make sure to use it on the last two ones or have the earlier mons HP reach 0.
If fainted with this cheat and the Pokemon has still HP left, the trainer will reuse this "fainted" Pokemon and you'll softlock yourself.
And you can always edit codes with Hold/press buttons to on/off codes, just look some pages back, there should be a post from myself. But in this thread, this was explained pretty often, so you should be able to find any post.