Quantcast
Channel: D3Scene
Viewing all articles
Browse latest Browse all 21080

[Help] AHK AutoPistol

$
0
0
Hey guys, I was wondering if anybody here is good with AutoHotKey.
I found this script (AHK-AutoHotKey RapidFire Script), and fixed it up a bit to fit my needs, but it's still not really functioning perfectly.

Code:

~5::KeyWait, 5
GetKeyState, 5State, 5, T
If 5State = D
{
        gActivateScript = 0
}
return


~4::
KeyWait, 4
GetKeyState, 4State, 4, T
If 4State = D
{
        gActivateScript = 0
}
return


~3::
KeyWait, 3
GetKeyState, 3State, 3, T
If 3State = D
{
        gActivateScript = 0
}
return


~2::
KeyWait, 2
GetKeyState, 2State, 2, T
If 2State = D
{
        gActivateScript = 1
}
return


~1::
KeyWait, 1
GetKeyState, 1State, 1, T
If 1State = D
{
        gActivateScript = 0
}
return


~LButton::
Goto, DoFiringLoop
Return


~^LButton::
Goto, DoFiringLoop
Return


~+LButton::
Goto, DoFiringLoop
Return


~^+LButton::
Goto, DoFiringLoop
Return


DoFiringLoop:
if gActivateScript = 1
{
    Loop
    {
        IfWinActive, Counter-Strike: Global Offensive
        {
            MouseClick, left,,, 1, 0, D
            Sleep, 0
            MouseClick, left,,, 1, 0, U
            GetKeyState, LButtonState, LButton, P
            If LButtonState = U
            {
              ;break the loop if physical state of mouse btn is up.
                break
            }
          ;delay between each simu. click events
            Sleep, 0
        }
        else
        {
            break
        }
    }
 
}
exit


return

I changed the hotkeys, instead of insert, to toggle depending on what gun I have, (1 = Primary, 2 = Pistol, 3 = Knife, 4 = Nade, 5 = Bomb).

It works, but only if you double press the key. Example:

I have a rifle. I switch pistol, I use autopistol. I press "4" once, try to throw a nade, and it automatically releases it, because the autopistol function is still active. I would have to press "4" twice to toggle it off.

Anybody have any idea how to fix this? I am not good at coding AutoHotKey, just used common sense to fit it to my needs.

Thanks.

Viewing all articles
Browse latest Browse all 21080

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>