An important thing to watch out for is how the code looks when you type it into an event. The code itself is fine, but it probably looks like this:
Code:
pbAddForeignPokemon
(PBSpecies::SANDSHREW,5,_I
("Jake"),_I("Sorex"),0)
RMXP is stupid, and thinks these are three separate and unrelated lines of code, rather than one long one. What you need to do is to tell RMXP that, when it gets to the end of the first line, that there's more of that line still to come. You do this by putting the open bracket "(" at the end of the first line rather than the beginning of the second line. You also need to do something similar with the second line, but make sure it ends on a comma (an open bracket would work as well; you'll develop your own style eventually).
What you should end up with is something that looks like this:
Code:
pbAddForeignPokemon(
PBSpecies::SANDSHREW,5,
_I("Jake"),_I("Sorex"),0)
The open bracket and the comma are useful things, because they indicate that the line hasn't finished yet, and the continuation is on the next line. There are one or two other such characters (probably), but you don't need to worry about them as the open bracket and comma will work for you just fine - they do for me.
The alternative is to use ExtendText (the .exe in the game's folder) to make the script box much wider, allowing you to fit everything on the same line. It's certainly useful, although it's probably best if you do some clever lining as I described above, if you can afford the space.
Having said all that, though, this particular script is best used as the argument of a
Conditional Branch. It will return
true if the Pokémon was added, and
false if not. This allows you to "deactivate" the Pokémon-giving event once it's done its job (perhaps by playing with its Self Switches).
To make the Pokémon shiny, read
the wiki. There's also an example of exactly what you want in the example maps (far right NPC in the Pokémon Fan Club).