step one, create a config file that will execute the command (or commands) you want to create. You can put multiple commands in the command file if you want. For example, my cfg file to enable ff is:
set g_friendlyfire 1
cp "Friendly Fire Enabled"
obviously the first command enables FF, the second announces it so noone is taken by surprise

I save this as a file called enableff.cfg in the same directory as admin.dat.
Next I need to add a command block to admin.dat to create the command:
[command]
command = enableff
exec = exec enableff.cfg
desc = Enable Friendly Fire
levels = 4 5
command is the command name, so here it will be called as !enableff
exec is the command file executed. You could just put a single command there too.
Desc is what it shows when you do !help enableff
levels are the admin levels who have access to the command.
Example 2.
!startpractice command
set sv_hostname "^1}MG{ ^3Practice"
set g_needpass 1 // toggle password needed to join the server
set g_password "YourPrivatePassword" // server password
this is saved as startpractice.cfg
Then I add the command block to admin.dat:
[command]
command = startpractice
exec = exec startpractice.cfg
desc = Password protect server and change server name too
levels = 5
I have a !endpractice command to revert my settings and make the server public again

There are other particulars, but that should get you started

Also, watch when you edit admin.dat, if the server reloads while you are editing it your commands will vanish. If you can't shut down the server while you edit admin.dat, its best to do it at the beginning of a map and when you are done, connect to your server and run !readconfig to load your changes. They will be available immediately
