Locate the file config.cfg in your Modern Warfare 2\players folder.
Open this file with Notepad. Add the following line(s) to the end of the file:
seta thereisacow "1337"
Now, you may also add any of the following cheat codes
that must be bound to a key.
god - God Mode
notarget - Enemies Ignore You
noclip - No Clipping Mode
give ammo - Give Ammo
bind o "god"
Would enable/disable GOD MODE when you press o in the game.
The game will not give any indication that the code(s) are active,
but they are. Add as many codes as you want to the end of the file.
After saving the file, you must right-click on it, choose properties
and then mark the file as READ ONLY. Otherwise the game will overwrite
the file when started.
Note: You must start a new level or the cheats may not work. Use
the MISSION SELECT option from the menu or start a new game.