Anmeldungsdatum: Mai 2008
Beiträge: 8
|
Hallom,
Ich habe versucht mit meinen VB Skillz eine Art Triggerbot zu basteln, welcher mit den Farben der Pixel arbeitet. Jedoch bekomme ich das nicht so ganz hin. Die Farben werden zwar ausgelesen, aber entweder schiesst der Bot wie verrückt oder garnicht .
TEXT Code: Imports System.Runtime.InteropServices Public Class Form1 Public pixColor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y) Public modelcolor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y) Public ForeColorStr As String Public model As String <DllImport("gdi32.dll")> _ Private Shared Function CreateDC( _ ByVal lpszDriver As String, _ ByVal lpszDevice As String, _ ByVal lpszOutput As String, _ ByVal lpInitData As IntPtr) As IntPtr End Function <DllImport("gdi32.dll")> _ Private Shared Function DeleteDC(ByVal hdc As IntPtr) As Boolean End Function <DllImport("gdi32.dll")> _ Private Shared Function GetPixel( _ ByVal hdc As IntPtr, _ ByVal nXPos As Integer, _ ByVal nYPos As Integer) As Integer End Function Public Function GetPixelColor(ByVal x As Integer, ByVal y As Integer) As Color Dim hdcScreen As IntPtr = CreateDC("Display", Nothing, Nothing, IntPtr.Zero) Dim colorRef As Integer = GetPixel(hdcScreen, x, y) DeleteDC(hdcScreen) Return Color.FromArgb(colorRef And &HFF, _ (colorRef And &HFF00) >> 8, (colorRef And &HFF0000) >> 16) End Function Public Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long) Public Const MOUSEEVENTF_LEFTDOWN = &H2 Public Const MOUSEEVENTF_LEFTUP = &H4 Public Sub SimulateClick() mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0) mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0) End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'Dim pixColor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y) 'Dim ForeColorStr As String = ColorTranslator.ToHtml(pixColor) 'Label1.Text = ForeColorStr Timer1.Enabled = False Timer2.Enabled = True End Sub Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort Public Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Dim modelcolor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y) Dim model As String = ColorTranslator.ToHtml(modelcolor) Label2.Text = model Timer4.Enabled = True End Sub Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick If CBool(GetAsyncKeyState(Keys.F12)) Then Timer1.Enabled = True Dim pixColor As Color = GetPixelColor(Cursor.Position.X, Cursor.Position.Y) Dim ForeColorStr As String = ColorTranslator.ToHtml(pixColor) Label1.Text = ForeColorStr ' Else : Timer1.Enabled = False 'Timer2.Enabled = False End If End Sub Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick If model <> ForeColorStr Then SimulateClick() Timer2.Enabled = False Timer4.Enabled = False Else End If End Sub End Class
Das ganze soll so funktionieren: 1. Sobald F12 gedrückt wird, wird die Hintergrundfarbe gespeichert (nun muss man leider stillhalten= 2. Wenn sich der anvisierte Pixel nun verändert, also wenn ein Gegner in das Fadenkreuz springt --> Schuss.
Optimal wäre es, wenn man die Taste gedrückt halten müsste.
|