I don't think I have heard of that method before. Even if it stopped it though I don't know if black pepper all over would be better.
Cats usually have a specific reason they are going somewhere other than their box. Figuring out the problem and treating it is usually the most effective way and will result in a happier cat overall.
I've never heard of this either. I think I would have a hard time getting past the idea of having that all over my floor. But having a cat with inappropriate elimination issues is not fun either. (My mother has been there! I get it!)
I have only heard about this black pepper thing with dogs who dig holes in their owners yard, I actually did it and for that it worked. Never heard about using it for cat on carpets.
I would rather fix the problem, since with cats it could be a medical issue. With my cats accidents were from UTI, constipation, too highly scented litter, not changing non-clumping litter often enough, and not feeding enough wet food.