Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=AutoAim v5.2.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
;VARIABLES
$dll = DllOpen("user32.dll")
$SquareColor = 0xff3000
$HeadSearchActive = False
$PauseActive = False
$AlertMessage = True
AutoItSetOption("MouseCoordMode", 0)
$MouseMode = False
$InvertCoords = False
$Speed = 20
$XSquare = 100
$YSquare = 100
$Tollerance = 10
$XScreen = 1024
$YScreen = 768
_Main()
Func _Main()
$AutoAim = GUICreate("AutoAim v5.2 by Cranties", 402, 447, 192, 124)
$Tab = GUICtrlCreateTab(8, 16, 385, 400)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$Settings = GUICtrlCreateTabItem("Settings")
$MouseSpeed = GUICtrlCreateSlider(120, 72, 257, 25)
$Label1 = GUICtrlCreateLabel("Mouse Speed", 24, 72, 89, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$XInvertCoords = GUICtrlCreateCheckbox("Invert Coordinate Mode", 24, 120, 169, 17)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$XMouseMode = GUICtrlCreateCheckbox("Absolute/Relative Mode", 24, 144, 169, 17)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$RColor = GUICtrlCreateSlider(120, 192, 257, 25)
GUICtrlSetLimit(-1, 255, 0)
$Label2 = GUICtrlCreateLabel("Red Color", 22, 192, 65, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Label3 = GUICtrlCreateLabel("Green Color", 22, 216, 76, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$GColor = GUICtrlCreateSlider(120, 216, 257, 25)
GUICtrlSetLimit(-1, 255, 0)
$Label4 = GUICtrlCreateLabel("Blue Color", 22, 240, 66, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$BColor = GUICtrlCreateSlider(120, 240, 257, 25)
GUICtrlSetLimit(-1, 255, 0)
$TextCtrl = GUICtrlCreateInput("TextCtrl", 128, 272, 241, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("X Max Search", 22, 328, 86, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$XMax = GUICtrlCreateSlider(118, 328, 257, 25)
GUICtrlSetLimit(-1, 150, 0)
$Label6 = GUICtrlCreateLabel("Y Max Search", 22, 355, 87, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$YMax = GUICtrlCreateSlider(118, 355, 257, 25)
GUICtrlSetLimit(-1, 150, 0)
$Label7 = GUICtrlCreateLabel("Color Toller.", 22, 300, 87, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$XTollerance = GUICtrlCreateSlider(118, 300, 257, 25)
GUICtrlSetLimit(-1, 150, 0)
$Resolution = GUICtrlCreateCombo("1024x768", 128, 384, 153, 25)
GUICtrlSetData(-1, "640x480|800x600|1280x1024|1600x1024|1280x768|1440x900")
$Label7 = GUICtrlCreateLabel("Screen Resol.", 22, 387, 89, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$TabSheet1 = GUICtrlCreateTabItem("Help")
$Help = GUICtrlCreateEdit("", 16, 48, 369, 337)
GUICtrlSetData(-1, "Help")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateTabItem("")
$BtnStart = GUICtrlCreateButton("Start AutoAim", 320, 416, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
;INITIALIZE
$Test = GUICtrlSetData(9, "255")
$Test = GUICtrlSetData(12, "48")
$Test = GUICtrlSetData(14, "00")
$Test = GUICtrlSetData(17, $XSquare)
$Test = GUICtrlSetData(19, $YSquare)
$Test = GUICtrlSetData(21, $Tollerance)
$R = Hex(GUICtrlRead($RColor), 2)
$G = Hex(GUICtrlRead($GColor), 2)
$B = Hex(GUICtrlRead($BColor), 2)
$SquareColor = "0x" & $R & $G & $B
$TColor = "0x" & $R & "0000"
$MeColor = GUICtrlSetBkColor(9, $TColor)
$TColor = "0x00" & $G & "00"
$MeColor = GUICtrlSetBkColor(12, $TColor)
$TColor = "0x0000" & $B
$MeColor = GUICtrlSetBkColor(14, $TColor)
$AqColor = GUICtrlSetBkColor(15, $SquareColor)
$TextCtrl = GUICtrlSetData(15, $SquareColor)
$Test = GUICtrlSetData(5, $Speed)
$Test = GUICtrlSetState(7, $GUI_UNCHECKED)
$Test = GUICtrlSetState(8, $GUI_UNCHECKED)
While 1
$nMsg = GUIGetMsg()
If ProcessExists("BFHeroes.exe") And $AlertMessage = True Then
MsgBox(0, "ATTENTION", "Battlefield Heroes is running... Activate AutoAim !")
$AlertMessage = False
EndIf
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $RColor
$R = Hex(GUICtrlRead($RColor), 2)
$G = Hex(GUICtrlRead($GColor), 2)
$B = Hex(GUICtrlRead($BColor), 2)
$SquareColor = "0x" & $R & $G & $B
$TColor = "0x" & $R & "0000"
$MeColor = GUICtrlSetBkColor(9, $TColor)
$AqColor = GUICtrlSetBkColor(15, $SquareColor)
$TextCtrl = GUICtrlSetData(15, $SquareColor)
Case $GColor
$R = Hex(GUICtrlRead($RColor), 2)
$G = Hex(GUICtrlRead($GColor), 2)
$B = Hex(GUICtrlRead($BColor), 2)
$SquareColor = "0x" & $R & $G & $B
$TColor = "0x00" & $G & "00"
$MeColor = GUICtrlSetBkColor(12, $TColor)
$AqColor = GUICtrlSetBkColor(15, $SquareColor)
$TextCtrl = GUICtrlSetData(15, $SquareColor)
Case $BColor
$R = Hex(GUICtrlRead($RColor), 2)
$G = Hex(GUICtrlRead($GColor), 2)
$B = Hex(GUICtrlRead($BColor), 2)
$SquareColor = "0x" & $R & $G & $B
$TColor = "0x0000" & $B
$MeColor = GUICtrlSetBkColor(14, $TColor)
$AqColor = GUICtrlSetBkColor(15, $SquareColor)
$TextCtrl = GUICtrlSetData(15, $SquareColor)
Case $XMouseMode
$Val = GUICtrlRead($XMouseMode)
If $Val = $GUI_CHECKED Then AutoItSetOption("MouseCoordMode", 1)
If $Val = $GUI_UNCHECKED Then AutoItSetOption("MouseCoordMode", 0)
Case $BtnStart
GUISetState(0)
$HeadSearchActive = True
$Speed = GUICtrlRead($MouseSpeed)
$XSquare = GUICtrlRead($XMax)
$YSquare = GUICtrlRead($YMax)
$Tollerance = GUICtrlRead($XTollerance)
$InvertCoords = GUICtrlRead($XInvertCoords)
$Screen = GUICtrlRead($Resolution)
If $Screen = "640x480" Then
$XScreen = 640
$YScreen = 480
EndIf
If $Screen = "800x600" Then
$XScreen = 800
$YScreen = 600
EndIf
If $Screen = "1024x768" Then
$XScreen = 1024
$YScreen = 768
EndIf
If $Screen = "1280x1024" Then
$XScreen = 1280
$YScreen = 1024
EndIf
If $Screen = "1600x1024" Then
$XScreen = 1600
$YScreen = 1024
EndIf
If $Screen = "1280x768" Then
$XScreen = 1280
$YScreen = 768
EndIf
If $Screen = "1440x900" Then
$XScreen = 1440
$YScreen = 900
EndIf
SearchHead()
ExitLoop
EndSwitch
WEnd
EndFunc ;==>_Main
Func SearchHead()
While $HeadSearchActive = True
If _IsPressed("78", $dll) Then
Stop()
EndIf
If _IsPressed("77", $dll) Then
Pause()
EndIf
$PosX = $XScreen / 2
$PosY = $YScreen / 2
$ULX = $PosX - ($XSquare / 2)
If $ULX < 0 Then $ULX = 0
$ULY = $PosY - ($YSquare / 2)
If $ULY < 0 Then $ULY = 0
$BRX = $PosX + ($XSquare / 2)
$BRY = $PosY + ($YSquare / 2)
$Head = PixelSearch($ULX, $ULY, $BRX, $BRY, $SquareColor, $Tollerance, 1)
If Not @error Then
$XMove = $Head[0] - $PosX
$YMove = $Head[1] - $PosY
MouseMove($XMove, $YMove, $Speed)
EndIf
Sleep(10)
WEnd
EndFunc ;==>SearchHead
Func Stop()
Exit
EndFunc ;==>Stop
Func Pause()
$PauseActive = Not $PauseActive
While $PauseActive = True
If _IsPressed("77", $dll) Then
$PauseActive = False
EndIf
Sleep(5)
WEnd
If $PauseActive = False Then
SearchHead()
EndIf
EndFunc ;==>Pause
DllClose($dll)