Advertisement
Guest User

Untitled

a guest
Oct 11th, 2017
1,895
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. ; Configuration
  2.  
  3. #NoEnv ;Improves performance and compatibility with future AHK updates.
  4. #SingleInstance force ;It allows to run only one at the same time.
  5. SetTitleMatchMode, 2 ;Matching for window title.
  6. #ifwinactive, PLAYERUNKNOWN'S BATTLEGROUNDS ;Active only when in PUBG.
  7.  
  8.  
  9. ; Variables
  10.  
  11. isMouseShown() ;To suspend script when mouse is visible.
  12. ADS = 0 ;Var for fast aiming.
  13. CrouchJump = 1 ;Var for crouch when jumping.
  14. AutoFire = 0 ;Var for autofiring.
  15. Compensation = 0 ;Var for compensation when autofiring.
  16. compVal = 10 ;Compensation value.
  17.  
  18.  
  19. ; Suspends if mouse is visible
  20.  
  21.  
  22. isMouseShown() ;It suspends the script when mouse is visible (map, inventory, menu).
  23. {
  24. StructSize := A_PtrSize + 16
  25. VarSetCapacity(InfoStruct, StructSize)
  26. NumPut(StructSize, InfoStruct)
  27. DllCall("GetCursorInfo", UInt, &InfoStruct)
  28. Result := NumGet(InfoStruct, 8)
  29.  
  30. if Result > 1
  31. Return 1
  32. else
  33. Return 0
  34. }
  35. Loop
  36. {
  37. if isMouseShown() == 1
  38. Suspend On
  39. else
  40. Suspend Off
  41. Sleep 1
  42. }
  43.  
  44. ; Fast Aiming
  45.  
  46.  
  47. *RButton:: ;Fast Aiming [default: Right Button]
  48. if ADS = 1
  49. { ;If active, clicks once and clicks again when button is released.
  50. SendInput {RButton Down}
  51. SendInput {RButton Up}
  52. KeyWait, RButton
  53. SendInput {RButton Down}
  54. SendInput {RButton Up}
  55. } else { ;If not, just keeps holding until button is released.
  56. SendInput {RButton Down}
  57. KeyWait, RButton
  58. SendInput {RButton Up}
  59. }
  60. Return
  61.  
  62.  
  63. ; CrouchJump
  64.  
  65.  
  66. *XButton2:: ;Crouch when jumping [default: Button 4]
  67. if CrouchJump = 1
  68. {
  69. SendInput {Space down}
  70. SendInput {c down}
  71. SendInput {Space up}
  72. Sleep 500 ;Keeps crouching 0.5 seconds to improve the jump.
  73. SendInput {c up}
  74. }
  75. Return
  76.  
  77.  
  78. ; AutoFire
  79.  
  80.  
  81. ~$*LButton:: ;AutoFire
  82. if AutoFire = 1
  83. {
  84. Loop
  85. {
  86. GetKeyState, LButton, LButton, P
  87. if LButton = U
  88. Break
  89. MouseClick, Left,,, 1
  90. Gosub, RandomSleep ;Call to RandomSleep.
  91. if Compensation = 1
  92. {
  93. mouseXY(0, compVal) ;If active, call to Compensation.
  94. }
  95. }
  96. }
  97. Return
  98. RandomSleep: ;Random timing between clicks, just in case.
  99. Random, random, 14, 25
  100. Sleep %random%-5
  101. Return
  102.  
  103.  
  104. ; Compensation
  105.  
  106.  
  107. mouseXY(x,y) ;Moves the mouse down to compensate recoil (value in compVal var).
  108. {
  109. DllCall("mouse_event",uint,1,int,x,int,y,uint,0,int,0)
  110. }
  111.  
  112.  
  113. ; Tooltips
  114.  
  115.  
  116. ToolTip(label) ;Function to show a tooltip when activating, deactivating or changing values.
  117. {
  118. ToolTip, %label%, 930, 650 ;Tooltips are shown under crosshair for FullHD monitors.
  119. SetTimer, RemoveToolTip, 1300 ;Removes tooltip after 1.3 seconds.
  120. return
  121. RemoveToolTip:
  122. SetTimer, RemoveToolTip, Off
  123. ToolTip
  124. Return
  125. }
  126.  
  127.  
  128. ; Hotkeys for changing values
  129.  
  130.  
  131. ;Toggles
  132. *NumPad1::(ADS = 0 ? (ADS := 1,ToolTip("ADS ON")) : (ADS := 0,ToolTip("ADS OFF")))
  133. *NumPad2::(AutoFire = 0 ? (AutoFire := 1,ToolTip("AutoFire ON")) : (AutoFire := 0,ToolTip("AutoFire OFF")))
  134. *NumPad3::(Compensation = 0 ? (Compensation := 1,ToolTip("Compensation ON")) : (Compensation := 0,ToolTip("Compensation OFF")))
  135. *NumPad0::(CrouchJump = 0 ? (CrouchJump := 1,ToolTip("CrouchJump ON")) : (CrouchJump := 0,ToolTip("CrouchJump OFF")))
  136.  
  137. *NumpadAdd:: ;Adds compensation.
  138. compVal := compVal + 5
  139. ToolTip("Compensation " . compVal)
  140. Return
  141.  
  142. *NumpadSub:: ;Substracts compensation.
  143. if compVal > 0
  144. {
  145. compVal := compVal - 5
  146. ToolTip("Compensation " . compVal)
  147. }
  148. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement