First: you need to be in a double battle with the shadow pokemon
Second: you go with the first Pokemon to items and use masterball on the shadow pokemon.
Third: go with your second Pokemon to items and switch your masterball with any kind of other ball.
Fourth: you can attack with your second pokemon.
Fitfh: your dude will throw the masterball and you will definetly catch it.
At the end if you look into your inventory you should still have your masterball. If not then you didn't read this cheat good enough!!!!!!!!!!!!!!!!!!!!!!