Sign in to follow this  
Followers 0
cranties

Help on AutoAim Cheat

19 posts in this topic

Please help me!!!

I write this code to make an AutoAim "cheat" for a game... I already use ArtificialAimingRadar that make a red square near enemy, so my game have "fire zone" in center of screen, i search near center of screen the color that match the square of artificialAimingRadar (this is a unique in-game color) and try to mouve the "mouse" to this position (making aiming...)

The problem came when i "mouve" the mouse.. the game spin-me-around ....

This is my code, please help me.... in windows is all right.. but in game no... i think that i must move mouse in relative coord.. but he don't go too...

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=AutoAim v5.7.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", 1)
$MouseMode = True
$InvertCoords = False
$Speed = 20
$XSquare = 100
$YSquare = 100
$Tollerance = 10
$XScreen = @DesktopWidth
$YScreen = @DesktopHeight
$DllInject = True
$SearchEntireScreen = False

_Main()

Func _Main()
    $AutoAim = GUICreate("AutoAim v5.7 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, 200, 25) ; mousespeed
    $Label1 = GUICtrlCreateLabel("Mouse Speed", 24, 72, 89, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $XInvertCoords = GUICtrlCreateCheckbox("Invert Coordinate Mode", 24, 120, 175, 17)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $XMouseMode = GUICtrlCreateCheckbox("Relative Coordinate Mode", 24, 144, 175, 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, 200, 25) ; xmax
    GUICtrlSetLimit(-1, 300, 0)
    $Label6 = GUICtrlCreateLabel("Y Max Search", 22, 355, 87, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $YMax = GUICtrlCreateSlider(118, 355, 200, 25) ; ymax
    GUICtrlSetLimit(-1, 300, 0)
    $Label7 = GUICtrlCreateLabel("Color Toller.", 22, 300, 87, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $XTollerance = GUICtrlCreateSlider(118, 300, 200, 25) ; color
    GUICtrlSetLimit(-1, 100, 0)
    $XScreenLbl = GUICtrlCreateInput($XScreen, 128, 384, 100, 25)
    $YScreenLbl = GUICtrlCreateInput($YScreen, 250, 384, 100, 25)
    $Label7 = GUICtrlCreateLabel("Screen Resol.", 22, 387, 89, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $Label8 = GUICtrlCreateLabel("X", 235, 387, 15, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $UseDLL = GUICtrlCreateCheckbox("Use DLL for Inject", 220, 120, 169, 17)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $AllScreen = GUICtrlCreateCheckbox("Search All Screen", 220, 144, 169, 17)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $colorlbl = GUICtrlCreateInput($Tollerance, 320, 300, 25, 20) ; colorlbl
    $xmaxlbl = GUICtrlCreateInput($XSquare, 320, 328, 25, 20) ; xmaxlbl
    $ymaxlbl = GUICtrlCreateInput($YSquare, 320, 355, 25, 20) ; ymaxlbl
    $mouselbl = GUICtrlCreateInput($Speed, 320, 72, 25, 20) ; mouselbl
    $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($XInvertCoords, $InvertCoords)
    $Test = GUICtrlSetState($XMouseMode, $MouseMode)
    $Test = GUICtrlSetState($UseDLL, $DllInject)
    $Test = GUICtrlSetState($AllScreen, $SearchEntireScreen)
    $Test = GUICtrlSetData($Help, "Welcome to AutoAim by Cranties. Please use with ArtificialAimingRadar.")

    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 $XTollerance
                $Tollerance = GUICtrlSetData($colorlbl, GUICtrlRead($XTollerance, 2))
            Case $XMax
                $XSquare = GUICtrlSetData($xmaxlbl, GUICtrlRead($XMax, 2))
            Case $YMax
                $YSquare = GUICtrlSetData($ymaxlbl, GUICtrlRead($YMax, 2))
            Case $MouseSpeed
                $Speed = GUICtrlSetData($mouselbl, GUICtrlRead($MouseSpeed, 2))
            Case $UseDLL
                $DllInject = Not $DllInject
            Case $AllScreen
                $SearchEntireScreen = Not $SearchEntireScreen
            Case $XMouseMode
                $MouseMode = Not $MouseMode
                $Val = GUICtrlRead($XMouseMode)
                If $Val = $GUI_CHECKED Then AutoItSetOption("MouseCoordMode", 0)
                If $Val = $GUI_UNCHECKED Then AutoItSetOption("MouseCoordMode", 1)
            Case $BtnStart
                GUISetState(0)
                $HeadSearchActive = True
                $Speed = GUICtrlRead($MouseSpeed)
                $XSquare = GUICtrlRead($XMax)
                $YSquare = GUICtrlRead($YMax)
                $Tollerance = GUICtrlRead($XTollerance)
                $InvertCoords = GUICtrlRead($XInvertCoords)
                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
        If $SearchEntireScreen = True Then
            $ULX = 0
            $ULY = 0
            $BRX = $XScreen - 1
            $BRY = $YScreen - 1
        Else
            $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)
        EndIf
        $Head = PixelSearch($ULX, $ULY, $BRX, $BRY, $SquareColor, $Tollerance, 1)
        If Not @error Then
            If $MouseMode = True Then
                $XMove = $Head[0]
                $YMove = $Head[1]
            Else
                $XMove = $Head[0] - $PosX
                $YMove = $Head[1] - $PosY
            EndIf
            If $DllInject = False Then
                MouseMove($XMove, $YMove, $Speed)
            Else
                MouseMoveDLL($XMove, $YMove, $dll)
            EndIf
            Sleep(500)
        EndIf
        Sleep(100)
    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

Func MouseMoveDLL($x, $y, $dll_h = "user32.dll")
;~  http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/resources/cursors/cursorreference/cursorfunctions/setcursorpos.asp
    ;Local $return = DllCall( $dll_h, "int", "SetCursorPos", "int", $x, "int", $y)
    Local $return = DllCall($dll_h, "int", "SetCursorPos", "int", $x, "int", $y)
    Return $return[0]
EndFunc   ;==>MouseMoveDLL

Func MakeLong($LoWord, $HiWord)
    Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc   ;==>MakeLong

DllClose($dll)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I dont think your going to get help cheating at fps games here. Its people like you that ruin tbe experience for everyone.

Edited by P5ych0Gigabyte

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

There's lots of examples around, anyway, of relative positioning. The fact that you not only want to cheat, but are being lazy about it, is probably what will prevent most people from helping you. Normally I'd link someone to the fix in question, but not this time. Good luck searching. :)

Share this post


Link to post
Share on other sites

Normally I'd link someone to the fix in question, but not this time. Good luck searching. :)

Please... Help me... i work on open source... It's a good point, not?

I search and searhc, but not arrive at nothing....

I don't make a "CHEAT" for a price.. but an open source hack for a free game.....

Thx if you want to help me...

Share this post


Link to post
Share on other sites

Link me to the game? Relax physco...this is a "general help forum" section.


"I think, therefore I am"[size="1"]René Descartes[/size]

Share this post


Link to post
Share on other sites

Since it's a fps, this may not work without using some very advanced stuff, and probably not autoit. Most fps games "lock" the mouse, and kinda sample mouse movement to decide how to move the characters view, so moving the mouse to a certain spot on the screen should make the game think you just moved the mouse really fast in some direction (at least that's what I think fps games do) so good luck with this, but that's something to consider


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

The Game is BattleField Heroes (www.battlefieldheroes.com)

If you see my code you can view that i search enemy in a square 200x200 pixel round the center of screen an if i found i try to move mouse to relative position....

Thx for help

Share this post


Link to post
Share on other sites

Since it's a fps, this may not work without using some very advanced stuff, and probably not autoit. Most fps games "lock" the mouse, and kinda sample mouse movement to decide how to move the characters view, so moving the mouse to a certain spot on the screen should make the game think you just moved the mouse really fast in some direction (at least that's what I think fps games do) so good luck with this, but that's something to consider

i think is right.. so i search for enemy, when i found i have the coordinate,

esample if screen is 1000x1000 (make simple...)

the fire focus (center of screen) is 500.500

I found an enemy at 400.400

i need to move mouse -100 X and -100 Y ... is right???

you say that there is a "division" factor? esample for going to -100.-100 i must move mouse only -10.-10???

how i can move mouse with relative coord??

MouseCoordMode=0 or 2 not going.... make me spin around... or see the sky... but if the coord move must be factorize... he can go!!!

what do you think about it?

Share this post


Link to post
Share on other sites

You get the current mouse position:

MouseGetPos

You add the relative position to it:

X = X + RelativeX

Y = Y + RelativeY

You move the mouse:

MouseMove

Share this post


Link to post
Share on other sites

You get the current mouse position:

MouseGetPos

You add the relative position to it:

X = X + RelativeX

Y = Y + RelativeY

You move the mouse:

MouseMove

See my code... i make this.... and i spin around... i think is right that there are a "factorize" process....

X = (X + RelativeX) / ReductionFactor

Y = (Y + RelativeY) / ReductionFactor

.... what do you think?

Share this post


Link to post
Share on other sites

a little... normaly 1 second and finally a see the sky

Share this post


Link to post
Share on other sites

Try to get the current mouse position,

do X + 1

and mouse move.

yes... i will try!!!!

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

The AutoIt MouseGetPos command doesn't work in Battlefield Hero's (and most other FPS games) thankfully. Here's a thought... learn to play rather than cheat. It's much more fulfilling.

Edit: typo

Edited by PartyPooper

Share this post


Link to post
Share on other sites

So...

If i mouve mouse x+1 or y+1 is all right....

if i intend to move left or up (x-1 or y-1) i spin around....

There is a system to EMULATE the mouse movement really?

Share this post


Link to post
Share on other sites

No, as I said, thankfully AutoIt doesn't work as an aimbot for most FPS games because of the way the games virtual world is drawn.

Share this post


Link to post
Share on other sites

So...

If i mouve mouse x+1 or y+1 is all right....

if i intend to move left or up (x-1 or y-1) i spin around....

There is a system to EMULATE the mouse movement really?

Even with only x+1 and y+1 you can get where you want.

I give you this without warranties. If it doesn't work: You're on your own.

; Panic switch
HotKeySet("{ESC}", "_exit")
Func _exit()
    Exit
EndFunc
; Panic switch


; Should look right and down
_MouseMove(50, 12)


Func _MouseMove($rel_x, $rel_y)
    $step_x = $rel_x / Abs($rel_x)
    $step_y = $rel_y / Abs($rel_y)
    
    $left_x = $rel_x
    $left_y = $rel_y
    ConsoleWrite("Step x: " & $step_x & " & step y: " & $step_y & @CRLF)
    
    While 1
        
        If ($left_x <> 0) Then
            $pos = MouseGetPos()
            MouseMove($pos[0] + $step_x, $pos[1], 0)
            $left_x -= $step_x
            
            Sleep(10)
        EndIf
        
        If ($left_y <> 0) Then
            $pos = MouseGetPos()
            MouseMove($pos[0], $pos[1] + $step_y, 0)
            $left_y -= $step_y
            
            Sleep(10)
        EndIf
        
        If ($left_x == 0 And $left_y == 0) Then
            ExitLoop
        EndIf
        
        ConsoleWrite("Left x: " & $left_x & " & left y: " & $left_y & @CRLF)
        
    Wend
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0