Help with AHK and variables.

Ask gaming related questions (AHK v1.1 and older)
ivyandrei
Posts: 13
Joined: 11 Aug 2018, 20:10

Help with AHK and variables.

07 Jan 2019, 00:46

Hi! Can you please help me with a script for SA:MP Game. I want to make a script that when i type in Game a command like /drugsID (/drugs164 for example) to send some text in chat like “Hi! You were suprised with drugs on you, so it will be confiscated!” and then send a command in the Game with /confiscate 164 drugs and then press enter. Can you please help me with this? I am reading a lot of topics, but no help.
I know that to send text in chat i can use command SendInput
Like “SendInput tHi. You were suprised with drugs on you, so it will be confiscated. {Enter}” but i don’t know how can i read that id and then send the command.
Rohwedder
Posts: 7672
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help with AHK and variables.

07 Jan 2019, 02:53

Hallo,
perhaps this Hotstring?

Code: Select all

:?t:drugs164::Hi! You were suprised with drugs on you, so it will be confiscated!
ivyandrei
Posts: 13
Joined: 11 Aug 2018, 20:10

Re: Help with AHK and variables.

07 Jan 2019, 04:39

Rohwedder wrote:
07 Jan 2019, 02:53
Hallo,
perhaps this Hotstring?

Code: Select all

:?t:drugs164::Hi! You were suprised with drugs on you, so it will be confiscated!
It’s not what i want. I want to type /drugs +iD and the script will sent a text that i want and then type the command /confiscate iD drugs and press ENTER.
Rohwedder
Posts: 7672
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Help with AHK and variables.

07 Jan 2019, 06:50

then perhaps:

Code: Select all

:*:/drugs:: ;type /drugs012
Input, ID, L3 ;ID must have 3 digits
ID += 0 ;removes leading zeros, 012 becomes 12
SendRaw, Hi! You were suprised with drugs on you, so it will be confiscated!
SendInput, /confiscate %ID% drugs{Enter}
Return
mast4rwang
Posts: 141
Joined: 19 Jul 2017, 09:59

Re: Help with AHK and variables.

09 Jan 2019, 16:48

I suggest logging all of your key presses and checking if string "/drugs" is detected. If so, check the next symbols you type until you press Enter and it copies them to produce your required string

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 63 guests