EnduringGuerila

PUBG Lean Toggle AHK Script 2.0

Sep 1st, 2017
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ;#Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. ;SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. #MaxThreadsPerHotkey 2
  7. #SingleInstance, force
  8.  
  9. Loop  ;This loop is to cancel the lean when you SPRINT but not cancel when holding breath or just walking forward
  10. {
  11.     GetKeyState, ShiftKey, Shift
  12.     GetKeyState, DoubleU, W
  13.     If (ShiftKey = "D"  and DoubleU = "D")
  14.     {
  15.         If KeyDownQ {
  16.             KeyDownQ := !KeyDownQ
  17.             SendInput {q up}
  18.         }
  19.         else If KeyDownE {
  20.             KeyDownE := !KeyDownE
  21.             SendInput {e up}
  22.         }
  23.     }
  24.     Sleep, 100  ; To cut down on the massive CPU usage. 1000 = 1 second, adjust to your liking
  25. }
  26.  
  27.  
  28. ;Delete this line if you want the script to run even when PUBG isnt active (if you want it to work for another game)
  29. #IfWinActive, PLAYERUNKNOWN'S BATTLEGROUNDS
  30.  
  31.  
  32. global KeyDownQ := false
  33. global KeyDownE := false
  34.  
  35. $q::
  36.     KeyDownQ := !KeyDownQ
  37.     If KeyDownQ {
  38.         SendInput {q down}
  39.         If KeyDownE {           ; This is required to cancel the lean in the other directoin
  40.             KeyDownE := !KeyDownE
  41.             SendInput {e up}
  42.         }
  43.     }
  44.     Else
  45.         SendInput {q up}
  46. Return
  47.  
  48. $e::
  49.     KeyDownE := !KeyDownE
  50.     If KeyDownE {
  51.         SendInput {e down}
  52.         If KeyDownQ {           ; This is required to cancel the lean in the other directoin
  53.             KeyDownQ := !KeyDownQ
  54.             SendInput {q up}
  55.         }
  56.     }
  57.     Else
  58.         SendInput {e up}
  59. Return
Add Comment
Please, Sign In to add comment