Results 1 to 6 of 6
  1. #1
    Ephemera's Avatar
    Join Date
    Jun 2007
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0

    [Help]VB6 Trainer - buttons/timers

    I've been doing a VB6 trainer since... yesterday. As it's my first, I'm having a couple doubts... Hope you can help me out:

    I have the following module (NP in showing it, as it is copied, so...)
    Code:
    Public Const PROCESS_ALL_ACCESS = &H1F0FFF
    Dim f1holder As Integer
    Dim timer_pos As Long
    
    'API Declaration
    Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long) As Long
    Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
    Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
    Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
    Public Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Long) As Integer
    Public Declare Function ReadProcessMem Lib "kernel32" Alias "ReadProcessMemory" (ByVal hProcess As Long, ByVal lpBaseAddress As Any, ByRef lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
    
    Public Function WriteAByte(gamewindowtext As String, address As Long, value As Byte)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 1, 0&
    CloseHandle hProcess
    End Function
    
    Public Function WriteAnInt(gamewindowtext As String, address As Long, value As Integer)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 2, 0&
    CloseHandle hProcess
    End Function
    
    Public Function WriteALong(gamewindowtext As String, address As Long, value As Long)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    WriteProcessMemory phandle, address, value, 4, 0&
    CloseHandle hProcess
    End Function
    
    Public Function ReadAByte(gamewindowtext As String, address As Long, valbuffer As Byte)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 1, 0&
    CloseHandle hProcess
    End Function
    
    Public Function ReadAnInt(gamewindowtext As String, address As Long, valbuffer As Integer)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 2, 0&
    CloseHandle hProcess
    End Function
    
    Public Function ReadALong(gamewindowtext As String, address As Long, valbuffer As Long)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    ReadProcessMem phandle, address, valbuffer, 4, 0&
    CloseHandle hProcess
    End Function
    
    Public Function ReadAFloat(gamewindowtext As String, address As Long, valbuffer As Single)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    
    ReadProcessMem phandle, address, valbuffer, 4, 0&
    CloseHandle hProcess
    End Function
    
    
    
    Public Function WriteAFloat(gamewindowtext As String, address As Long, value As Single)
    Dim hWnd As Long
    Dim pid As Long
    Dim phandle As Long
    
    hWnd = FindWindow(vbNullString, gamewindowtext)
    If (hWnd = 0) Then
    MsgBox "The Game Is Not Working", vbCritical, "Error"
    End
    Exit Function
    End If
    
    GetWindowThreadProcessId hWnd, pid
    phandle = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
    If (phandle = 0) Then
    MsgBox "Can't get ProcessId", vbCritical, "Error"
    Exit Function
    End If
    
    WriteProcessMemory phandle, address, value, 4, 0&
    CloseHandle hProcess
    End Function
    Don't know if you need that anyway, but it doesn't bite anyone -.-'

    Through the tut, I made a button for GPS and a hotkey for it. As GPS is always detected, I didn't even bothered trying (did it just to understand how it was, and I can't understand why different tuts ALWAYS put GPS as their example!!!)

    I did the BUTTON this way:
    Code:
    Call WriteALong("WarRock", &H90DC84, 1)
    (gamewindow text as String, address as long, value as long)

    IMO, after doing that we just click the button in the compiled/running version and it should work. Don't know cause i don't want to get busted yet. Again.

    I also did a turn off button, by changing 1 into 0.


    Now, the hotkey idea was quite simple:
    Code:
    If GetKeyPress(vbKeyNumpad1) Then
    If Timer2.Interval = 0 Then Timer2.Interval = 1
    Else: Timer2.Interval = 0
    End If
    End Sub

    After this, I had to do it by myself. Then I copied the text written above in the button
    Call WriteALong("WarRock", &H7DB120, 1120403456)

    It didn't work.
    So I did a timer. This time it was different (instead of timer2 and timer1 it was timer 3 and timer4)

    Oh, i did 2 timers for each, one for the getkeypress, the other with the info.


    I just can't get what is wrong.

    So, my questions are:

    How do I get Stamina working in a VB6 trainer?

    How do I know what is the value for stamina off?? 0??

  2. #2
    Grim09's Avatar
    Join Date
    Jun 2007
    Location
    Russia - Россия - Rusland
    Posts
    337
    Reputation
    10
    Thanks
    167
    Stamina off is timerX.interval = 0 (replace X with timer number)

    My codes for stamina buttons are as follows
    Code:
    Private Sub Command1_Click()
    Timer1.Interval = 1
    End Sub
    
    Private Sub Command2_Click()
    Timer1.Interval = 0
    End Sub
    And my code for timer1 is
    Code:
    Private Sub Timer1_Timer()
    Call WriteALong("WarRock", &H7DB120, 1120403456)
    End Sub

  3. #3
    Ephemera's Avatar
    Join Date
    Jun 2007
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    thanks!
    Got it all!

  4. #4
    FluffyStuff's Avatar
    Join Date
    May 2007
    Location
    Dark side of the moon
    Posts
    308
    Reputation
    10
    Thanks
    150
    I think you should try to comment your code more. It's a good habbit to always comment code, especially if other people are going to view it.

  5. #5
    Ephemera's Avatar
    Join Date
    Jun 2007
    Gender
    male
    Posts
    19
    Reputation
    10
    Thanks
    0
    The module code wasn't mine... But when I start creating modules, I'll put 'comments
    Life is a hack. Don't leech it.

    [IMG]https://i140.photobucke*****m/albums/r30/kelsy_012/mpghzn5.gif[/IMG]


  6. #6
    cjg333's Avatar
    Join Date
    Apr 2007
    Location
    indianapolis
    Posts
    300
    Reputation
    17
    Thanks
    54
    did you set the interval on the timer to the hotkeys,it wont turn on if the timer has no interval.

Similar Threads

  1. help making trainer vb6
    By platinum92 in forum WarRock - International Hacks
    Replies: 7
    Last Post: 08-14-2007, 08:17 PM
  2. VB6 trainer
    By Twisted_scream in forum WarRock - International Hacks
    Replies: 2
    Last Post: 06-08-2007, 01:49 PM
  3. [help]with trainer
    By fable741 in forum WarRock - International Hacks
    Replies: 5
    Last Post: 05-09-2007, 08:38 AM
  4. help with trainer
    By danxere in forum WarRock - International Hacks
    Replies: 6
    Last Post: 05-05-2007, 02:02 PM
  5. Nub Help, tuts, trainers, advice.
    By shadowsecret in forum WarRock - International Hacks
    Replies: 7
    Last Post: 04-24-2007, 07:57 AM