Instructions
Creating the Script
Open any text editing program. If you're using Windows, find "Notepad" by pressing the "Start" button, selecting "Programs," then "Accessories" and clicking on "Notepad."
Create your script using the "Half-Life 2" scripting language. Find a list of available functions at the AMX Mod X website.
Separate every command you list to its own line in the "Notepad" file. The script will complete one command at a time, starting from the top and going down. There is no limit to how many commands you can list.
Click "File" at the top of the "Notepad" window, select "Save As" and click the down arrow next to "Save as Type." Select "All File Types" and name the file anything you like, as long as it ends with ".cfg".
Save your ".cfg" file in your "Half-Life 2" directory, located by default in "C:\Program Files (x86)\Steam\steamapps\common\halflife 2\halflife2\cfg".
Testing the Script
Start "Half-Life 2." Select "Start New Game."
Press "~" on your keyboard. A small window will pop up called the "Console."
Type "sv_cheats 1" into the console and press "Enter."
Type "exec (name of your file)" and press "~" again to close the console and return to your game. The script should execute, and whatever commands you typed in the "Notepad" file will happen in front of you.