[Help] AFK Bot for Crossfire.
Hey all.
For 1 week now, i am farming at Crossfire. And i am already gettin tired by moving my char to dont get kicked for being afk.
So i downloaded Visual Basic again, i tried to create kind of a "Anti-AFK Bot".
But it doesnt worked so far. And i have no idea, how to go on.
I dont know whether Crossfire or Xtrap, but something is blocking every keystroke my app sends.
i already tried SendKeys, the keybd_event function via KeyPush.dll & the SendInput function via user32.dll. I got all of them sending keystrokes to the notepad, but when i try them in Crossfire.. nothing happens.
Is there any1, who can give me a helping hand? If i get the bot working for Crossfire, i am going to release it in the crossfire hack section.
Thank you,
Paul
Here, my try with SendInput: But it doesnt worked for crossfire...
[php]Imports System****ntime.InteropServices
Public Class Form1
Private Sub DoKeyBoard(ByVal flags As NativeMethods.KEYEVENTF, ByVal key As Keys)
Dim input As New NativeMethods.INPUT
Dim ki As New NativeMethods.KEYBDINPUT
input.dwType = NativeMethods.InputType.Keyboard
input.ki = ki
input.ki.wVk = Convert.ToInt16(key)
input.ki.wScan = 0
input.ki.time = 0
input.ki.dwFlags = flags
input.ki.dwExtraInfo = IntPtr.Zero
Dim cbSize As Integer = Marshal.SizeOf(GetType(NativeMethods.INPUT))
Dim result As Integer = NativeMethods.SendInput(1, input, cbSize)
If result = 0 Then Debug.WriteLine(Marshal.GetLastWin32Error)
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
DoKeyBoard(4, Keys.A)
DoKeyBoard(4, Keys.D)
End Sub
Private Sub startBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles startBtn.Click
Timer1.Enabled = True
stopBtn.Enabled = True
startBtn.Enabled = False
End Sub
Private Sub stopBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles stopBtn.Click
Timer1.Enabled = False
startBtn.Enabled = True
stopBtn.Enabled = False
End Sub
End Class
Public Class NativeMethods
<DllImport("user32.dll", SetLastError:=True)> _
Friend Shared Function SendInput(ByVal cInputs As Int32, ByRef pInputs As INPUT, ByVal cbSize As Int32) As Int32
End Function
<StructLayout(LayoutKind.Explicit, pack:=1, Size:=28)> _
Friend Structure INPUT
<FieldOffset(0)> Public dwType As InputType
<FieldOffset(4)> Public mi As MOUSEINPUT
<FieldOffset(4)> Public ki As KEYBDINPUT
<FieldOffset(4)> Public hi As HARDWAREINPUT
End Structure
<StructLayout(LayoutKind.Sequential, pack:=1)> _
Friend Structure MOUSEINPUT
Public dx As Int32
Public dy As Int32
Public mouseData As Int32
Public dwFlags As MOUSEEVENTF
Public time As Int32
Public dwExtraInfo As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, pack:=1)> _
Friend Structure KEYBDINPUT
Public wVk As Int16
Public wScan As Int16
Public dwFlags As KEYEVENTF
Public time As Int32
Public dwExtraInfo As IntPtr
End Structure
<StructLayout(LayoutKind.Sequential, pack:=1)> _
Friend Structure HARDWAREINPUT
Public uMsg As Int32
Public wParamL As Int16
Public wParamH As Int16
End Structure
Friend Enum InputType As Integer
Mouse = 0
Keyboard = 1
Hardware = 2
End Enum
<Flags()> _
Friend Enum MOUSEEVENTF As Integer
MOVE = &H1
LEFTDOWN = &H2
LEFTUP = &H4
RIGHTDOWN = &H8
RIGHTUP = &H10
MIDDLEDOWN = &H20
MIDDLEUP = &H40
XDOWN = &H80
XUP = &H100
VIRTUALDESK = &H400
WHEEL = &H800
ABSOLUTE = &H8000
End Enum
<Flags()> _
Friend Enum KEYEVENTF As Integer
EXTENDEDKEY = 1
KEYUP = 2
[UNICODE] = 4
SCANCODE = 8
End Enum
End Class[/php]