Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Runtime.InteropServices
- Public Class Form1
- 'version 8
- 'recommended to use with Mccree
- Private Declare Function GetTickCount Lib "kernel32" () As UInt32
- Public t As New Timer With {.Interval = 1}
- Public ScanRange As Long = 50
- Public Pixels(ScanRange * ScanRange + ScanRange) As Integer
- Public Pixels_Hue(ScanRange * ScanRange + ScanRange) As Single
- Public Pixels_Brightness(ScanRange * ScanRange + ScanRange) As Single
- Public Pixels_Saturation(ScanRange * ScanRange + ScanRange) As Single
- Public Pixels_R(ScanRange * ScanRange + ScanRange) As Single
- Public LastFireTick As UInteger
- Dim AmountOfPureWhiteFound As Long
- 'edit values below to modify triggerbot
- 'autofire delay - 510 for mccree - 1400 for widow
- Public FireDelayRightMouseDown As UInteger = 1400 'autofire delay when right mouse is down
- Public FireDelayRightMouseUp As UInteger = 510 'autofire delay when right mouse is up
- Public ScanRangeRightMouseDown As Long = 50 'amount of pixels to scan for sniper - right click down
- Public ScanRangeRightMouseUp As Long = 25 'amount of pixels to scan for right click up
- Public AdjustDown As Integer = -1 'optional - move scanning up/down depending on where window is - negative values allowed
- Public AdjustRight As Integer = -1 'optional - move scanning left/right depending on where window is - negative values allowed
- Public RedOrangeRange As Single = 13 ' adjust down to decrease targeting orange
- Public RedVioletRange As Single = 345 ' adjust up to decrease targeting violet
- Public MinBrightness As Single = 0.35 'minimum brightness of pixel range (0-1.00)
- Public MaxBrightness As Single = 0.8 'maximum brightness of pixel range (0-1.00)
- Public MinSaturation As Single = 0.3 'minimum saturation of pixel range (0-1.00)
- Public MinRed As Single = 120 'minimum red value of pixel (0-255) - set lower for darker maps
- 'x/y might be inverted
- Public DistanceFromTargetBeforeFiringX As Long = 12 ' maximum distance from target in x and y to fire
- Public DistanceFromTargetBeforeFiringY As Long = 5 ' maximum distance from target in x and y to fire
- Public NonWhiteCrosshair As Long = 1 ' change this to 1 to stop widow from auto firing while in zoom. Detects pure white crosshair in zoom.
- <DllImport("user32.dll")>
- Shared Function GetAsyncKeyState(ByVal vKey As System.Windows.Forms.Keys) As Short
- End Function
- Private Const VK_RBUTTON = &H2
- Private Const VK_LBUTTON = &H1
- Private Const VK_Q = &H51
- <DllImport("user32.dll")>
- Private Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDc As IntPtr) As IntPtr
- End Function
- <DllImport("user32.dll", SetLastError:=True)>
- Private Shared Function GetActiveWindow() As IntPtr
- End Function
- <DllImport("gdi32")>
- Public Shared Function BitBlt(ByVal hDestDC As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As IntPtr, ByVal SrcX As Integer, ByVal SrcY As Integer, ByVal Rop As Integer) As Boolean
- End Function
- Dim GCH As GCHandle = GCHandle.Alloc(Pixels, GCHandleType.Pinned)
- Dim Bmp As New Drawing.Bitmap(ScanRange, ScanRange, 4 * ScanRange,
- Imaging.PixelFormat.Format32bppArgb,
- GCH.AddrOfPinnedObject)
- <DllImport("user32.dll")>
- Private Shared Function GetWindowDC(ByVal hwnd As IntPtr) As IntPtr
- End Function
- Declare Function GetWindowRect Lib "user32.dll" (
- ByVal hwnd As Int32,
- ByRef lpRect As Rectangle) As Int32
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- If t.Enabled = 0 Then
- Button1.Text = "STOP"
- t.Enabled = 1
- Else
- Button1.Text = "START"
- t.Enabled = 0
- End If
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- AddHandler t.Tick, AddressOf Timer_tick
- If FireDelayRightMouseDown < 100 Then FireDelayRightMouseDown = 100 ' don't make this too low to avoid suspicion - to make it lower use keypressdown and keypressup
- If FireDelayRightMouseUp < 100 Then FireDelayRightMouseUp = 100 ' don't make this too low to avoid suspicion - to make it lower use keypressdown and keypressup
- End Sub
- Private Sub Timer_tick(sender As Object, e As EventArgs)
- RunAimbot()
- End Sub
- Public Sub RunAimbot()
- Dim Amountfound As Long
- Dim AmountfoundCC1 As Long
- Dim CCAmount(0 To 1000) As Long
- Dim I As Long
- Dim lowestX As Long
- Dim lowestY As Long
- Dim highestX As Long
- Dim highestY As Long
- Dim TargetX As Long
- Dim TargetY As Long
- Dim TargetAmountFound As Long
- lowestX = 900
- lowestY = 900
- Dim avgHUE As Single
- Dim avgBrightness As Single
- Dim avgsaturation As Single
- Dim AMountOfPixels As Single
- Dim FireTriggered As Single
- Dim YW As Single
- Dim X As Single
- Dim Y As Single
- Dim YW2 As Single
- Dim X2 As Single
- Dim Y2 As Single
- Dim YWY As Integer
- Dim YW2Y2 As Integer
- Dim CombinedLineFigure As Long
- Dim screenwidth = CInt(Screen.PrimaryScreen.Bounds.Width)
- Dim screenheight = CInt(Screen.PrimaryScreen.Bounds.Height)
- Dim g As Graphics
- Dim hdcDest As IntPtr = IntPtr.Zero
- Dim desktopHandleDC As IntPtr = IntPtr.Zero
- Dim desktopHandle As IntPtr
- 'change scan size based on whether mouse in down or up
- SetScanRange()
- desktopHandle = GetActiveWindow()
- Dim R As Rectangle = New Rectangle(CInt((Screen.PrimaryScreen.Bounds.Width / 2) - (ScanRange / 2)) + AdjustRight, CInt((Screen.PrimaryScreen.Bounds.Height / 2) - (ScanRange / 2)) + AdjustDown, ScanRange, ScanRange)
- Bmp = New Bitmap(ScanRange, ScanRange, 4 * ScanRange,
- Imaging.PixelFormat.Format32bppArgb,
- GCH.AddrOfPinnedObject)
- g = Graphics.FromImage(Bmp)
- desktopHandleDC = GetWindowDC(desktopHandle)
- hdcDest = g.GetHdc
- Dim gf As Integer
- Dim GH As Rectangle
- gf = GetWindowRect(desktopHandle, GH)
- Dim NewRectWidth As Integer
- Dim NewRectheight As Integer
- NewRectWidth = GH.Width - GH.Left
- NewRectheight = GH.Height - GH.Top
- BitBlt(hdcDest, 0, 0, ScanRange, ScanRange, desktopHandleDC, CInt((screenwidth / 2) - (ScanRange / 2) + AdjustRight), CInt((screenheight / 2) - (ScanRange / 2) + AdjustDown), CopyPixelOperation.SourceCopy)
- g.ReleaseHdc(hdcDest)
- ReleaseDC(desktopHandle, desktopHandleDC)
- Bmp.Dispose()
- g.Dispose() : g = Nothing
- Dim myColor As Color
- AMountOfPixels = ScanRange * ScanRange
- For X = 3 To ScanRange - 4
- YW = X * ScanRange
- For Y = 3 To ScanRange - 4
- YWY = YW + Y
- myColor = Color.FromArgb((Pixels(YWY)))
- Pixels_Hue(YWY) = myColor.GetHue
- Pixels_Brightness(YWY) = myColor.GetBrightness
- Pixels_Saturation(YWY) = myColor.GetSaturation
- Pixels_R(YWY) = myColor.R
- avgHUE = avgHUE + Pixels_Hue(YWY)
- avgBrightness = avgBrightness + Pixels_Brightness(YWY)
- avgsaturation = avgsaturation + Pixels_Saturation(YWY)
- If NonWhiteCrosshair = 1 Then
- 'sniper zoom fix
- If Pixels_Hue(YWY) = 0 And Pixels_Saturation(YWY) = 0 And Pixels_Brightness(YWY) = 1 And CheckRightMouse() = 1 And (LastFireTick + FireDelayRightMouseDown) <= GetTickCount Then
- AmountOfPureWhiteFound = AmountOfPureWhiteFound + 1
- If AmountOfPureWhiteFound > 20 Then
- 'fix for sniper red in zoom with large scan range =/
- LastFireTick = LastFireTick + 150
- End If
- End If
- End If
- If Pixels_Hue(YWY) < RedOrangeRange Or Pixels_Hue(YWY) > RedVioletRange Then
- If Pixels_Brightness(YWY) > MinBrightness And Pixels_Brightness(YWY) < MaxBrightness And Pixels_Saturation(YWY) > MinSaturation And Pixels_R(YWY) > MinRed Then ' Target by hue to bypass 1.12
- Amountfound = Amountfound + 1
- 'DEBUG
- 'RichTextBox1.AppendText("HUE=" & (myColor.GetHue()).ToString & vbTab & "SAT=" & myColor.GetSaturation().ToString & vbTab & "BGT=" & (myColor.GetBrightness()).ToString & vbTab & myColor.R & vbNewLine)
- If lowestX > X Then
- lowestX = X
- End If
- If lowestY > Y Then
- lowestY = Y
- End If
- If highestY < Y Then
- highestY = Y
- End If
- If highestX < X Then
- highestX = X
- End If
- 'advanced comparison
- For X2 = (X - 3) To (X + 3)
- YW2 = X2 * ScanRange
- For Y2 = (Y - 3) To (Y + 3)
- YW2Y2 = YW2 + Y2
- 'x2=0 and y2=0 produces additional triggered pixel
- If Pixels_Hue(YW2Y2) < RedOrangeRange Or Pixels_Hue(YW2Y2) > RedVioletRange Then
- If Pixels_Brightness(YW2Y2) > MinBrightness And Pixels_Brightness(YW2Y2) < MaxBrightness And Pixels_Saturation(YW2Y2) > MinSaturation And Pixels_R(YW2Y2) > MinRed Then ' Target by hue to bypass 1.12
- AmountfoundCC1 = AmountfoundCC1 + 1
- End If
- End If
- Next Y2
- Next X2
- CCAmount(AmountfoundCC1) = CCAmount(AmountfoundCC1) + 1
- AmountfoundCC1 = 0
- 'target x/y
- If CheckRightMouse() = 0 Then
- For I = 1 To 13
- TargetY = TargetY + Y 'settings for right mouse up
- TargetX = TargetX + X
- TargetAmountFound = TargetAmountFound + 1
- Next I
- Else
- For I = 2 To 19
- TargetY = TargetY + Y 'settings for right mouse down
- TargetX = TargetX + X
- TargetAmountFound = TargetAmountFound + 1
- Next I
- End If
- End If
- End If
- NExtY:
- Next Y
- Next X
- 'combine line figures together
- If CheckRightMouse() = 0 Then
- For I = 1 To 13
- CombinedLineFigure = CombinedLineFigure + CCAmount(I) 'settings for right mouse up
- Next I
- Else
- For I = 2 To 19
- CombinedLineFigure = CombinedLineFigure + CCAmount(I) 'settings for right mouse down
- Next I
- End If
- ' CombinedLineFigure = CombinedLineFigure * 10
- ' RichTextBox1.AppendText("CombinedLineFigure=" & CombinedLineFigure & vbTab & "Amountfound=" & Amountfound & vbNewLine)
- If CombinedLineFigure >= (ScanRange * 0.15) And (CombinedLineFigure * 1.33) >= Amountfound Then
- If (lowestX + (ScanRange * 0.15)) <= highestX And (lowestY + (ScanRange * 0.15)) <= highestY Then
- FireTriggered = 1
- ' RichTextBox1.AppendText("CombinedLineFigure=" & CombinedLineFigure & vbTab & "Amountfound=" & Amountfound & vbNewLine)
- ' RichTextBox1.AppendText("Fire" & vbNewLine)
- End If
- End If
- avgHUE = avgHUE / AMountOfPixels
- avgBrightness = avgBrightness / AMountOfPixels
- avgsaturation = avgsaturation / AMountOfPixels
- If avgHUE > 2 And avgHUE < 14 And avgBrightness < 0.45 And avgsaturation < 0.45 Then
- FireTriggered = 0 ' don't fire
- End If
- If CheckRightMouse() = 0 Then 'adjust for zoom
- If Math.Abs((TargetX / TargetAmountFound) - (ScanRange / 2)) > DistanceFromTargetBeforeFiringX Then
- FireTriggered = 0 ' don't fire
- End If
- If Math.Abs((TargetY / TargetAmountFound) - (ScanRange / 2)) > DistanceFromTargetBeforeFiringY Then
- FireTriggered = 0 ' don't fire
- End If
- Else 'while zoomed / hold down right click
- If Math.Abs((TargetX / TargetAmountFound) - (ScanRange / 2)) > (DistanceFromTargetBeforeFiringX * 2) Then
- FireTriggered = 0 ' don't fire
- End If
- If Math.Abs((TargetY / TargetAmountFound) - (ScanRange / 2)) > (DistanceFromTargetBeforeFiringY * 2) Then
- FireTriggered = 0 ' don't fire
- End If
- End If
- If CheckKeyQ() = 1 And CheckRightMouse() = 0 Then
- LastFireTick = GetTickCount + 5000 'pressing Q for ultimate delays firing by 5 secs when mouse is up. With widow use ultimate while zoomed to avoid delay.
- End If
- If FireTriggered = 1 Then
- Fire()
- End If
- 'debug and testing
- If LastFireTick = GetTickCount Then
- ' RichTextBox1.AppendText("CombinedLineFigure=" & CombinedLineFigure & vbTab & "Amountfound=" & Amountfound & vbNewLine)
- ' RichTextBox1.Text = ("avgHUE=" & avgHUE & vbTab & "avgSAT=" & avgsaturation & vbTab & "avgBGT=" & avgBrightness)
- 'RichTextBox1.AppendText("avgHUE=" & avgHUE & vbTab & "avgSAT=" & avgsaturation & vbTab & "avgBGT=" & avgBrightness & vbNewLine)
- 'RichTextBox1.AppendText("low_x= " & lowestX & "high_x= " & highestX & "low_y= " & lowestY & "high_y= " & highestY)
- ' Dim i2 As Long
- ' For i2 = 0 To 30
- ' RichTextBox1.AppendText(CCAmount(i2) & vbTab)
- ' Next
- 'RichTextBox1.AppendText(vbNewLine)
- ' RichTextBox1.AppendText(Math.Round((TargetX / TargetAmountFound) - ScanRange / 2) & " " & (Math.Round((TargetY / TargetAmountFound)) - ScanRange / 2) & vbNewLine)
- 'moving mouse settings
- 'aimbot target X = Math.Round((screenwidth / 2) + (TargetX / TargetAmountFound) - ScanRange / 2) + AdjustRight - not tested
- 'aimbot target Y = Math.Round((screenheight / 2) + (TargetY / TargetAmountFound) - ScanRange / 2) + AdjustDown- not tested
- 'Y axis might be reversed - (Y * -1) to fix
- ' RichTextBox1.AppendText(Math.Round((screenheight / 2) + (TargetX / TargetAmountFound) - ScanRange / 2) + AdjustRight & vbNewLine)
- End If
- End Sub
- Public Sub Fire()
- If (LastFireTick + FireDelayRightMouseDown) <= GetTickCount And CheckRightMouse() = 1 Then GoTo Fire
- If (LastFireTick + FireDelayRightMouseUp) <= GetTickCount And CheckRightMouse() = 0 Then
- Fire:
- If CheckLeftMouse() = 0 Then 'don't fire when mouse is being manually clicked
- SendKeys.Send("k")
- ' RichTextBox1.AppendText("avgHUE=" & avgHUE & vbTab & "avgSAT=" & avgsaturation & vbTab & "avgBGT=" & avgBrightness & vbNewLine)
- End If
- LastFireTick = GetTickCount
- End If
- End Sub
- Public Function CheckRightMouse() As Long
- If GetAsyncKeyState(VK_RBUTTON) <> 0 Then
- Return 1
- End If
- Return 0
- End Function
- Public Function CheckLeftMouse() As Long
- If GetAsyncKeyState(VK_LBUTTON) <> 0 Then
- Return 1
- End If
- Return 0
- End Function
- Public Function CheckKeyQ() As Long
- If GetAsyncKeyState(VK_Q) <> 0 Then
- Return 1
- End If
- Return 0
- End Function
- Public Sub SetScanRange()
- If CheckRightMouse() = 0 Then
- ScanRange = ScanRangeRightMouseUp 'settings for right mouse up
- Else
- ScanRange = ScanRangeRightMouseDown 'settings for right mouse down
- End If
- End Sub
- Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
- Dim i As Long
- Application.DoEvents()
- Using g As Graphics = Graphics.FromHwnd(IntPtr.Zero)
- For i = 0 To 999
- SetScanRange()
- Dim rect As Rectangle = New Rectangle((Screen.PrimaryScreen.Bounds.Width / 2) - (ScanRange / 2) + AdjustRight, (Screen.PrimaryScreen.Bounds.Height / 2) - (ScanRange / 2) + AdjustDown, ScanRange, ScanRange)
- Using lgb As New Drawing2D.LinearGradientBrush(rect, Color.Blue, Color.Blue, 90, True)
- g.FillRectangle(lgb, rect)
- Application.DoEvents()
- If Not CheckBox1.CheckState = CheckState.Checked Then Exit Sub
- End Using
- Next i
- End Using
- CheckBox1.CheckState = CheckState.Unchecked
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement