There is currently a faction war going on! View Stats
C-Slo
Donator
Posts: 5115
Game name: Tom_Licata, Lucious_Craig

[GUIDE] Using Autohotkey + Suitable scripts

June 11th, 2018, 2:09 pm


Image
Autohotkey
Image
AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc. Keybinding means to assign hotkeys to specific functions.

Autohotkey can also be used to keybind SAMP commands.


Using AHK for SAMP
For SAMP, you can use AHK using the following steps.
  • Downloading and Installing AHK: Get a version of Autohotkey from here and install it.
  • Making a script: Click your right mouse button and navigate to "New" --> Autohotkey script. Name it whatever you want, for example "Tomasso's script". Right click on it again and select "edit script". You will see a block of text. Ignore it and start your script from below (leaving a single line).
    Spoiler
    Image
    Image
    Image
  • Making it functional: Type the keys you want to use for a specific command. Each key has its own name.
    [+] Key names
    CapsLock
    Space
    Tab
    Enter
    Escape (or Esc)
    Backspace (or BS)
    ScrollLock
    Delete (or Del)
    Insert (or Ins)
    Home
    End
    PgUp (page up key)
    PgDn (page down key)
    Up (up arrow key)
    Down (down arrow key)
    Left (left arrow key)
    Right (right arrow key)

    Numpad0
    Numpad1
    Numpad2
    Numpad3
    Numpad4
    Numpad5
    Numpad6
    Numpad7
    Numpad8
    Numpad9
    NumpadDel
    NumLock (number lock key)
    NumpadDiv (for division key)
    NumpadMult (for multiplication key)
    NumpadAdd (addition)
    NumpadSub (subtraction)
    NumpadEnter

    F1 - F24 (The 12 or more function keys at the top of most keyboards.)

    LWin (Left Windows key)
    RWin (Right Windows key)

    Control (or Ctrl)
    Alt
    Shift
    LControl
    RControl
    LShift
    RShift
    LAlt
    RAlt
  • Let's say we're going to use they key "F2" for the command "/help". Type F2 in the line and then :: (without space). After the proportion sign, add space and type "SendInput" (without the inverted commas). Add a space again and then type "t/help{Enter}" (without the inverted commas). You can add any other command instead of /help.

    Code: Select all

    F2:: SendInput t/help{Enter}
    Spoiler
    Image
  • You can add more commands to the same hotkey. After "{Enter}" type "t/kill{Enter}" without adding space. The commands will proceed in the written order. If you place /kill command first, then it'll proceed with that first.

    Code: Select all

    F2:: SendInput t/help{Enter}t/kill{Enter}
    Spoiler
    Image
  • If you don't add "{Enter}" to the end of your commands, it will leave the command line open with the command already written (means you will have to press Enter manually to make the command work).

    Code: Select all

    F2:: SendInput t/help{Enter}t/kill
    Spoiler
    Image
    In this case, you will have /kill command written on SAMP command line and you will have to press Enter on your keyboard to kill your character.
    Spoiler
    Image
  • You can also create a CUSTOM hotkey by adding "&" between two key names. For example, if we want to use Control and P at once for /p, we will type

    Code: Select all

    Ctrl & P:: SendInput t/p This is the SAPD - Pull over to the right side of the road and turn your engine off!{Enter}
    Spoiler
    Image
  • If you want to use more keys for other binds, just start writing your second command on the second line.

    Code: Select all

    Ctrl & P:: SendInput t/p This is the SAPD - Pull over to the right side of the road and turn your engine off!{Enter}
    Ctrl & Z:: SendInput t/tz{Enter}
    Spoiler
    Image
    So you have two binds written in this case.
  • Saving your script: Click on "File" at the top left corner of the notepad and click "Save".
    Spoiler
    Image
  • Running your script: Click your script in order to run it. Launch your game and you're good to go!
  • Testing your script: Open notepad and hit your desired key to check whether or not the binds work.

    NOTE: You may assign your own keys by using the proper key names. You can use as many binds for a single key. However, avoid using only alphabet keys which may trigger while you're typing something (like I am right now).

Suitable Scripts

  • For LEAs

    Code: Select all

    Ctrl & J:: SendInput t/duty{Enter}t/heal{Enter}t/givegun{Enter}
    Ctrl & K:: SendInput t/getfreq 1{Enter}t/syncradio 1{Enter}t/r U*** reporting on duty.{Enter}
    Numpad0:: SendInput t/engine{Enter}
    Ctrl & Numpad0:: SendInput t/engine{Enter}t/car fix{Enter}t/engine{Enter}
    Ctrl & P:: SendInput t/p This is the SAPD - Pull over to the right side of the road and turn your engine off!{Enter}
    Ctrl & Z:: SendInput t/tz{Enter}
    F2:: SendInput t/bk{Enter}t/d 
    F3:: SendInput t/em{Enter}t/d Need immediate backup at my location, over!{Enter}
    F5:: SendInput t/me takes out his cuffs and places them on the suspect's wrists.{Enter}t/cuff
    F6:: SendInput t/me pushes the suspect inside the cruiser.{Enter}t/get 
    

  • For illegals

    Code: Select all

    Numpad0:: SendInput t/engine{Enter}
    Ctrl & Numpad0:: SendInput t/engine{Enter}t/car fix{Enter}t/engine{Enter}
    F5:: SendInput t/fbk{Enter}t/r Need you all at my location.{Enter}
    Ctrl & P:: SendInput t/sellgun 
    Ctrl & Z:: SendInput t/usedrugs heroin{Enter}
    Alt & J:: SendInput t/floadguns{Enter}t/floadbullets{Enter}
    Alt & K:: SendInput t/fillhqstock{Enter}
    Ctrl & J:: SendInput t/loadbulletcrates{Enter}t/loadguncrates{Enter}
    Ctrl & K:: SendInput t/sellbulletcrates{Enter}t/sellguncrates{Enter}
    
  • For dealers

    Code: Select all

    Ctrl & O:: SendInput t/openbets 0{Enter}
    Ctrl & P:: SendInput t/closebets{Enter}t/roulette{Enter}
    Alt & P:: SendInput t/blackjack{Enter}
OPEN YOUR SCRIPT, CLICK EDIT SCRIPT AND PASTE THIS SCRIPT BELOW THE BLOCK OF TEXT.
Spoiler
Image


If you have problems using AHK or need some help, just PM me in-game or on forums so I can help you ASAP.


Last edited by C-Slo on June 11th, 2018, 3:37 pm, edited 7 times in total.
"If you cannot accept the true I don't find it as mine problem at all."

Report of the decade.

vans
Donator
Posts: 4637
Game name: Rachel_Porter, Dave_Silver

Re: [GUIDE] Using Autohotkey + Suitable scripts

June 11th, 2018, 2:11 pm

Fix your image if possible.
Image

Also, good one, thank you (:

C-Slo
Donator
Posts: 5115
Game name: Tom_Licata, Lucious_Craig

Re: [GUIDE] Using Autohotkey + Suitable scripts

June 11th, 2018, 2:12 pm

vans wrote:
June 11th, 2018, 2:11 pm
Fix your image if possible.
Image

Also, good one, thank you (:
They're still uploading (;

Thanks for the feedback.
"If you cannot accept the true I don't find it as mine problem at all."

Report of the decade.

Gazzar
SA Police Department
User avatar
Posts: 1771
Game name: Billy_DeLuca, Billy_Trescott

Re: [GUIDE] Using Autohotkey + Suitable scripts

June 11th, 2018, 7:50 pm

Great work buddy, read it all..very useful even for those who doesn't even now shit about AHK..that's a true tutorial

Killa
Radio DJ
User avatar
Posts: 343
Game name: Akeem_Coke, Charlie_Agnoli, Tommy_Kartel

Re: [GUIDE] Using Autohotkey + Suitable scripts

June 11th, 2018, 9:02 pm

Excellent
What is Racism???
Racism is when you select your white clothes to wash first before the black ones....... say NO!!!! to racism..... wash them together.

The greatness of a man is not in how much wealth he acquires, but in his integrity and his ability to affect those around him positively.


Return to “Outdated Guides”