I'd like to add something to this tutorial: Here's a basic script which allows you to only type in the ID and it does the rest.

Code:
^m::
SendInput t/sellgun  m4{left 3}
sleep, 3000
SendInput t/l Enjoy your weapon. Don't tell the cops or you're a dead man.{enter}
return
The script above is one I just created. It could be used by gun dealers to sell M4's. You don't need to type the whole command, all you do is type the ID. More explained below.

Code:
^m::
The code above states the key(s) that need to be pressed to activate that block. In this instance its CTRL + M
^ = CTRL
# = Windows Key
! = ALT

Code:
SendInput t/sellgun  M4{left 3}
The reason we don't use enter in the above code is because we want to time type the ID. Once you've typed the ID you press enter. the "{left 3}" makes the left arrow key move three places left putting you where you'd normally type the players name or ID.

Code:
sleep, 3000
Stannis has explained this.

Code:
return
You NEED return if the code you're creating is longer than one command. If you don't have it it will play the rest of the commands in the file.

Here's my AHK File feel free to keep and edit it to your needs.

Code:
;Lock / Unlock - CTRL + 1
^1::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/lock{enter}
return


;Enter CTRL + 2
^2:: 
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/me extends her right arm, pulls the door towards her and enters.{enter}
	sleep, 50
	SendInput t/enter{enter} 
return


;Exit - CTRL + 3
^3::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/me extends her right arm pushing the door forwards and walking out.{enter}
	sleep, 50
	SendInput t/exit{enter}
return


; Tazer - CTRL + 4
^4::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/sdtazer{enter}
return


;Hands up - CTRL + 5
^5::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/s This is the San Andreas National Guard. Please place your hands up failure to do so...{enter}
	SendInput t/s -... Can result in you being arrested or shot at{enter}
	sleep, 1000
	SendInput t/b /handsup{enter}
return


;Megaphone - CTRL + 6
^6::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/m This is the San Andreas National Guard.{enter} 
	sleep, 1500
	SendInput t/m Please pull over to the side of the road with your hands up...{enter}
	SendInput t/m -... and switch your engine off immedietly and no sudden movements.{enter}
	sleep, 1000
	SendInput t/b /engine, step out then /handsup{enter}
return


;Frisk - CTRL + 7
^7::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput t/me takes a pair of white latex gloves from her right pocket and slips them tightly on her hands.{enter}
	sleep, 1500
	SendInput t/me attempts to pat the suspect down from head to toe, not missing anywhere.{enter}
	sleep, 1500
	SendInput t/do Would I be able to frisk you{?}{enter}
return


;Miranda Rights - CTRL + 8
^8::
	soundplay, C:\Users\George\Documents\Resources\uiclick.wav
	SendInput tYou have the right to remain silent.{enter}
	sleep, 2000
	SendInput tAnything you say can and will be used against you in the court of law.{enter}
	sleep, 2000
	SendInput tYou have the right to an attorney.{enter}
	sleep, 2000
	SendInput tIf you cannot afford one, one will be appointed to you.{enter}
	sleep, 2000
	SendInput tDo you understand those rights as they have been read to you?{enter}
return