Sign in to follow this  
Followers 0
davgkill

help with pixelsearch script

11 posts in this topic

#1 ·  Posted (edited)

Ok, I'm currently annoyed at most people on this certain server who always use aimbots so I wana give them a taste of their own medicine (and help improve my scripting abilities at the same time)! Most of the example scripts for aimbots that I have searched for on this forum has not worked properly for me so I decided to make my own. Taking a few things out of the "Aimbot - Proof of Concept" script I soon constructed my own aimbot which worked fine aiming for colours in paint. I coloured the models for the game and when I ran the aimbot in game it found the colours but for some reason it moves all over the place away from the models. I think it has something to do with the combination of the resolution and the mouse cursor.

Here is the testing script I have got and as you can see I'm not good at it.

#include <GUIConstants.au3>

$found = "no"
$searchcolor = 0xFF00FF

HotKeySet( "{ESC}" , "end" )

While 1
    If $found = "no" Then
                $coord = PixelSearch(10, 10, 800, 580, $searchcolor)
                If IsArray($coord) = 1 Then
                    MouseMove($coord[0], $coord[1], 0)
                    $found = "yes"
                EndIf
            Else
                $pos = MouseGetPos()
                $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 500) , ($pos[1] + 500), $searchcolor)
                If IsArray($coord) = 1 Then
                    MouseMove( $coord[0], $coord[1], 0)
                Else
                    $found = "no"
                EndIf
                While $found = "yes"
                    $pos = MouseGetPos()
                    $coord = PixelSearch(($pos[0] - 10) , ($pos[1] - 10) , ($pos[0] + 8) , ($pos[1] + 8), $searchcolor)
                    If IsArray($coord) = 1 Then
                        Sleep(500)
                    Else
                        $found = "no"
                    EndIf
                WEnd                    
    EndIf
    Sleep(50)
WEnd

Func end()
    Exit
EndFunc

What I'm trying to do in the script is find the colour, lock on to it and if the colour is still with in like 6-8 pixels stay there. What I like to also like the script to do is follow the "head" and aim onto colours in the shadow. At the moment the colour #FF00FF is the head in the brightest light.

Any help would be much appreciated!!!!!!!!!

Edited by davgkill

Share this post


Link to post
Share on other sites



prolly need some shadevariation, I dont remember things off my head like some people. Can u change your graphics to a solid color model that would be easier to lock onto?

Share this post


Link to post
Share on other sites

I edited the models and the game settings so that it is the exact colour. It only moves all over the place when there is the colour near the cursor.

Share this post


Link to post
Share on other sites

Ok, I did a little debugging on my new script which has some functions that ain't used yet so don't get a bit picky

Opt("MouseClickDelay", 0)
Opt("WinTitleMatchMode", 4)

HotKeySet("{pause}", "_Pause")
HotKeySet("{ESC}", "_Exit")

Global $pause = True
Global $cStatus
Global $tmp
Global $TimerHandle
Global $coord
Global $found = False
Global $SearchColor = 0xFF02FF
Global $SearchDiff = 20
Global $SearchStep = 1; 1 = No jumps(scans every pixel within the $SearchArea square)
Global $SearchArea = 500
Global $ShootDelay = 100
Global $ShootShoot = False




While 1
    Sleep(100)
    If Not $pause Then
        Sleep(2000)
        $MousePos = MouseGetPos()
        $cStatus = PixelSearch($MousePos[0]-$SearchArea, $MousePos[1]-$SearchArea, $MousePos[0]+$SearchArea, $MousePos[1]+$SearchArea, $SearchColor, $SearchDiff, $SearchStep)
        If IsArray($cStatus) Then
            _MouseMove( $cStatus[0], $cStatus[1], $MousePos[0], $MousePos[1] )
            $found = True
        EndIf
        Exit
    EndIf
WEnd




Func _MouseMove($moveX, $moveY, $mouseX, $mouseY)
    
    If $moveX<$mouseX Then
        $sendX = "-" & $mouseX-$moveX
    Else
        $sendX = $moveX-$mouseX
    EndIf

    If $moveY<$mouseY Then
        $sendY = "-" & $mouseY-$moveY
    Else
        $sendY = $moveY-$mouseY
    EndIf
    
    _MouseMovePlus( $sendX, $sendY )
EndFunc




Func _MouseMovePlus($X,  $Y, $dll = 0)
        Local $MOUSEEVENTF_MOVE = 0x1
    If $dll = 0 Then 
    DllCall("user32.dll", "none", "mouse_event", _
            "long",  $MOUSEEVENTF_MOVE, _
            "long",  $X, _
            "long",  $Y, _
            "long",  0, _
        "long",  0)
    Else
    DllCall($dll, "none", "mouse_event", _
            "long",  $MOUSEEVENTF_MOVE, _
            "long",  $X, _
            "long",  $Y, _
            "long",  0, _
        "long",  0)
    EndIf
EndFunc




Func _Pause()
    
    $pause = Not $pause
    
    If $pause Then
        TrayTip("Paused", "Aiming paused", 15)
    Else
        TrayTip("Unpaused", "Aiming!", 15)
    EndIf
    
EndFunc




Func _Exit()
    Exit
EndFunc

I took a screenshot b4 I unpaused the script and added the values the script put to a text file.

Here is the image Debug Image.png (not for 56k users though, lol)

But of cause the aim went way too far too the roof!!!!!!!!!

Share this post


Link to post
Share on other sites

Anyone, please?!

Share this post


Link to post
Share on other sites

Great way of getting back at cheaters...make the server even more unenjoyable for those who play fair. Nice...


Pink Floyd - The Wall

Share this post


Link to post
Share on other sites

... Are you making the mouse move to the location of where the model is on your screen, thats not good? Or are you moving the mouse in a way to make the model move to the middle of your screen, the good way?


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

... Are you making the mouse move to the location of where the model is on your screen, thats not good? Or are you moving the mouse in a way to make the model move to the middle of your screen, the good way?

I'm trying to make a bot that locks onto the head. Making the model 's head stay in the middle of the screen would be great but I just don't know how to do it! It always moves too far away from the pixel that it was ment to go to.

Opt("WinTitleMatchMode", 4) ; Just need to get the aim right first

HotKeySet("{pause}", "_Pause")
HotKeySet("{ESC}", "_Exit")

Global $pause = True
Global $found = False
Global $pix_large
Global $pix_small
Global $SearchColor = 0xFF01FF
Global $SearchDiff = 5
Global $SearchStep = 1; 1 = scans every pixel
Global $SearchArea = 50
Global $SearchAreaSmall = 4

While 1
    
    If Not $pause Then
        $mPos = MouseGetPos()
        $pix_large = PixelSearch($mPos[0]-$SearchArea, $mPos[1]-$SearchArea, $mPos[0]+$SearchArea, $mPos[1]+$SearchArea, $SearchColor, $SearchDiff, $SearchStep)
        
        If IsArray($pix_large) Then
            MouseMove($pix_large[0], $pix_large[1], 0)
            $found = True
            
            While $found = True
                $pix_small = PixelSearch($mPos[0]-$SearchAreaSmall, $mPos[1]-$SearchAreaSmall, $mPos[0]+$SearchAreaSmall, $mPos[1]+$SearchAreaSmall, $SearchColor, $SearchDiff, $SearchStep)
                If IsArray($pix_small) Then
                    Sleep( 20 )
                Else
                    $found = False
                EndIf
            WEnd
            
        EndIf
        
        $pix_large = 0
        $pix_small = 0
    EndIf
    Sleep(10)
    
WEnd


Func _Pause()
    $pause = Not $pause
    If $pause Then
        TrayTip("Paused", "Aiming paused", 15)
    Else
        TrayTip("Unpaused", "Aiming!", 15)
    EndIf
EndFunc


Func _Exit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

If you are doing this for a 3D FPS then this implementation wont work. Doing a simple mouse move to the place of the models head on your screen via (x,y) coords will never be accurate because its 3D space. This requires an algorithm to adjust your person's rotation in game to point directly at the opponents head.

You need to also take into account the FOV (Field of View), thats how much 3D space you can see at your screen at once. Anways, this is a difficult task...


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

You would never succed in making an aimbot in autoit.. The pixelcheck is way to slow... Well if the others can use aimbot, then you can do to.. So that shouldnt be that hard.. If you cant find an aimbot, then its because theres is noone using it.. In that case you just want to cheat..


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

I agree, though its difficult to make a "lock on target" aimbot, its really easy to make a triggerbot. Pixelsearch is actually pretty fast if you limit it down to a small box around your crosshair.

; Triggerbot example, a simple way to fire your weapon when a red-ish
; color is in your crosshairs
; This doesnt take into account lag compensation on moving targets thought

Global $isPaused = 1
Global $SearchColor = 0xFF0000 ;Only fire if pointing at redish color
Global $pixelradius = 3 ;4*3^2 = 36 pixels at crosshair to scan
Global $refreshRate = Floor(1000/@DesktopRefresh)

HotKeySet("{F11}","_PauseBot") ;Toggle TriggerBot
;NOTE: This works only if game is in full screen mode, For this example
Global $left = @Desktopwidth / 2 - $pixelradius
Global $top = @Desktopheight / 2 - $pixelradius
Global $right = @Desktopwidth / 2 + $pixelradius
Global $bottom = @Desktopheight / 2 + $pixelradius

While 1
    PixelSearch( $left, $top, $right, $bottom, $SearchColor, 50 )
    If Not @Error And Not $isPaused Then
       MouseDown("left") ;Assuming this is your primary fire
       Sleep(50) ;make it work in game
       MouseUp("left")
    EndIf
    Sleep($refreshRate) ;Make sync with game framerate
Wend

Func _PauseBot()
   $isPaused = Not $isPaused
   If $isPaused = 1 Then
       ToolTip("TriggerBot Off",10,10)
       sleep(1000) ;Only display for a second
   ElseIf $isPaused = 0 Then
       ToolTip("TriggerBot On",10,10)
       sleep(1000) ;Only display for a second
   Endif
   ToolTip("")
EndFunc

www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

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