Code:
#include-once
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include "FastFind.au3"
#include <Array.au3>
#include <Color.au3>
#include <WinAPIGdi.au3>
Opt('MouseCoordMode', 2)
Opt('PixelCoordMode', 2)
Global $SettingHitChance = .60
Global $SettingTriggerRadarSize = 18
Global $ShowRadar = 1
;HotKeys
HotKeySet("{HOME}", "Stop")
HotKeySet("{END}", "Pause")
HotKeySet("{DELETE}", "SwitchAimMode")
;Main FORM
Global $frmBot, $mFile, $mClose, $mOptions, $mSettings, $mAutoUpdate, $mDrawDebug, $lblHitChance, $lblStatus, $lblfrmTriggerBot, $lblfrmAimBot, $lblHelpMsg1, $lblHelpMsg2, $lblHelpMsg3
Global $Interations = 0
;Settings FORM
Global $SettingsGUI, $tabSettings, $tsBotSettings, $grpBotSettings, $cbAutoRun, $lblWindowClass, $lblAimKey, $lblTriggerAimKey, $txtWindowClass, $txtAimKey, $txtTriggerAimKey
Global $tsPixelSettings, $grpPixelSettings, $txtSearchAreaSize, $txtShadeVariation, $txtMinPureColors, $txtMaxShades, $lblSearchAreaSize, $lblShadeVariation, $lblMinPureColors, $lblMaxShades, $lblSearchColors, $editSearchColors
Global $btnSave, $grpEnable, $cbAimBot, $cbTriggerBot, $txtAimShootAreaSize, $txtAimBotStepSize, $txtTriggerScanSize, $lblAimBotStepSize, $lblAimShootAreaSize, $lblTriggerScanSize
Global $SettingAimMode
Global $SettingTriggerScanSize, $SettingTriggerBot, $SettingTriggerAimKey
Global $SettingAimShootAreaSize, $SettingAimBot, $SettingAimKey, $SettingAutoShoot, $SettingAimBotStepSize
Global $SettingSearchAreaSize, $SettingShadeVariation, $SettingMinPureColors, $SettingMaxShades, $SettingMaxR, $SettingMaxG, $SettingMaxB, $SettingMinR, $SettingMinG, $SettingMinB
Global $SettingDrawDebug, $SettingWindowClass, $SettingAutoRun, $SettingAutoUpdate
Global $WindowHandle, $CurrentCoord, $VersionsInfo, $Version, $OldVersion, $NewVersion, $GUITitle, $DebugGUIs[7]
Global $X_Ratio, $Y_Ratio, $MiddleX, $MiddleY, $Size
Global $SearchAreaSizeX, $AimShootAreaSizeX, $SearchAreaSizeY, $AimShootAreaSizeY
Global $SearchAreaQuads[4][7]
Global $SearchAreaPoints[4]
Global $AimShootAreaPoints[4]
Global $LoopTimeArray = []
Global $SettingsPath = "Settings.ini"
Global $DebugGUI
Global $UnitTable = []
;***************************************************MODIFY IF YOU WANT***************************************************************
;AIMBOT $ TRIGGERBOT SETTINGS
Global $SettingAimMode = 0 ;0 = Triggerbot and aimbot ON,1 = Triggerbot ON,2 = Aimbot ON
;Triggerbot
$SettingTriggerScanSize = 45
$SettingTriggerBot = 0
$SettingTriggerAimKey = ""
;Aimbot
$SettingAimShootAreaSize = 5
$SettingAimBot = 1
$SettingAimKey = "01"
$SettingAutoShoot = 0
$SettingAimBotStepSize = 5 ;Lower the value = slower aimbot, higher equal faster aimbot
;Pixel Search settings
$SettingSearchAreaSize = 100
Global $SettingSearchColors[13] = [0xF2361B, 0xEF3519, 0xEE4131, 0xED4233, 0xEE4031, 0xCF8790, 0xCF878F, 0xD92411, 0xDC2613, 0xA24D53, 0xA84547, 0xB25C62, 0xAB545B] ;Color to search for, hex!
$SettingShadeVariation = 10
$SettingMinPureColors = 13
$SettingMaxShades = 25
$SettingMaxR = 242
$SettingMaxG = 135
$SettingMaxB = 144
$SettingMinR = 162
$SettingMinG = 36
$SettingMinB = 17
;DrawDebug
$SettingDrawDebug = 0
;Game Handle Name
$SettingWindowClass = "[CLASS:TankWindowClass]"
;Bot Settings
$SettingAutoRun = 1
$SettingAutoUpdate = 1
;***************************************************MODIFY IF YOU WANT***************************************************************
;Used by Bot Settings
$CurrentCoord = ""
$VersionsInfo = "http://bit.ly/1O7cfqX"
$Version = "1.63"
$OldVersion = IniRead("updater.ini", "Version", "Version", $Version)
$NewVersion = "0.0"
$GUITitle = GetTitle()
;ShellExecute("http://www.ownedcore.com/forums/reputation.php?do=addreputation&p=3435059")
RefreshSettings()
If $SettingAutoUpdate = 1 Then DoUpdate()
MainGUI()
Func MainGUI()
$frmBot = GUICreate($GUITitle & $Version & " - Updating", 270, 165, 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
GUISetBkColor(0xC0C0C0)
$mFile = GUICtrlCreateMenu("File")
$mClose = GUICtrlCreateMenuItem("Exit", $mFile)
$mOptions = GUICtrlCreateMenu("Options")
$mSettings = GUICtrlCreateMenuItem("Settings", $mOptions)
$mAutoUpdate = GUICtrlCreateMenuItem("Auto Update", $mOptions)
GUISetCheck($mAutoUpdate, $SettingAutoUpdate)
$mDrawDebug = GUICtrlCreateMenuItem("Draw Debug", $mOptions)
GUISetCheck($mDrawDebug, $SettingDrawDebug)
$lblHitChance = GUICtrlCreateLabel("HitChance: 0%", 4, 0, 280, 24)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblStatus = GUICtrlCreateLabel("Average Loop Time: 0", 4, 20, 250, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblfrmTriggerBot = GUICtrlCreateLabel("Trigger Bot: " & GetTriggerBotState(), 4, 40, 250, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblfrmAimBot = GUICtrlCreateLabel("Aim Bot: " & GetAimBotState(), 4, 60, 250, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblHelpMsg1 = GUICtrlCreateLabel("Press DELETE to change aim modes", 4, 80, 250, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0xFF0000)
$lblHelpMsg2 = GUICtrlCreateLabel("Press END to pause", 4, 100, 250, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0xFF0000)
$lblHelpMsg3 = GUICtrlCreateLabel("Press HOME to end", 4, 120, 250, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState()
UpdateGUIAimMode()
While 1
$aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
Switch $aMsg[1] ; check which GUI sent the message
Case $frmBot
Switch $aMsg[0]
Case $mSettings
GUICtrlSetState($mSettings, $GUI_DISABLE)
SettingsGUI()
Case $mClose
Exit
Case $mDrawDebug
If IsChecked($mDrawDebug) Then
RemoveDebugGUI()
GUICtrlSetState($mDrawDebug, $GUI_UNCHECKED)
Else
DrawDebugGUI()
GUICtrlSetState($mDrawDebug, $GUI_CHECKED)
EndIf
IniWrite($SettingsPath, "BotSettings", "DrawDebug", ConvertFlag($mDrawDebug))
Case $mAutoUpdate
If IsChecked($mAutoUpdate) Then
GUICtrlSetState($mAutoUpdate, $GUI_UNCHECKED)
Else
GUICtrlSetState($mAutoUpdate, $GUI_CHECKED)
EndIf
IniWrite($SettingsPath, "BotSettings", "AutoUpdate", ConvertFlag($mAutoUpdate))
EndSwitch
Case $SettingsGUI
Switch $aMsg[0] ; Now check for the messages for $hGUI2
;BOT SETTINGS
Case $cbAutoRun
If IsChecked($cbAutoRun) Then GUICtrlSetState($cbAutoRun, $GUI_CHECKED)
;AIM BOT
Case $cbAimBot
If IsChecked($cbAimBot) Then GUICtrlSetState($cbAimBot, $GUI_CHECKED)
;TRIGGER BOT
Case $cbTriggerBot
If IsChecked($cbTriggerBot) Then GUICtrlSetState($cbTriggerBot, $GUI_CHECKED)
Case $btnSave
SaveINI()
RefreshSettings()
GUIDelete($SettingsGUI)
GUICtrlSetState($mSettings, $GUI_ENABLE)
UpdateGUIAimMode()
EndSwitch
EndSwitch
RunBot()
WEnd
EndFunc ;==>MainGUI
Func SettingsGUI()
$SettingsGUI = GUICreate($GUITitle & $Version, 459, 198, 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
GUISetIcon(@ScriptDir & "\Setting-icon.ico")
$tabSettings = GUICtrlCreateTab(8, 8, 281, 153)
GUICtrlSetResizing($SettingsGUI, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$tsBotSettings = GUICtrlCreateTabItem("Pixel Bot")
$grpBotSettings = GUICtrlCreateGroup("", 12, 33, 273, 121)
$cbAutoRun = GUICtrlCreateCheckbox("Auto Run", 20, 49, 73, 17)
$lblWindowClass = GUICtrlCreateLabel("Game Handle:", 20, 77, 93, 17)
$lblAimKey = GUICtrlCreateLabel("Aimbot Key:", 20, 102, 93, 17)
$lblTriggerAimKey = GUICtrlCreateLabel("Triggerbot Key:", 20, 127, 93, 17)
$txtWindowClass = GUICtrlCreateInput($SettingWindowClass, 116, 75, 105, 21)
$txtAimKey = GUICtrlCreateInput($SettingAimKey, 116, 100, 105, 21)
$txtTriggerAimKey = GUICtrlCreateInput($SettingTriggerAimKey, 116, 125, 105, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$tsPixelSettings = GUICtrlCreateTabItem("Pixel Search")
$grpPixelSettings = GUICtrlCreateGroup("Settings", 12, 33, 273, 121)
$txtSearchAreaSize = GUICtrlCreateInput($SettingSearchAreaSize, 86, 49, 55, 21)
$txtShadeVariation = GUICtrlCreateInput($SettingShadeVariation, 86, 73, 55, 21)
$txtMinPureColors = GUICtrlCreateInput($SettingMinPureColors, 86, 97, 55, 21)
$txtMaxShades = GUICtrlCreateInput($SettingMaxShades, 86, 121, 55, 21)
$lblSearchAreaSize = GUICtrlCreateLabel("Area Size:", 20, 52, 65, 17)
$lblShadeVariation = GUICtrlCreateLabel("Varations:", 20, 76, 65, 17)
$lblMinPureColors = GUICtrlCreateLabel("Min Colors:", 20, 100, 65, 17)
$lblMaxShades = GUICtrlCreateLabel("Max Shades:", 20, 124, 65, 17)
$lblSearchColors = GUICtrlCreateLabel("Search Colors:", 148, 52, 80, 35)
$editSearchColors = GUICtrlCreateEdit(SearchColorsToString($SettingSearchColors), 148, 73, 121, 65)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateTabItem("")
$btnSave = GUICtrlCreateButton("Save", 368, 168, 75, 25, 0)
$grpEnable = GUICtrlCreateGroup("Enable", 296, 24, 161, 137)
$cbAimBot = GUICtrlCreateCheckbox("Aimbot Enabled", 312, 41, 100, 17)
$lblAimShootAreaSize = GUICtrlCreateLabel("Aimbot Area:", 312, 65, 93, 17)
$txtAimShootAreaSize = GUICtrlCreateInput($SettingAimShootAreaSize, 392, 62, 55, 21)
$lblAimBotStepSize = GUICtrlCreateLabel("Step Size:", 312, 89, 93, 17)
$txtAimBotStepSize = GUICtrlCreateInput($SettingAimBotStepSize, 392, 86, 55, 21)
$cbTriggerBot = GUICtrlCreateCheckbox("Triggerbot Enabled", 312, 115, 100, 17)
$lblTriggerScanSize = GUICtrlCreateLabel("Trigger Area:", 312, 139, 93, 17)
$txtTriggerScanSize = GUICtrlCreateInput($SettingTriggerScanSize, 392, 136, 55, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState()
UpdateGUI()
EndFunc ;==>SettingsGUI
Func DrawDebugGUI()
$DebugGUI = GUICreate("", 1920, 1080, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TRANSPARENT)))
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($DebugGUI, 0xABCDEF, 0xA0)
GUISetState()
Local $QuadOne[4] = [$SearchAreaQuads[0][0], $SearchAreaQuads[0][1], $SearchAreaQuads[0][2], $SearchAreaQuads[0][3]]
Local $QuadTwo[4] = [$SearchAreaQuads[1][0], $SearchAreaQuads[1][1], $SearchAreaQuads[1][2], $SearchAreaQuads[1][3]]
Local $QuadThree[4] = [$SearchAreaQuads[2][0], $SearchAreaQuads[2][1], $SearchAreaQuads[2][2], $SearchAreaQuads[2][3]]
Local $QuadFour[4] = [$SearchAreaQuads[3][0], $SearchAreaQuads[3][1], $SearchAreaQuads[3][2], $SearchAreaQuads[3][3]]
DrawSearchAreaGUI($DebugGUI, $QuadOne, 0x66FF33)
DrawSearchAreaGUI($DebugGUI, $QuadTwo, 0x66FF33)
DrawSearchAreaGUI($DebugGUI, $QuadThree, 0x66FF33)
DrawSearchAreaGUI($DebugGUI, $QuadFour, 0x66FF33)
DrawSearchAreaGUI($DebugGUI, $SearchAreaPoints, 0xFF0000)
DrawSearchAreaGUI($DebugGUI, $AimShootAreaPoints, 0xFF0000)
If $ShowRadar = 1 Then
$hDC = _WinAPI_GetWindowDC($DebugGUI)
$hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFF69B4)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)
For $dir = 0 To $SettingTriggerRadarSize
_WinAPI_DrawLine($hDC, $MiddleX, $MiddleY, $UnitTable[$dir][0], $UnitTable[$dir][1])
Next
EndIf
EndFunc
Func RemoveDebugGUI()
GUIDelete($DebugGUI)
EndFunc
Func RunBot()
If $SettingAutoRun And WinGetState($WindowHandle) = 15 Then
Local $BeginTime
$BeginTime = TimerInit()
FFSnapShot($SearchAreaPoints[0], $SearchAreaPoints[1], $SearchAreaPoints[2], $SearchAreaPoints[3])
If $SettingAimBot = 1 And $SettingTriggerBot = 1 Then
AimBot()
TriggerBot()
ElseIf $SettingTriggerBot = 1 Then
TriggerBot()
ElseIf $SettingAimBot = 1 Then
AimBot()
EndIf
UpdateAverageTime($BeginTime)
$CurrentCoord = ""
EndIf
EndFunc
Func GetAverageTime()
Local $Time, $TimeSum, $TimeCount = UBound($LoopTimeArray)
For $Time In $LoopTimeArray
$TimeSum = $TimeSum + $Time
Next
Return Round($TimeSum / $TimeCount)
EndFunc ;==>GetAverageTime
Func TriggerBot()
If _IsPressed("01") Then Return
If $SettingTriggerAimKey = "" Then
ActionTrigger()
ElseIf _IsPressed($SettingTriggerAimKey) Then
ActionTrigger()
EndIf
EndFunc ;==>TriggerBot
Func AimBot()
If $SettingAimKey = "" Then
ActionAim()
ElseIf _IsPressed($SettingAimKey) Then
ActionAim()
EndIf
EndFunc ;==>AimBot
Func ActionTrigger()
Local $TriggerPixelSearch = TriggerPixelSearch()
If $TriggerPixelSearch > $SettingHitChance Then
ActionShoot()
EndIf
EndFunc ;==>ActionTrigger
Func ActionAim()
If $CurrentCoord = "" Then $CurrentCoord = SearchPixel()
If IsArray($CurrentCoord) = 0 Then Return False
If ActionMoveMouse($CurrentCoord) Then
If $SettingAutoShoot And IsWithinBounds($CurrentCoord, $AimShootAreaPoints) Then ActionShoot()
EndIf
EndFunc ;==>ActionAim
Func ActionShoot()
_MouseClickFast2("left")
EndFunc ;==>ActionShoot
Func ActionMoveMouse($Coord)
Local $MoveToX = ($Coord[0] - $MiddleX)
Local $MoveToY = ($Coord[1] - $MiddleY)
If $MoveToX Then
If Abs($MoveToX) < $SettingAimBotStepSize Then
$Moving = $MoveToX
Else
$Moving = $SettingAimBotStepSize * $X_Ratio
If ($MoveToX) < 0 Then $Moving *= -1
EndIf
_MouseMovePlus($Moving, 0)
EndIf
If $MoveToY Then
If Abs($MoveToY) < $SettingAimBotStepSize Then
$Moving = $MoveToY
Else
$Moving = $SettingAimBotStepSize * $Y_Ratio
If ($MoveToY) < 0 Then $Moving *= -1
EndIf
_MouseMovePlus(0, $Moving)
EndIf
Return True
EndFunc ;==>ActionMoveMouse
Func IsWithinBounds($Coord, $AreaPoints)
Local $IsWithinBounds = $Coord[0] >= $AreaPoints[0] And $Coord[0] <= $AreaPoints[2] And $Coord[1] >= $AreaPoints[1] And $Coord[1] <= $AreaPoints[3]
Return $IsWithinBounds
EndFunc ;==>IsWithinBounds
Func _MouseMovePlus($x, $y)
DllCall("user32.dll", "none", "mouse_event", "long", 1, "long", $x, "long", $y, "long", 0, "long", 0)
EndFunc ;==>_MouseMovePlus
Func _MouseClickFast2($x = 0, $y = 0, $User32 = "User32.dll")
DllCall($User32, "none", "mouse_event", "long", 2, "long", $x, "long", $y, "long", 0, "long", 0) ; 32770 0x8002 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTDOWN)
DllCall($User32, "none", "mouse_event", "long", 4, "long", $x, "long", $y, "long", 0, "long", 0) ; 32772 0x8004 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTUP)
EndFunc ;==>_MouseClickFast2
Func SearchPixel()
Local $FoundPoints[4]
$FoundPoints[0] = FFBestSpot($SearchAreaQuads[0][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[0][4], $SearchAreaQuads[0][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[0][0], $SearchAreaQuads[0][1], $SearchAreaQuads[0][2], $SearchAreaQuads[0][3]) ;top left
$FoundPoints[1] = FFBestSpot($SearchAreaQuads[1][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[1][4], $SearchAreaQuads[1][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[1][0], $SearchAreaQuads[1][1], $SearchAreaQuads[1][2], $SearchAreaQuads[1][3]) ;bottom right
$FoundPoints[2] = FFBestSpot($SearchAreaQuads[2][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[2][4], $SearchAreaQuads[2][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[2][0], $SearchAreaQuads[2][1], $SearchAreaQuads[2][2], $SearchAreaQuads[2][3]) ;bottom left
$FoundPoints[3] = FFBestSpot($SearchAreaQuads[3][6], $SettingMinPureColors, $SettingMaxShades, $SearchAreaQuads[3][4], $SearchAreaQuads[3][5], -1, $SettingShadeVariation, False, $SearchAreaQuads[3][0], $SearchAreaQuads[3][1], $SearchAreaQuads[3][2], $SearchAreaQuads[3][3]) ; top right
Local $midX = 0
Local $midY = 0
Local $Count = 0
For $Point In $FoundPoints
If IsArray($Point) = 1 Then
$Count += 1
$midX += $Point[0]
$midY += $Point[1]
EndIf
Next
If $midX = 0 Or $midY = 0 Then Return
$midX = Round($midX / $Count)
$midY = Round($midY / $Count - 4)
Local $midCoords[2] = [$midX, $midY]
Return $midCoords
EndFunc ;==>SearchPixel
Func TriggerPixelSearch()
Local $OpenCount = 0
Local $ClosedCount = 0
Local $AvgDistance = 0
Local $pct = 0
For $dir = 0 To $SettingTriggerRadarSize
$result = lineTest($MiddleX, $MiddleY, $UnitTable[$dir][0], $UnitTable[$dir][1])
If IsArray($result) = 0 Then
$OpenCount += 1
Else
If Sqrt(($MiddleX-$result[0])^2+($MiddleY-$result[1])^2) > 7 Then $ClosedCount += 1
EndIf
Next
If $ClosedCount > 0 Then
$pct = $ClosedCount / $SettingTriggerRadarSize
EndIf
UpdateGUIHitChance(Round($pct*100,2))
Return $pct
EndFunc
Func lineTest($x1,$y1,$x2,$y2)
;Define differences and error check
$dx = Abs($x2 - $x1)
$dy = Abs($y2 - $y1)
$sx = ($x1 < $x2) ? 1 : -1
$sy = ($y1 < $y2) ? 1 : -1
$err = $dx - $dy
;Main loop
While (Not ($x1 = $x2 And $y1 = $y2))
$result = IsCorrectShade($x1,$y1)
If IsArray($result) = 1 Then
Return $result
EndIf
$e2 = BitShift($err, -1)
If $e2 > -$dy Then
$err -= $dy
$x1 += $sx
EndIf
If $e2 < $dx Then
$err += $dx
$y1 += $sy
EndIf
WEnd
EndFunc
Func IsCorrectShade($x0, $y0)
$color = _ColorGetRGB(FFGetPixel($x0,$y0))
If IsArray($color) = 1 Then
$r = $color[0]
$g = $color[1]
$b = $color[2]
If $r >= $SettingMinR And $r <= $SettingMaxR Then
If $g >= $SettingMinG And $g <= $SettingMaxG Then
If $b >= $SettingMinB And $b <= $SettingMaxB Then
Local $Result[2]
$Result[0] = $x0
$Result[1] = $y0
Return $Result
EndIf
EndIf
EndIf
EndIf
Return 0
EndFunc
Func DrawSearchAreaGUI($GUI, $Points, $Color, $comment = "")
Local $DrawAreaWidth = $Points[2] - $Points[0]
Local $DrawAreaHeight = $Points[3] - $Points[1]
$hDC = _WinAPI_GetWindowDC($GUI)
$hPen = _WinAPI_CreatePen($PS_SOLID, 2, $Color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)
_WinAPI_DrawLine($hDC, $Points[0], $Points[1], $Points[0] + $DrawAreaWidth, $Points[1])
_WinAPI_DrawLine($hDC, $Points[0], $Points[1], $Points[0], $Points[1] + $DrawAreaHeight)
_WinAPI_DrawLine($hDC, $Points[0], $Points[1] + $DrawAreaHeight, $Points[0] + $DrawAreaWidth, $Points[1] + $DrawAreaHeight)
_WinAPI_DrawLine($hDC, $Points[0] + $DrawAreaWidth, $Points[1] + $DrawAreaHeight, $Points[0] + $DrawAreaWidth, $Points[1])
_WinAPI_SetTextColor($hDC, 0x000000)
_WinAPI_SetBkMode($hDC, $TRANSPARENT)
$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", $Points[0])
DllStructSetData($tRECT, "Top", $Points[1])
DllStructSetData($tRECT, "Right", $Points[0]+50)
DllStructSetData($tRECT, "Bottom", $Points[1]+50)
_WinAPI_DrawText($hDC, $comment, $tRECT, 1)
WinSetOnTop($GUI, "", 1)
EndFunc ;==>DrawSearchAreaGUI
;hotkey functions
Func Pause()
$SettingAutoRun = Not $SettingAutoRun
UpdateGUIStatus()
EndFunc ;==>Pause
;0 = Triggerbot and aimbot ON,1 = Triggerbot ON,2 = Aimbot ON
Func SwitchAimMode()
If $SettingAimMode = 2 Then
$SettingAimMode = 0
Else
$SettingAimMode = $SettingAimMode + 1
EndIf
If $SettingAimMode = 0 Then
$SettingTriggerBot = 1
$SettingAimBot = 1
ElseIf $SettingAimMode = 1 Then
$SettingTriggerBot = 1
$SettingAimBot = 0
ElseIf $SettingAimMode = 2 Then
$SettingTriggerBot = 0
$SettingAimBot = 1
EndIf
UpdateGUIAimMode()
EndFunc ;==>SwitchAimMode
Func Stop()
Exit
EndFunc ;==>Stop
Func UpdateGUIStatus($Time = "0ms")
If $SettingAutoRun = 1 Then
GUICtrlSetData($lblStatus, "Average Loop Time: " & $Time)
Else
GUICtrlSetData($lblStatus, "Average Loop Time: Paused")
EndIf
EndFunc ;==>UpdateGUIStatus
Func UpdateAverageTime($BeginTime)
Local $EndTime = TimerDiff($BeginTime)
_ArrayAdd($LoopTimeArray, Round($EndTime))
If UBound($LoopTimeArray) >= 25 Then
Local $AverageTime = GetAverageTime()
UpdateGUIStatus($AverageTime & "ms")
ReDim $LoopTimeArray[0]
_ArrayAdd($LoopTimeArray, $AverageTime)
EndIf
EndFunc ;==>UpdateAverageTime
Func UpdateGUIHitChance($pct)
GUICtrlSetData($lblHitChance, "HitChance: " & $pct & " %")
EndFunc ;==>UpdateGUIPixel
Func UpdateGUIAimMode()
GUICtrlSetData($lblfrmTriggerBot, "Trigger Bot: " & GetTriggerBotState())
GUICtrlSetData($lblfrmAimBot, "Aim Bot: " & GetAimBotState())
EndFunc ;==>UpdateGUIAimMode
Func GetAimBotState()
If $SettingAimBot = 0 Then Return "OFF"
If $SettingAimKey = "" Then
Return "Auto"
Else
Return GetFriendlyKeyName($SettingAimKey)
EndIf
EndFunc ;==>GetAimBotState
Func GetTriggerBotState()
If $SettingTriggerBot = 0 Then Return "OFF"
If $SettingTriggerAimKey = "" Then
Return "Auto"
Else
Return GetFriendlyKeyName($SettingTriggerAimKey)
EndIf
EndFunc ;==>GetTriggerBotState
;GUI Title Bar
Func GetTitle()
Local $Title = ""
For $i = 0 To Random(0, 7, 1)
$Title &= Chr(Random(97, 122, 1))
Next
For $i = 0 To Random(5, 10, 1)
$Title &= Chr(Random(65, 90, 1))
Next
Return $Title
EndFunc ;==>GetTitle
Func UpdateGUI()
;Game Handle Name
GUIUpdate($txtWindowClass, $SettingWindowClass)
;Bot Settings
GUISetCheck($cbAutoRun, $SettingAutoRun)
;Triggerbot
GUISetCheck($cbTriggerBot, $SettingTriggerBot)
GUIUpdate($txtTriggerScanSize, $SettingTriggerScanSize)
GUIUpdate($txtTriggerAimKey, $SettingTriggerAimKey)
;Aimbot
GUISetCheck($cbAimBot, $SettingAimBot)
GUIUpdate($txtAimShootAreaSize, $SettingAimShootAreaSize)
GUIUpdate($txtAimBotStepSize, $SettingAimBotStepSize)
GUIUpdate($txtAimKey, $SettingAimKey)
;Pixel Search settings
GUIUpdate($txtSearchAreaSize, $SettingSearchAreaSize)
GUIUpdate($txtShadeVariation, $SettingShadeVariation)
GUIUpdate($txtMinPureColors, $SettingMinPureColors)
GUIUpdate($txtMaxShades, $SettingMaxShades)
EndFunc ;==>UpdateGUI
Func SaveColors()
Local $string = GUICtrlRead($editSearchColors)
If $string = "" Then Return
local $temp = StringReplace($string, @CRLF, " ")
$temp = StringStripWS($temp, 7)
Local $SearchColors = StringSplit($temp, " ")
For $ColorIndex = 1 To $SearchColors[0]
IniWrite($SettingsPath, "Pixel Settings", "Color" & $ColorIndex, $SearchColors[$ColorIndex])
Next
EndFunc ;==>SaveColors
Func GetColors()
Local $string = ""
Local $SearchColors = IniReadSection($SettingsPath, "Pixel Settings")
If @error Then Return
Local $TotalColors = $SearchColors[0][0]
If $TotalColors > 0 Then
ReDim $SettingSearchColors[$TotalColors]
EndIf
For $ColorIndex = 1 To $TotalColors
$SettingSearchColors[$ColorIndex - 1] = $SearchColors[$ColorIndex][1]
$string &= $SettingSearchColors[$ColorIndex - 1] & @CRLF
Next
If Not $string = "" Then GUICtrlSetData($editSearchColors, $string)
EndFunc ;==>GetColors
Func SearchColorsToString($SearchColors)
Local $string = ""
For $Color In $SearchColors
$string &= $Color & @CRLF
Next
Return $string
EndFunc ;==>SearchColorsToString
Func GUISetCheck($Control, $Flag)
If $Flag = 0 Then
GUICtrlSetState($Control, $GUI_UNCHECKED)
ElseIf $Flag = 1 Then
GUICtrlSetState($Control, $GUI_CHECKED)
EndIf
EndFunc ;==>GUISetCheck
Func ConvertFlag($Control)
If GUICtrlRead($Control) = 4 Or GUICtrlRead($Control) = 68 Then
Return 0
Else
Return 1
EndIf
EndFunc ;==>ConvertFlag
Func IsChecked($Control)
Return BitAND(GUICtrlRead($Control), $GUI_CHECKED) = $GUI_CHECKED
EndFunc ;==>IsChecked
Func GUIUpdate($Control, $Value)
GUICtrlSetData($Control, $Value)
EndFunc ;==>GUIUpdate
Func ReadINI()
;SHOW GUI SETTING
$SettingDrawDebug = IniRead($SettingsPath, "BotSettings", "DrawDebug", $SettingDrawDebug)
;Game Handle Name
$SettingWindowClass = IniRead($SettingsPath, "BotSettings", "WindowClass", $SettingWindowClass)
;Bot Settings
$SettingRunning = IniRead($SettingsPath, "BotSettings", "AutoRun", $SettingAutoRun)
$SettingAutoUpdate = IniRead($SettingsPath, "BotSettings", "AutoUpdate", $SettingAutoUpdate)
;AIMBOT $ TRIGGERBOT SETTINGS
$SettingAimMode = IniRead($SettingsPath, "BotSettings", "AimMode", $SettingAimMode)
;Triggerbot
$SettingTriggerScanSize = IniRead($SettingsPath, "TriggerbotSettings", "ScanSize", $SettingTriggerScanSize)
$SettingTriggerBot = IniRead($SettingsPath, "TriggerSettings", "Enabled", $SettingTriggerBot)
$SettingTriggerAimKey = IniRead($SettingsPath, "TriggerSettings", "Key", $SettingTriggerAimKey)
;Aimbot
$SettingAimShootAreaSize = IniRead($SettingsPath, "AimbotSettings", "ShootAreaSize", $SettingAimShootAreaSize)
$SettingAimBot = IniRead($SettingsPath, "AimbotSettings", "Enabled", $SettingAimBot)
$SettingAimKey = IniRead($SettingsPath, "AimbotSettings", "Key", $SettingAimKey)
$SettingAutoShoot = IniRead($SettingsPath, "AimbotSettings", "Shoot", $SettingAutoShoot)
$SettingAimBotStepSize = IniRead($SettingsPath, "AimbotSettings", "StepSize", $SettingAimBotStepSize)
;Pixel Search settings
$SettingSearchAreaSize = IniRead($SettingsPath, "PixelSettings", "SearchAreaSize", $SettingSearchAreaSize)
$SettingShadeVariation = IniRead($SettingsPath, "PixelSettings", "ShadeVariation ", $SettingShadeVariation)
$SettingMinPureColors = IniRead($SettingsPath, "PixelSettings", "MinPureColors", $SettingMinPureColors)
$SettingMaxShades = IniRead($SettingsPath, "PixelSettings", "MaxShades", $SettingMaxShades)
GetColors()
EndFunc ;==>ReadINI
Func SaveINI()
FileDelete($SettingsPath)
;Game Handle Name
IniWrite($SettingsPath, "BotSettings", "WindowClass", GUICtrlRead($txtWindowClass))
;Bot Settings
IniWrite($SettingsPath, "BotSettings", "AutoRun", ConvertFlag($cbAutoRun))
IniWrite($SettingsPath, "BotSettings", "AutoUpdate", ConvertFlag($mAutoUpdate))
IniWrite($SettingsPath, "BotSettings", "DrawDebug", ConvertFlag($mDrawDebug))
;Triggerbot
IniWrite($SettingsPath, "TriggerbotSettings", "ScanSize", GUICtrlRead($txtTriggerScanSize))
IniWrite($SettingsPath, "TriggerSettings", "Enabled", ConvertFlag($cbTriggerBot))
IniWrite($SettingsPath, "TriggerSettings", "Key", GUICtrlRead($txtTriggerAimKey))
;Aimbot
IniWrite($SettingsPath, "AimbotSettings", "ShootAreaSize", GUICtrlRead($txtAimShootAreaSize))
IniWrite($SettingsPath, "AimbotSettings", "Enabled", ConvertFlag($cbAimBot))
IniWrite($SettingsPath, "AimbotSettings", "Key", GUICtrlRead($txtAimKey))
IniWrite($SettingsPath, "AimbotSettings", "StepSize", GUICtrlRead($txtAimBotStepSize))
;Pixel Search settings
IniWrite($SettingsPath, "PixelSettings", "SearchAreaSize", GUICtrlRead($txtSearchAreaSize))
IniWrite($SettingsPath, "PixelSettings", "ShadeVariation ", GUICtrlRead($txtShadeVariation))
IniWrite($SettingsPath, "PixelSettings", "MinPureColors", GUICtrlRead($txtMinPureColors))
IniWrite($SettingsPath, "PixelSettings", "MaxShades", GUICtrlRead($txtMaxShades))
SaveColors()
Call("ReadINI")
EndFunc ;==>SaveINI
Func GetFriendlyKeyName($Key)
If $Key = "01" Then Return "Left mouse button"
If $Key = "02" Then Return "Right mouse button"
If $Key = "03" Then Return "Control-break processing"
If $Key = "04" Then Return "Middle mouse button (three-button mouse)"
If $Key = "05" Then Return "X1 mouse button"
If $Key = "06" Then Return "X2 mouse button"
If $Key = "08" Then Return "BACKSPACE key"
If $Key = "09" Then Return "TAB key"
If $Key = "0C" Then Return "CLEAR key"
If $Key = "0D" Then Return "ENTER key"
If $Key = "10" Then Return "SHIFT key"
If $Key = "11" Then Return "CTRL key"
If $Key = "12" Then Return "ALT key"
If $Key = "13" Then Return "PAUSE key"
If $Key = "14" Then Return "CAPS LOCK key"
If $Key = "1B" Then Return "ESC key"
If $Key = "20" Then Return "SPACEBAR"
If $Key = "21" Then Return "PAGE UP key"
If $Key = "22" Then Return "PAGE DOWN key"
If $Key = "23" Then Return "END key"
If $Key = "24" Then Return "HOME key"
If $Key = "25" Then Return "LEFT ARROW key"
If $Key = "26" Then Return "UP ARROW key"
If $Key = "27" Then Return "RIGHT ARROW key"
If $Key = "28" Then Return "DOWN ARROW key"
If $Key = "29" Then Return "SELECT key"
If $Key = "2A" Then Return "PRINT key"
If $Key = "2B" Then Return "EXECUTE key"
If $Key = "2C" Then Return "PRINT SCREEN key"
If $Key = "2D" Then Return "INS key"
If $Key = "2E" Then Return "DEL key"
If $Key = "30" Then Return "0 key"
If $Key = "31" Then Return "1 key"
If $Key = "32" Then Return "2 key"
If $Key = "33" Then Return "3 key"
If $Key = "34" Then Return "4 key"
If $Key = "35" Then Return "5 key"
If $Key = "36" Then Return "6 key"
If $Key = "37" Then Return "7 key"
If $Key = "38" Then Return "8 key"
If $Key = "39" Then Return "9 key"
If $Key = "41" Then Return "A key"
If $Key = "42" Then Return "B key"
If $Key = "43" Then Return "C key"
If $Key = "44" Then Return "D key"
If $Key = "45" Then Return "E key"
If $Key = "46" Then Return "F key"
If $Key = "47" Then Return "G key"
If $Key = "48" Then Return "H key"
If $Key = "49" Then Return "I key"
If $Key = "4A" Then Return "J key"
If $Key = "4B" Then Return "K key"
If $Key = "4C" Then Return "L key"
If $Key = "4D" Then Return "M key"
If $Key = "4E" Then Return "N key"
If $Key = "4F" Then Return "O key"
If $Key = "50" Then Return "P key"
If $Key = "51" Then Return "Q key"
If $Key = "52" Then Return "R key"
If $Key = "53" Then Return "S key"
If $Key = "54" Then Return "T key"
If $Key = "55" Then Return "U key"
If $Key = "56" Then Return "V key"
If $Key = "57" Then Return "W key"
If $Key = "58" Then Return "X key"
If $Key = "59" Then Return "Y key"
If $Key = "5A" Then Return "Z key"
If $Key = "5B" Then Return "Left Windows key"
If $Key = "5C" Then Return "Right Windows key"
If $Key = "60" Then Return "Numeric keypad 0 key"
If $Key = "61" Then Return "Numeric keypad 1 key"
If $Key = "62" Then Return "Numeric keypad 2 key"
If $Key = "63" Then Return "Numeric keypad 3 key"
If $Key = "64" Then Return "Numeric keypad 4 key"
If $Key = "65" Then Return "Numeric keypad 5 key"
If $Key = "66" Then Return "Numeric keypad 6 key"
If $Key = "67" Then Return "Numeric keypad 7 key"
If $Key = "68" Then Return "Numeric keypad 8 key"
If $Key = "69" Then Return "Numeric keypad 9 key"
If $Key = "6A" Then Return "Multiply key"
If $Key = "6B" Then Return "Add key"
If $Key = "6C" Then Return "Separator key"
If $Key = "6D" Then Return "Subtract key"
If $Key = "6E" Then Return "Decimal key"
If $Key = "6F" Then Return "Divide key"
If $Key = "70" Then Return "F1 key"
If $Key = "71" Then Return "F2 key"
If $Key = "72" Then Return "F3 key"
If $Key = "73" Then Return "F4 key"
If $Key = "74" Then Return "F5 key"
If $Key = "75" Then Return "F6 key"
If $Key = "76" Then Return "F7 key"
If $Key = "77" Then Return "F8 key"
If $Key = "78" Then Return "F9 key"
If $Key = "79" Then Return "F10 key"
If $Key = "7A" Then Return "F11 key"
If $Key = "7B" Then Return "F12 key"
If $Key = "90" Then Return "NUM LOCK key"
If $Key = "91" Then Return "SCROLL LOCK key"
If $Key = "A0" Then Return "Left SHIFT key"
If $Key = "A1" Then Return "Right SHIFT key"
If $Key = "A2" Then Return "Left CONTROL key"
If $Key = "A3" Then Return "Right CONTROL key"
If $Key = "A4" Then Return "Left MENU key"
If $Key = "A5" Then Return "Right MENU key"
If $Key = "BA" Then Return ";"
If $Key = "BB" Then Return "="
If $Key = "BC" Then Return ","
If $Key = "BD" Then Return "-"
If $Key = "BE" Then Return "."
If $Key = "BF" Then Return "/"
If $Key = "C0" Then Return "`"
If $Key = "DB" Then Return "["
If $Key = "DC" Then Return "\"
If $Key = "DD" Then Return "]"
EndFunc ;==>GetFriendlyKeyName
Func RefreshSettings()
FFResetColors()
RemoveDebugGUI()
ReadINI()
;Game Handle
$WindowHandle = WinGetHandle($SettingWindowClass)
;Game window size shit
$Size = WinGetClientSize($WindowHandle)
If $Size = 0 Then
MsgBox(16, "Error", "Game is not running, cannot grab resolution!" & @CRLF & "Exiting...")
Exit
EndIf
$X_Ratio = $size[0] / 1920
$Y_Ratio = $size[1] / 1080
$MiddleX = $size[0] / 2
$MiddleY = $size[1] / 2
$SearchAreaSizeX = $SettingSearchAreaSize * $X_Ratio
$AimShootAreaSizeX = $SettingAimShootAreaSize * $X_Ratio
$SearchAreaSizeY = $SettingSearchAreaSize * $Y_Ratio
$AimShootAreaSizeY = $SettingAimShootAreaSize * $Y_Ratio
;Search Area
$SearchAreaPoints[0] = Round($MiddleX - $SearchAreaSizeX)
$SearchAreaPoints[1] = Round($MiddleY - $SearchAreaSizeY)
$SearchAreaPoints[2] = Round($MiddleX + $SearchAreaSizeX)
$SearchAreaPoints[3] = Round($MiddleY + $SearchAreaSizeY)
$SearchAreaQuads[0][0] = $SearchAreaPoints[0]
$SearchAreaQuads[0][1] = $SearchAreaPoints[1]
$SearchAreaQuads[0][2] = $SearchAreaPoints[0] + $SearchAreaSizeX
$SearchAreaQuads[0][3] = $SearchAreaPoints[1] + $SearchAreaSizeY
$SearchAreaQuads[0][4] = ($SearchAreaQuads[0][0] + $SearchAreaQuads[0][2]) / 2
$SearchAreaQuads[0][5] = ($SearchAreaQuads[0][1] + $SearchAreaQuads[0][3]) / 2
$SearchAreaQuads[0][6] = $SearchAreaQuads[0][2] - $SearchAreaQuads[0][0]
$SearchAreaQuads[1][0] = $SearchAreaPoints[0] + $SearchAreaSizeX
$SearchAreaQuads[1][1] = $SearchAreaPoints[1]
$SearchAreaQuads[1][2] = $SearchAreaPoints[0] + $SearchAreaSizeX * 2
$SearchAreaQuads[1][3] = $SearchAreaPoints[1] + $SearchAreaSizeY
$SearchAreaQuads[1][4] = ($SearchAreaQuads[1][0] + $SearchAreaQuads[1][2]) / 2
$SearchAreaQuads[1][5] = ($SearchAreaQuads[1][1] + $SearchAreaQuads[1][3]) / 2
$SearchAreaQuads[1][6] = $SearchAreaQuads[1][2] - $SearchAreaQuads[1][0]
$SearchAreaQuads[2][0] = $SearchAreaPoints[0]
$SearchAreaQuads[2][1] = $SearchAreaPoints[1] + $SearchAreaSizeY
$SearchAreaQuads[2][2] = $SearchAreaPoints[0] + $SearchAreaSizeX
$SearchAreaQuads[2][3] = $SearchAreaPoints[1] + $SearchAreaSizeY * 2
$SearchAreaQuads[2][4] = ($SearchAreaQuads[2][0] + $SearchAreaQuads[2][2]) / 2
$SearchAreaQuads[2][5] = ($SearchAreaQuads[2][1] + $SearchAreaQuads[2][3]) / 2
$SearchAreaQuads[2][6] = $SearchAreaQuads[2][2] - $SearchAreaQuads[2][0]
$SearchAreaQuads[3][0] = $SearchAreaPoints[0] + $SearchAreaSizeX
$SearchAreaQuads[3][1] = $SearchAreaPoints[1] + $SearchAreaSizeY
$SearchAreaQuads[3][2] = $SearchAreaPoints[0] + $SearchAreaSizeX * 2
$SearchAreaQuads[3][3] = $SearchAreaPoints[1] + $SearchAreaSizeY * 2
$SearchAreaQuads[3][4] = ($SearchAreaQuads[3][0] + $SearchAreaQuads[3][2]) / 2
$SearchAreaQuads[3][5] = ($SearchAreaQuads[3][1] + $SearchAreaQuads[3][3]) / 2
$SearchAreaQuads[3][6] = $SearchAreaQuads[3][2] - $SearchAreaQuads[3][0]
;Aimbot Area
$AimShootAreaPoints[0] = Round($MiddleX - $AimShootAreaSizeX)
$AimShootAreaPoints[1] = Round($MiddleY - $AimShootAreaSizeY)
$AimShootAreaPoints[2] = Round($MiddleX + $AimShootAreaSizeX)
$AimShootAreaPoints[3] = Round($MiddleY + $AimShootAreaSizeY)
Local $UnitTable1[$SettingTriggerRadarSize + 1][4]
Local $PI = 3.141592653589793
Local $Rad = $PI / 180
Local $Offset = 0
Local $Increment = 360 / $SettingTriggerRadarSize
For $a = 0 To $SettingTriggerRadarSize
$Angle = $Rad * $Offset;
$UnitTable1[$a][0] = Round($MiddleX + Cos($Angle) * $SettingTriggerScanSize);
$UnitTable1[$a][1] = Round($MiddleY + Sin($Angle) * $SettingTriggerScanSize);
$UnitTable1[$a][2] = $Offset
$UnitTable1[$a][3] = $Angle;
$Offset = $Offset + $Increment
Next
$UnitTable = $UnitTable1
$SettingAutoShoot = $SettingAutoShoot And Not $SettingAimKey = "01"
If $SettingDrawDebug = 1 Then
DrawDebugGUI()
EndIf
For $Color In $SettingSearchColors
$color = _ColorGetRGB($Color)
If IsArray($color) = 1 Then
$r = $color[0]
$g = $color[1]
$b = $color[2]
;ConsoleWrite($r & "," & $g & "," & $b & @CRLF)
If $r >= $SettingMaxR Then $SettingMaxR = $r
If $g >= $SettingMaxG Then $SettingMaxG = $g
If $b >= $SettingMaxB Then $SettingMaxB = $b
;
If $r <= $SettingMinR Then $SettingMinR = $r
If $g <= $SettingMinG Then $SettingMinG = $g
If $b <= $SettingMinB Then $SettingMinB = $b
EndIf
Next
FFSetDebugMode(0)
FFSetWnd($WindowHandle)
FFAddColor($SettingSearchColors)
EndFunc
Func DoUpdate()
$ini = InetGet($VersionsInfo, @ScriptDir & "\version.ini") ;download version.ini
If $ini = 0 Then ;was the download of version.ini successful?
MsgBox(16, "Fatal Error", "The server seems to be offline. No update will be done.")
Else
$NewVersion = IniRead(@ScriptDir & "\version.ini", "Version", "Version", "") ;reads the new version out of version.ini
If $NewVersion = $OldVersion Then ;compare old and new
MsgBox(0, "No update", "There is no update available!")
FileDelete(@ScriptDir & "\version.ini")
Else
$msg = MsgBox(68, "Update", "A new version is available: " & $NewVersion & "! Current version: " & $OldVersion & @CRLF & "Do you want to download the new version?")
If $msg = 7 Then ;No was pressed
FileDelete(@ScriptDir & "\version.ini")
ElseIf $msg = 6 Then ;OK was pressed
$downloadLink = IniRead(@ScriptDir & "\version.ini", "Version", "download", "NotFound")
$dlhandle = InetGet($downloadLink, @ScriptDir & "\Update_" & $NewVersion & ".zip", 1, 1)
ProgressOn("Update", "Downloading Updates", "", -1, -1, 16) ;creates a progressbar
$size = InetGetSize($downloadLink, 1) ;get the size of the update
While Not InetGetInfo($dlhandle, 2)
$Percent = Round((InetGetInfo($dlhandle, 0) / $size) * 100)
ProgressSet($Percent, $Percent & "%") ;update progressbar
Sleep(1)
WEnd
ProgressSet(100, "Done", "Complete") ;show complete progressbar
Sleep(500)
ProgressOff() ;close progress window
IniWrite("updater.ini", "version", "version", $newVersion)
InetClose($dlhandle)
$iniMsg = IniRead(@ScriptDir & "\version.ini", "Version", "message", "Exiting...")
MsgBox(64, "Success", "Download Complete!" & @CRLF & "Please restart the bot by extracting the Au3 from Update_" & $NewVersion & ".zip" & @CRLF & $iniMsg)
FileDelete(@ScriptDir & "\version.ini")
Exit
EndIf
EndIf
EndIf
WinSetTitle($GUITitle, "", $GUITitle & $Version & " - Waiting")
EndFunc ;==>DoUpdate
Code:
#include <GUIConstants.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <Array.au3>
Opt("MouseClickDelay", 0)
Opt('MouseCoordMode', 2)
Opt('PixelCoordMode', 2)
Opt("MouseClickDownDelay", 0)
;MODIFY TO YOUR LIKINGS!!
Global $SettingShootBoundWidth = 45
Global $SettingShootBoundHeight = 150
Global $SettingSearchAreaWidth = 25
Global $SettingSearchAreaHeight = 125
Global $SettingAimMode = False ;False = triggerbot, True = aimbot
Global $SettingsGUI = False ;Show GUI?
Global $SettingHoldClick = False ;Rapid fire = true, Single fire = false
Global $SettingAimBotStepSize = 10 ;Lower the value = slower aimbot, higher equal faster aimbot
;MODIFY TO YOUR LIKINGS!!
;HotKeys
HotKeySet("{HOME}", "Stop")
HotKeySet("{END}", "Pause")
HotKeySet("{INS}", "HoldClickOn")
HotKeySet("{DELETE}", "SwitchAimMode")
;Game Handle
Global $WindowClass = "[CLASS:TankWindowClass]"
Global $WindowHandle = WinGetHandle($WindowClass)
;Settings
Global $SettingTriggerBot = True
Global $SettingRunning = True
Global $SettingShooting = False
Global $IsUserShooting = False
;Pixel Search settings
$SettingSearchAreaSize = 100
Global $SettingSearchColors[13] = [0xF2361B, 0xEF3519, 0xEE4131, 0xED4233, 0xEE4031, 0xCF8790, 0xCF878F, 0xD92411, 0xDC2613, 0xA24D53, 0xA84547, 0xB25C62, 0xAB545B] ;Color to search for, hex!
$SettingShadeVariation = 10
$SettingMinPureColors = 13
$SettingMaxShades = 25
$SettingMaxR = 242
$SettingMaxG = 135
$SettingMaxB = 144
$SettingMinR = 162
$SettingMinG = 36
$SettingMinB = 17
;Game window size
Global $size = WinGetClientSize($WindowHandle)
If $size = 0 Then
MsgBox(16, "Error", "Game is not running, cannot grab resolution!" & @CRLF & "Exiting...")
Exit
EndIf
Global $x_ratio = $size[0] / 1920
Global $y_ratio = $size[1] / 1080
Global $middleX = $size[0]/2
Global $middleY = $size[1]/2
;Search Area
Global $SearchAreaBoundsX = [$middleX - ($SettingSearchAreaWidth* $x_ratio), $middleX + ($SettingSearchAreaWidth * $x_ratio)]
Global $SearchAreaBoundsY = [$middleY - ($SettingSearchAreaHeight * $y_ratio), $middleY + ($SettingSearchAreaHeight/2 * $y_ratio)]
Global $SearchAreaPoints[4] = [$SearchAreaBoundsX[0],$SearchAreaBoundsY[0],$SearchAreaBoundsX[1],$SearchAreaBoundsY[1]]
;Shoot Area
Global $ShootBoundsX[2] = [$middleX - ($SettingShootBoundWidth * $x_ratio), $middleX + ($SettingShootBoundWidth * $x_ratio)]
Global $ShootBoundsY[2] = [$middleY - ($SettingShootBoundHeight * $y_ratio), $middleY + ($SettingShootBoundHeight/2 * $y_ratio)]
Global $ShootAreaPoints[4] = [$ShootBoundsX[0], $ShootBoundsY[0], $ShootBoundsX[1], $ShootBoundsY[1]]
;Draw GUI
If $SettingsGUI Then
DrawSearchAreaGUI($SearchAreaPoints, 0x66FF33, "Search")
DrawSearchAreaGUI($ShootAreaPoints, 0x0000FF, "Shoot")
$frmBot = GUICreate("Pixel Triggerbot" & "1.0" & " - OFF", 270, 145, 0, 0, -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
$lblPixel = GUICtrlCreateLabel("Pixel Found: 0,0" , 4, 0, 280, 24)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblStatus = GUICtrlCreateLabel("Status: Running", 4, 20, 240, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblMode = GUICtrlCreateLabel("Mode: Single Click", 4, 40, 240, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0x330000)
$lblHelpMsg1 = GUICtrlCreateLabel("Press INSERT to change modes", 4, 60, 240, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0xFF0000)
$lblHelpMsg2 = GUICtrlCreateLabel("Press END to pause", 4, 80, 240, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0xFF0000)
$lblHelpMsg3 = GUICtrlCreateLabel("Press HOME to end", 4, 100, 240, 17)
GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState()
EndIf
;Mainbot
While $SettingRunning
WinActivate($WindowHandle)
If $SettingsGUI Then
If Not $SettingTriggerBot Then
GUICtrlSetData($lblStatus,"Status: Paused")
Else
GUICtrlSetData($lblStatus,"Status: Searching For Pixel")
EndIf
EndIf
TryShoot()
WEnd
Func TryShoot()
While $SettingTriggerBot
If Not IsUserPressing() Then
ShootGun()
StopShooting()
EndIf
WEnd
EndFunc
;Check if gun can shoot and draws a box around the pixel found
Func CanShootGun($coord)
If IsArray($coord) = 1 Then
If $SettingsGUI Then
DrawFoundCoordArea($coord)
GUICtrlSetData($lblPixel,"Pixel Found: " & $coord[0] & "," & $coord[1])
EndIf
If Not $SettingAimMode Then
If $coord[0] >= $ShootBoundsX[0] And $coord[0] <= $ShootBoundsX[1] And $coord[1] >= $ShootBoundsY[0] And $coord[1] <= $ShootBoundsY[1] Then
Return True
Else
Return False
EndIf
Else
MoveMouse($coord[0], $coord[1])
Return True
EndIf
Else
Return False
EndIf
EndFunc
Func IsUserPressing()
Return Not $SettingShooting And _IsPressed("01")
EndFunc
Func StopShooting()
If $SettingShooting And $SettingHoldClick Then
MouseUp("left")
$SettingShooting = False
EndIf
EndFunc
Func MoveMouse($x, $y)
Local $MoveToX = ($x - $middleX)
Local $MoveToY = ($y - $middleY)
If $MoveToX Then
If Abs($MoveToX) < $SettingAimBotStepSize Then
$iMoving = $MoveToX
Else
$iMoving = $SettingAimBotStepSize
If ($MoveToX) < 0 Then $iMoving *= -1
EndIf
_MouseMovePlus($iMoving, 0)
EndIf
If $MoveToY Then
If Abs($MoveToY) < $SettingAimBotStepSize Then
$iMoving = $MoveToY
Else
$iMoving = $SettingAimBotStepSize
If ($MoveToY) < 0 Then $iMoving *= -1
EndIf
_MouseMovePlus(0, $iMoving)
EndIf
EndFunc
Func _MouseMovePlus($x, $y)
DllCall("user32.dll", _
"none", _
"mouse_event", _
"long", 1 , _
"long", $x, _
"long", $y, _
"long", 0, _
"long", 0)
EndFunc
Func _MouseClickFast2($x = 0, $y = 0, $User32 = "User32.dll")
DllCall($User32, "none", "mouse_event", "long", 2, "long", $x, "long", $y, "long", 0, "long", 0) ; 32770 0x8002 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTDOWN)
DllCall($User32, "none", "mouse_event", "long", 4, "long", $x, "long", $y, "long", 0, "long", 0) ; 32772 0x8004 BitOR($MOUSEEVENTF_ABSOLUTE, $MOUSEEVENTF_LEFTUP)
EndFunc
Func ShootGun()
While CanShootGun(SearchPixel())
If $SettingHoldClick Then
$SettingShooting = true
MouseDown("left")
Else
_MouseClickFast2("left")
EndIf
WEnd
EndFunc
Func SearchPixel()
Return PixelSearch($SearchAreaPoints[0], $SearchAreaPoints[1],$SearchAreaPoints[2], $SearchAreaPoints[3], $searchColor,15)
EndFunc
Func DrawSearchAreaGUI($Points, $Color, $comment = "")
Local $DrawAreaWidth = $Points[2] - $Points[0]
Local $DrawAreaHeight = $Points[3] - $Points[1]
Local $AreaGUI = GUICreate("", $DrawAreaWidth + 2, $DrawAreaHeight + 2, $Points[0], $Points[1], $WS_POPUP, BitOR($WS_EX_LAYERED, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TRANSPARENT)))
GUISetBkColor(0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($AreaGUI, 0xABCDEF, 0xA0)
WinSetOnTop($AreaGUI, "", 1)
GUISetState()
$hDC = _WinAPI_GetWindowDC($AreaGUI)
$hPen = _WinAPI_CreatePen($PS_SOLID, 2, $Color)
$obj_orig = _WinAPI_SelectObject($hDC, $hPen)
_WinAPI_DrawLine($hDC, 0, 1, $DrawAreaWidth, 0)
_WinAPI_DrawLine($hDC, 1, 0, 0, $DrawAreaHeight)
_WinAPI_DrawLine($hDC, $DrawAreaWidth, $DrawAreaHeight, $DrawAreaWidth, 0)
_WinAPI_DrawLine($hDC, $DrawAreaWidth, $DrawAreaHeight, 0, $DrawAreaHeight)
_WinAPI_SetTextColor($hDC, 0x000000)
_WinAPI_SetBkMode($hDC, $TRANSPARENT)
$tRECT = DllStructCreate($tagRect)
DllStructSetData($tRECT, "Left", 5)
DllStructSetData($tRECT, "Top", 5)
DllStructSetData($tRECT, "Right", 250)
DllStructSetData($tRECT, "Bottom", 50)
_WinAPI_DrawText($hDC, $comment, $tRECT, 0)
EndFunc ;==>DrawArea
Func DrawFoundCoordArea($FoundCoord)
Local $hDC, $hPen, $o_Orig
Local $FoundAreaPoints[4] = [$FoundCoord[0] - 5, $FoundCoord[1] - 5, $FoundCoord[0] + 5, $FoundCoord[1] + 5]
Local $FoundAreaWidth = $FoundAreaPoints[2] - $FoundAreaPoints[0]
Local $FoundAreaHeight = $FoundAreaPoints[3] - $FoundAreaPoints[1]
Local $FoundTopLine[4] = [$FoundAreaPoints[0], $FoundAreaPoints[1], $FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1]]
Local $FoundBottomLine[4] = [$FoundAreaPoints[0], $FoundAreaPoints[1], $FoundAreaPoints[0], $FoundAreaPoints[1] + $FoundAreaHeight]
Local $FoundLeftLine[4] = [$FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1], $FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1] + $FoundAreaHeight]
Local $FoundRightLine[4] = [$FoundAreaPoints[0], $FoundAreaPoints[1] + $FoundAreaHeight, $FoundAreaPoints[0] + $FoundAreaWidth, $FoundAreaPoints[1] + $FoundAreaHeight]
$hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop)
$hPen = _WinAPI_CreatePen($PS_SOLID, 2, 0xFF0000)
$o_Orig = _WinAPI_SelectObject($hDC, $hPen)
_WinAPI_DrawLine($hDC, $FoundTopLine[0], $FoundTopLine[1], $FoundTopLine[2], $FoundTopLine[3])
_WinAPI_DrawLine($hDC, $FoundLeftLine[0], $FoundLeftLine[1], $FoundLeftLine[2], $FoundLeftLine[3])
_WinAPI_DrawLine($hDC, $FoundRightLine[0], $FoundRightLine[1], $FoundRightLine[2], $FoundRightLine[3])
_WinAPI_DrawLine($hDC, $FoundBottomLine[0], $FoundBottomLine[1], $FoundBottomLine[2], $FoundBottomLine[3])
; refresh desktop (clear cross)
_WinAPI_RedrawWindow(_WinAPI_GetDesktopWindow(), 0, 0, $RDW_INVALIDATE + $RDW_ALLCHILDREN)
; clear resources
_WinAPI_SelectObject($hDC, $o_Orig)
_WinAPI_DeleteObject($hPen)
_WinAPI_ReleaseDC(0, $hDC)
EndFunc
;hotkey functions
Func Pause()
$SettingTriggerBot = Not $SettingTriggerBot
EndFunc
Func SwitchAimMode()
$SettingAimMode = Not $SettingAimMode
If $SettingAimMode Then
$SearchColor = 0xFF0000
Else
$SearchColor = 0xEB1D2F
EndIf
EndFunc
Func HoldClickOn()
StopShooting()
$SettingHoldClick = Not $SettingHoldClick
If $SettingHoldClick Then
If $SettingsGUI Then
GUICtrlSetData($lblMode,"Mode: Rapid Fire")
EndIf
Else
If $SettingsGUI Then
GUICtrlSetData($lblMode,"Mode: Single Fire")
EndIf
EndIf
EndFunc
Func Stop()
Exit
EndFunc