If I'm not mistaken, I think Mystery Gift functionality isn't implemented for Gen 3, as there's other tools that already implement it.
(Between RS, E and FRLG, the Mystery code functionality was coded differently lol)
Here, use this tool. You may get an antivirus warning, it's safe to ignore it (for this one tool).
Make a save backup in other folders on your computer before using it.
For standard events, using Official Event Distributor should be enough https://projectpokemon.org/home/files/file/645-mystery-gift-tool/