Results 1 to 2 of 2
  1. #1
    karaw's Avatar
    Join Date
    Dec 2013
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    1

    C++ triggerbot tutorial/source

    First thing i've ever coded, first tut and source i've ever posted. hope you like.

    --------------------------------------------------------------------------
    What you need: Halo PC, Cheat Engine, a C++ compiler, I used Code::Blocks
    --------------------------------------------------------------------------

    **I did all this in single player, it's most likely the same in multi**


    First off, for a triggerbot, you need to know when you're aiming at an enemy. So fire

    up Halo, fire up Cheat Engine and get to searching. After a while you should find an

    address who's value only changes from 0 to 1, depending on if you're aiming on an

    enemy or not. Got the address? Cool, keep reading.

    Now we're going to be using functions from windows.h and iostream, so include those.

    What do we need to find to make this work? The game window, the process id of halo,

    the reticle, the value for the reticle, and we're going to shoot with a delay so the

    pistol is still accurate.

    ------------------------------------------------------------------------------------
    #include <windows.h>
    #include <iostream>
    using namespace std;

    HWND__* window;
    DWORD processid;
    DWORD reticle = *hex address here*
    int value;
    float delay = 0.8;
    ------------------------------------------------------------------------------------

    To find the window, we need to use Windows.h's 'FindWindow' function. FindWindow takes

    two parameters, the first one being ClassName, which we're going to leave as 'NULL'.

    The second one is the WindowName, obviously 'Halo'.

    ------------------------------------------------------------------------------------
    window = FindWindow(NULL, "Halo");
    if (window != 0)
    {
    cout<<"Halo found. Retrieving process ID.\n";
    }

    else
    {
    cout<<"Halo not found. Open the game before opening the trigger bot.\n";
    }
    ------------------------------------------------------------------------------------

    To find the Process ID of Halo, we need to use the 'GetWindowThreadProcessId'

    function. This function also takes two parameters, the first one is your window, the

    second is a pointer to the variable you're saving the process ID to.

    ------------------------------------------------------------------------------------
    GetWindowThreadProcessId(window, &processid);
    ------------------------------------------------------------------------------------

    Now we need to use the 'OpenProcess' function to open the Halo process with reading

    rights. OpenProcess takes three parameters, one of which we don't need and will leave

    0. The first one is the desired access level, which is read, the third is the process

    ID.

    ------------------------------------------------------------------------------------
    HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,processid);
    if (!phandle) //error check
    {
    cout<<"Couldn't handle the process.\n";
    }
    else
    {
    cout<<"Retrieved the process ID, ready to read memory.\nGo aim at someone.\n";
    }
    ------------------------------------------------------------------------------------

    Now that we have it open and ready for reading, let us read. The 'ReadProcessMemory'

    function takes five arguments; the process handle, the base address we want to read,

    the pointer you want to put the contents in, the number of bytes to be read and the

    pointer to a variable that receives the output of the 3rd argument, I left it at 0.

    NULL will ignore the parameter.

    ------------------------------------------------------------------------------------
    ReadProcessMemory(phandle, (void*)reticle, &value, sizeof(value), 0);
    ------------------------------------------------------------------------------------

    Basically this says 'Read what is in "reticle" and store it in "value", to the size of

    "value",and finally the number of bytes read, which isn't important in this case, so 0

    or NULL is appropriate.

    Now remember that value is either going to be 1 if you're aiming at someone, or 0 if

    you aren't. So we'll throw an if statement in saying that if you're aiming on someone,

    send a mouse click and wait the delayed amount of time before continuing the loop and

    shooting again.

    ------------------------------------------------------------------------------------
    if (value == 1)
    {
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
    Sleep(delay);
    }
    else
    {
    continue;
    }
    ------------------------------------------------------------------------------------

    Now we wrap that last part in an always running while loop so it keeps checking the

    value and shooting if applicable.

    Thus, we have our triggerbot.


    ------------------------------------------------------------------------------------
    Code:
    #include <windows.h>
    #include <iostream>
    using namespace std;
    
    HWND__* window;
    DWORD processid;
    DWORD reticle = *hex address here*
    int value;
    float delay = 0.8;
    
    int main()
    {
    
    window = FindWindow(NULL, "Halo");
    if (window != 0)
    {
    cout<<"Halo found. Retrieving process ID.\n";
    }
    
    else
    {
    cout<<"Halo not found. Open the game before opening the trigger bot.\n";
    }
    
    GetWindowThreadProcessId(window, &processid); 
    HANDLE phandle = OpenProcess(PROCESS_VM_READ,0,processid); 
    if (!phandle) //error check
    {
    cout<<"Couldn't handle the process.\n";
    }
    else
    {
    cout<<"Retrieved the process ID, ready to read memory.\nGo aim at someone.\n";
    }
    while (1)
    {
    ReadProcessMemory(phandle, (void*)reticle, &value, sizeof(value), 0); 
    if (value == 1)
    {
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
    Sleep(delay);
    }
    else
    {
    continue;
    }
    
    }
    
    return 0;
    }
    ------------------------------------------------------------------------------------

    Hope you guys liked it, I used microsof*****m to help explain the functions, but put it in kinder words. Also got a line or two of code from stackoverflow while searching for examples of some functions, simply because the microsoft run down can be confusing.
    Last edited by Flengo; 03-11-2014 at 01:28 PM.

  2. The Following User Says Thank You to karaw For This Useful Post:

    matt_9908 (06-10-2015)

  3. #2
    killmail1027's Avatar
    Join Date
    Nov 2012
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    Just asking what is A triggerbot is it like A aimbot or something

Similar Threads

  1. This section is for Tutorials/Source Codes
    By Gio in forum Adventure Quest Worlds (AQW) Tutorials, Source Code & Coding
    Replies: 0
    Last Post: 08-19-2013, 11:30 PM
  2. THIS SECTION IS FOR PRIVATE SERVER TUTORIALS/SOURCE CODE ONLY
    By nilly in forum Realm of the Mad God Private Servers Tutorials/Source Code
    Replies: 2
    Last Post: 08-09-2013, 04:19 AM
  3. [Tutorial] Multi-Line Spammer Tutorial + Source code and project
    By dragonattak in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 5
    Last Post: 07-05-2011, 04:40 AM
  4. [Tutorial] Complete source for warrock hack!
    By Noxit in forum C++/C Programming
    Replies: 25
    Last Post: 09-27-2009, 02:59 PM
  5. [Tutorial] Triggerbot Class
    By cjg333 in forum Programming Tutorials
    Replies: 10
    Last Post: 03-01-2008, 04:35 AM