This thread only deals with the most popular macro editor, Autohotkey, so you will want to start by downloading that here. It will come with it's own basic instructions, but I'll break down what I think you need to know.
First, we'll take an example macro and break it down.
Code: Select all
Numpad5::
SendInput tI've got ants in my pants and I like to dance.{Enter}
SendInput t/dance 3{Enter}
return
Numpad5:: This is your signal to AHK that you want to map something to Numpad 5.
Sendinput This is the start of most AHK binds for SAMP. It will tell AHK that you want to send the following keys to your computer.
SendInput tI've got ants in my pants and I like to dance. This is the bulk of your command. AHK will now send those keypresses to your computer, saving you a lot of time. Most SendInput lines for SAMP will begin with the letter "t" to open the chatbox before it starts sending keypresses.
{Enter} This is how you tell AHK to press the Enter or Return key. This will almost certainly be at the end of each line in the macro.
SendInput Again, this sends a flag to AHK that you want to start inputting keypresses.
SendInput t/dance 3{enter} "t" opens the chat box, you input your command, and you press enter to finish the line.
return This tells AHK "I'm done with this macro!" You can then continue to enter new macros underneath.
All this again allows you to press Numpad 5 and say "I've got ants in my pants and I love to dance." and begin dancing.
Note: You can also add more commands per line or seperate each command into a new line.
Code: Select all
Numpad5:: SendInput tI've got ants in my pants and I like to dance.{Enter}t/dance 3{Enter}
return
A common macro on the server for police is a tazer key.
Code: Select all
*MButton::
SendInput t/tazer{enter}
return
There's also the sleep function. Sleep will tell Autohotkey to chill out for an exact amount of milliseconds. Sleep 1 is one millisecond. Sleep 1000 is one second.
Our server gives automatic warnings and kicks for input spam from programs like AHK, intentional or not. To avoid being automatically warned and kicked you need to use the sleep function.
First, always end your binds with the following:
Code: Select all
sleep 500
return
Second, if your bind has more than one line of input to the server, every line of input should have sleep (at least) 4000 preceding it.
Code: Select all
numpad0::
SendInput t**Here is the LS transport CRANE. When you are done with car, /DROPCAR here and it will put back in pool{Enter}
Sleep 5000
SendInput t*for public use. You will also get a small finders fee for your work...$1000-$2000 at level one.{Enter}
return
This will wait 5 seconds between saying "**Here is the LS transport CRANE. When you are done with car, /DROPCAR here and it will put back in pool"
and the next line "for public use. You will also get a small finders fee for your work...$1000-$2000 at level one."
This makes the text much easier to read than if it came in one block, makes it look like "human speech" instead of a macro, and avoids the automatic spam warning.
If you want to make it look more like "human speech" try to stagger the amount of sleep between each line.
Here's a long example from the tour script:
Code: Select all
!f::
SendInput t/b **All fishing commands can be found by using /fishhelp{Enter}
Sleep 4000
SendInput t*Fishing is fairly simple, just stand at a fishing pole to begin.{Enter}
Sleep 4500
SendInput t/b *Then type /fish over and over to catch fish... nothing complicated.{Enter}
Sleep 5000
SendInput t*You can hold five fish but catch six before the timer will warn you of overfishing the seas.{Enter}
Sleep 5500
SendInput t*Fishing is fairly useless at first because you only want fish over twenty pounds but won't catch them.{Enter}
Sleep 5000
SendInput t*The fishing timer will reset allowing you to fish again AT LEAST every twenty minutes.{Enter}
Sleep 5000
SendInput t*/b Fishing is profitable, but after you catch about 700 total you will no longer be able to fish.{Enter}
return
As you can see, this is a very powerful tool! But there are also some practical limitations. Along with the aforementioned limits, you should NEVER create a macro that repeats itself automatically more than once every thirty minutes. It spams our server and creates lag. To follow server rules, you should NEVER create a macro that allows you to function while away from keyboard. Not only does it almost always create server lag, it's unfair to players who are achieving things as intended. It's bad, and it's extremely obvious. If you are abusing macros we will notice very quickly and punish you.
That said, macros are almost always a good thing. Get creative, there are all sorts of multiple line macros you can use to save time. The most common binds are to Alt+keys and Ctrl+keys, which can be done with !KEY and ^KEY prefixing your first line, respectively.
Example:
Code: Select all
!G::
Code: Select all
^G::
You will also want to add "#IfWinActive, GTA:SA:MP" to the beginning of your .ahk file. This ensures that your hotkeys will only trigger while GTA:SA:MP is the active window. If you forget to turn off your AHK script or if you are playing windowed you will only use the hotkeys in GTA as intended.
A lot of people use separate .ahk scripts for each character. Here's one of my own full AHK scripts.
Code: Select all
#IfWinActive, GTA:SA:MP
!1::
SendInput t/usepot{enter}
sleep 500
return
!2::
SendInput t/usecrack{enter}
sleep 500
return
numpad1::
SendInput t/mget{enter}t/mdeliver{enter}
sleep 500
return
!4::
SendInput t/modcar 2{enter}
sleep 500
return
!5::
SendInput t/repair{enter}
sleep 500
return
numpad0::
SendInput t/dropcar{enter}
sleep 500
return
!h::
SendInput tOk bye.{enter}t/h{enter}t/cellout{enter}
sleep 500
return
!p::
SendInput t/cellin{enter}t/p{enter}tHello. This is Conrad.{enter}
sleep 500
return
!-::
SendInput t/accept crack{enter}
SendInput t/accept pot{enter}
sleep 500
!0::
SendInput t/accept repair{enter}
sleep 500
return
!,::
SendInput t/enter{enter}
sleep 500
return
!.::
SendInput t/exit{enter}
sleep 500
return
!k::
SendInput t/s BOOP BWEEP{Enter}t/unlock{Enter}
Sendinput t/me unlocks the car{enter}
sleep 500
return
!l::
SendInput t/s BWEEP BOOP{Enter}t/lock{Enter}
Sendinput t/me locks the car{enter}
sleep 500
return
Hope this helps!