Jump to content

Setting mouse x,y - wrong?


Recommended Posts

I've got this code, but for some reason its not setting my mouse X and Y correctly...not sure why.

global $coord, $aim_on

HotKeySet("z", "qt")
Func qt()
    Exit
EndFunc

HotKeySet("f", "on")
Func on()
    $aim_on = 1
    tooltip("Aimbot on!", 0, 0)
EndFunc

HotKeySet("g", "off")
Func off()
    $aim_on = 0
    tooltip("Aimbot off!", 0, 0)
EndFunc


while 1=1
    if $aim_on = 1 then
    $coord = PixelSearch(158, 197, 798, 677, 0xA2FF2A, 3)
    If isarray($coord) Then
        MouseMove($coord[0], $coord[1])
       ;MouseClick("left",$coord[0],$coord[1],1)
    EndIf
    
        $coord2 = PixelSearch(158, 197, 798, 677, 0x6BB214, 3)
    If isarray($coord2) Then
        MouseMove($coord2[0], $coord2[1])
       ;MouseClick("left",$coord[0],$coord[1],1)
    EndIf
    
        $coord3 = PixelSearch(158, 197, 798, 677, 0x8AD620, 3)
    If isarray($coord3) Then
        MouseMove($coord3[0], $coord3[1])
       ;MouseClick("left",$coord[0],$coord[1],1)
    EndIf
    
EndIf
Wend
;A2FF2A
;6BB214
;8AD620
Link to comment
Share on other sites

Well is the colour being found?

Are you sure the game doesn't have any sort of bot protection?

Global $coord, $aim_on

HotKeySet("z", "qt")
HotKeySet("f", "on")
HotKeySet("g", "off")

While 1
    If $aim_on = 1 Then
        $coord = PixelSearch(158, 197, 798, 677, 0xA2FF2A, 3)
        $c1 = @error
        If IsArray($coord) Then
            MouseMove($coord[0], $coord[1])
        ;MouseClick("left",$coord[0],$coord[1],1)
        EndIf

        $coord2 = PixelSearch(158, 197, 798, 677, 0x6BB214, 3)
        $c2 = @error
        If IsArray($coord2) Then
            MouseMove($coord2[0], $coord2[1])
        ;MouseClick("left",$coord[0],$coord[1],1)
        EndIf

        $coord3 = PixelSearch(158, 197, 798, 677, 0x8AD620, 3)
        $c3 = @error
        If IsArray($coord3) Then
            MouseMove($coord3[0], $coord3[1])
        ;MouseClick("left",$coord[0],$coord[1],1)
        EndIf
        ToolTip("Coord 1 Error = " & $c1 & @CRLF & _
                "Coord 2 Error = " & $c2 & @CRLF & _
                "Coord 3 Error = " & $c3)
    EndIf
WEnd
;A2FF2A
;6BB214
;8AD620

Func qt()
    Exit
EndFunc  ;==>qt


Func on()
    $aim_on = 1
    ToolTip("Aimbot on!", 0, 0)
EndFunc  ;==>on


Func off()
    $aim_on = 0
    ToolTip("Aimbot off!", 0, 0)
EndFunc  ;==>off
Link to comment
Share on other sites

Yeah, its detecting the color, and no the game doesn't have protection. It was working just the other day...

By the way, that is returning error code 1 on all 3, im not sure what that means.

Edited by Juggernaut
Link to comment
Share on other sites

Geeze dude, I said RTFM.

I am showing the @ERROR for each function call, 1 means colour was not found. Can I make it simpler?

Also, you have been here long enough to know not to bump your posts too quickly. Remember only once every 24 hours.

Cheers,

Brett

Link to comment
Share on other sites

Bad programming habbits lead to bad code. So I've fixed both

; Colors to look for:
; A2FF2A
; 6BB214
; 8AD620


Dim $lPos, $bAimOn = False

HotKeySet("z", "_Quit")
HotKeySet("f", "_Aimbot_On")
HotKeySet("g", "_Aimbot_Off")

While True
    If $bAimOn == 1 Then
        
        $lPos = PixelSearch(158, 197, 798, 677, 0xA2FF2A, 3)
        
        If IsArray($lPos) And Not @error Then
            
            MouseMove($lPos[0], $lPos[1])
            ;MouseClick("left",$coord[0],$coord[1],1)
            
        EndIf

        $lPos = PixelSearch(158, 197, 798, 677, 0x6BB214, 3)
        
        If IsArray($lPos) And Not @error Then
            
            MouseMove($lPos[0], $lPos[1])
            ;MouseClick("left",$coord[0],$coord[1],1)
            
        EndIf

        $lPos = PixelSearch(158, 197, 798, 677, 0x8AD620, 3)
        
        If IsArray($lPos) And Not @error Then
            
            MouseMove($lPos[0], $lPos[1])
            ;MouseClick("left",$coord[0],$coord[1],1)
            
        EndIf

    EndIf
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

Func _Aimbot_Off()
    $bAimOn = False
    ToolTip("Aimbot off!", 0, 0)
EndFunc   ;==>_Aimbot_Off

Func _Aimbot_On()
    $bAimOn = True
    ToolTip("Aimbot on!", 0, 0)
EndFunc   ;==>_Aimbot_On
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...