Question[HELP] Auto click

Posts 16–28 of 28 · Page 2 of 2
Quote Originally Posted by Jason View Post
Sorry about the slow reply, I forgot about it xD

Anyways here's my code for triggering a click when mouse is over a certain color.

[REQUIREMENTS]

A timer with an interval of 1. That's it.

[php]
Option Explicit On
Imports System.Runtime.InteropServices

Friend Class Form1
Inherits System.Windows.Forms.Form
Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dwExtraInfo As Long)
Private Const LEFTMOUSEUP = &H4
Private Const LEFTMOUSEDOWN = &H2

Private Sub MouseClicks()
mouse_event(LEFTMOUSEDOWN, 0, 0, 0, 0)
mouse_event(LEFTMOUSEUP, 0, 0, 0, 0)
End Sub

<StructLayout(LayoutKind.Sequential)> Private Structure POINTAPI
Dim x As Integer
Dim y As Integer
End Structure

Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As POINTAPI) As Integer
Private Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Integer) As Integer
Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Integer, ByVal x As Integer, ByVal y As Integer) As Integer




Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
Timer1.Interval = 100
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Timer1.Tick
Dim structCursorPosition As POINTAPI
Call GetCursorPos(structCursorPosition)
Dim lColor As Integer = GetPixel(GetDC(0), structCursorPosition.x, structCursorPosition.y)

Dim c As Color = ColorTranslator.FromOle(lColor)
Dim R1, G1, B1 As Integer
R1 = c.R
G1 = c.G
B1 = c.B

If RGB(c.R, c.G, c.B) = RGB(255, 3, 3) Then ' Change the 'RGB(255, 3, 3)' to whatever color'
Call MouseClicks()
MsgBox("OMG IT WORKED") ' remove this, i was just testing'
End If


End Sub
End Class
[/php]

Hope that works for you.
He wants to search the whole screen for a specific color and move the cursor there.
FLAMESABER, I'm guessing it's a predetermined RGB color, perhaps texture chams that render block color (just guessing) So all it would have to do is move the mouse cursor to the preset RGB color (this is all hypothetical, I don't actually know if this is how he's planning to do it)
Quote Originally Posted by Jason View Post
FLAMESABER, I'm guessing it's a predetermined RGB color, perhaps texture chams that render block color (just guessing) So all it would have to do is move the mouse cursor to the preset RGB color (this is all hypothetical, I don't actually know if this is how he's planning to do it)
Textures can't be predetermined RGBs. So, I guess the program will have to search for the color in real-time !!
I wont get the color ingame what i am gonna do is make the other team look red (just the chest) then before i go in game on the program i am going to choose the color red, and it should work whenever i am in game.
Its basically an aimbot.
Quote Originally Posted by SoldierFront View Post
I wont get the color ingame what i am gonna do is make the other team look red (just the chest) then before i go in game on the program i am going to choose the color red, and it should work whenever i am in game.
Its basically an aimbot.
Woo I was right. FLAME do you mean that even if the player is rendered being solid RGB(255, 0, 0) there isn't a way to get the mouse to move to that color?

I don't know jack about DirectX
Quote Originally Posted by Jason View Post
Woo I was right. FLAME do you mean that even if the player is rendered being solid RGB(255, 0, 0) there isn't a way to get the mouse to move to that color?

I don't know jack about DirectX
We will hardly get a pure value of 255 for red. So we need to mix the RGB. Hence not, predefined.

@Soldier: What will be the color of the other team before we will convert them to red. This is needed because we will compare colors, and then convert the matching pixels to red.
He's simply going to change the textures I guess, so you just gotta search for one specific red.
Quote Originally Posted by Blubb1337 View Post
He's simply going to change the textures I guess, so you just gotta search for one specific red.
That's what I said, but maybe FLAMESABER knows more than me (noshit)
Quote Originally Posted by Jason View Post
That's what I said, but maybe FLAMESABER knows more than me (noshit)
Well, I guess you're right. If he is going to edit the texture, then I think it will be easy. All now we need is capture the screen and compare it every second. Correct me if I am wrong ?
Yeah that's it, I think, I don't know much about VB i just know the basics, thats why I am asking for help.
thanks everyone even if I can't do this program you guys have been amazing and helped me a lot.
Quote Originally Posted by SoldierFront View Post
Yeah that's it, I think, I don't know much about VB i just know the basics, thats why I am asking for help.
thanks everyone even if I can't do this program you guys have been amazing and helped me a lot.
I think your program is done. All I now I have to do is write a code that will get any type of red color on the screen and click it. But there could be a problem. If it's a directX game, maybe the mouse click won't work there... xD
Quote Originally Posted by Hassan View Post
I think your program is done. All I now I have to do is write a code that will get any type of red color on the screen and click it. But there could be a problem. If it's a directX game, maybe the mouse click won't work there... xD
I think it is a directX but i will try anyway, if it doesn't work it will help in the future.
If you can give me a link to download the program when you finish and then give me the source so I can make a good GUI for it.
Thank you once again.
I got to go now, I'll check this thread when I am back, I hope I can make this program today.
Posts 16–28 of 28 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us