HelpHelp needed with inject bhop cheat...

Posts 1–8 of 8 · Page 1 of 1
Help needed with inject bhop cheat...
For starters, I am very new to c++. I picked it up a year ago, but forgot about it until about 2 weeks ago, when I started learning it all over again. I made a very basic bunny hop hack, and no matter how long I took to debug it it still failed. I then decided to polish it up by taking from fleep's counter strike source bhop script and adding a lot of his functionality to my hack, but still no luck.

I am successfully attaching to the game, but I never get the bhop to work. Here is my source:
(P.S., I'm using fleep's HackProcess.h , but I updated it to attach to "csgo.exe" and "Counter-Strike: Global Offensive")
Code:
#include <iostream>
#include <Windows.h>
#include "HackProcess.h"


CHackProcess fProcess;
using namespace std;


const DWORD Player_Base = 0x00A844DC; // known as LocalPlayer in CSGO
const DWORD dw_jump = 0x04F34C68; // actually m_fFLags

const DWORD dw_jumpOffset = 0x3944F424;

#define FL_ONGROUND 257
#define SPACE_BAR 0x20

#define F6_KEY 0x75

bool b_true = true;
bool b_false = false;
bool bhopStatus = false;


struct MyPlayer_t
{
    DWORD ClocalPlayer;
    int m_fFlags;

    void ReadInformation()
    {
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &ClocalPlayer, sizeof(DWORD), 0);
        
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(ClocalPlayer + dw_jumpOffset), &m_fFlags, sizeof(int), 0);
    }

}MyPlayer;


void BunnyHop()
{
    if (GetAsyncKeyState(SPACE_BAR))
    {
        bhopStatus = !bhopStatus;
        Sleep(250);
    }

    if (!bhopStatus)
        return;

    if (MyPlayer.m_fFlags == FL_ONGROUND)
    {
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_true, sizeof(bool), NULL);
    }
    else if (MyPlayer.m_fFlags != FL_ONGROUND)
    {
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_false, sizeof(bool), NULL);
    }

}



int main()
{
    fProcess.RunProcess();
    cout << "Attatched to game..." << endl;


    while (!GetAsyncKeyState(F6_KEY))
    {
        MyPlayer.ReadInformation();

        BunnyHop();
    }
}
Update... slightly changed code...

Code:
#include <iostream>
#include <Windows.h>
#include "HackProcess.h"


CHackProcess fProcess;
using namespace std;


const DWORD Player_Base = 0x00A844DC; // known as LocalPlayer in CSGO
const DWORD dw_jump = 0x04F34C68;

const DWORD dw_jumpOffset = 0x3944F424; //m flags

#define FL_ONGROUND 257
#define SPACE_BAR 0x20

#define F6_KEY 0x75

bool b_true = true;
bool b_false = false;
bool bhopStatus = false;


struct MyPlayer_t
{
    DWORD ClocalPlayer;
    int m_fFlags;

    void ReadInformation()
    {
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &ClocalPlayer, sizeof(DWORD), 0);
        
        ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(ClocalPlayer + dw_jumpOffset), &m_fFlags, sizeof(int), NULL);
    }
}MyPlayer;


void BunnyHop()
{
    if (GetAsyncKeyState(SPACE_BAR))
    {
        cout << "AUTOHOP TOGGLED..." << endl;
        bhopStatus = !bhopStatus;
        Sleep(250);
    }

    if (!bhopStatus)
        return;

    if (MyPlayer.m_fFlags == FL_ONGROUND)
    {
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_true, sizeof(bool), NULL);
    }
    else if (MyPlayer.m_fFlags != FL_ONGROUND)
    {
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_false, sizeof(bool), NULL);
    }

}



int main()
{
    fProcess.RunProcess();
    cout << "Attatched to game..." << endl;


    while (!GetAsyncKeyState(F6_KEY))
    {
        MyPlayer.ReadInformation();

        BunnyHop();
    }
}
/Moved to the correct section.
Code:
void BunnyHop()
{
    if (GetAsyncKeyState(VK_SPACE) & 0x8000 && MyPlayer.m_fFlags & (1 << 0))
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), 6, sizeof(int), NULL);
}
Also exec as Admin, you should also consider using Velocity to check if the player is moving so it does not jump while typing or out of game
Didn't help... in fact it did less than it did last time :/

With the updated code I posted, it would toggle my ability to jump with other keys (a sign it is writing -jump but not +jump?)

I think my best bet is to completely recode the whole thing... I noticed a lot of things that I can polish up like the need for defining b_True and b_False, etc.
I just look at your code again, check your offsets...
Quote Originally Posted by smore View Post
Update... slightly changed code...

Code:
#include <iostream>
#include <Windows.h>
#include "HackProcess.h"


CHackProcess fProcess;
using namespace std;


const DWORD Player_Base = 0x00A844DC; // known as LocalPlayer in CSGO
const DWORD dw_jump = 0x04F34C68;

const DWORD dw_jumpOffset = 0x3944F424; //m flags

#define FL_ONGROUND 257
#define SPACE_BAR 0x20

#define F6_KEY 0x75

bool b_true = true;
bool b_false = false;
bool bhopStatus = false;


struct MyPlayer_t
{
    DWORD ClocalPlayer;
    int m_fFlags;

    void ReadInformation()
    {
        ReadProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + Player_Base), &ClocalPlayer, sizeof(DWORD), 0);
        
        ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(ClocalPlayer + dw_jumpOffset), &m_fFlags, sizeof(int), NULL);
    }
}MyPlayer;


void BunnyHop()
{
    if (GetAsyncKeyState(SPACE_BAR))
    {
        cout << "AUTOHOP TOGGLED..." << endl;
        bhopStatus = !bhopStatus;
        Sleep(250);
    }

    if (!bhopStatus)
        return;

    if (MyPlayer.m_fFlags == FL_ONGROUND)
    {
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_true, sizeof(bool), NULL);
    }
    else if (MyPlayer.m_fFlags != FL_ONGROUND)
    {
        WriteProcessMemory(fProcess.__HandleProcess, (PBYTE*)(fProcess.__dwordClient + dw_jump), &b_false, sizeof(bool), NULL);
    }

}



int main()
{
    fProcess.RunProcess();
    cout << "Attatched to game..." << endl;


    while (!GetAsyncKeyState(F6_KEY))
    {
        MyPlayer.ReadInformation();

        BunnyHop();
    }
}
Code:
const DWORD dw_jumpOffset = 0x3944F424; //m flags
m_fFlags is a variable of the player class, it doesn't have a static address, it's stored where ever your LocalPlayer is stored + 0x100.
Change the offset to 0x100.

Also, if you already comment that line of code with // m flags, why do you call your offset dw_jumpOffset. It's just confusing.

Code:
ReadProcessMemory (fProcess.__HandleProcess, (PBYTE*)(ClocalPlayer + dw_jumpOffset), &m_fFlags, sizeof(int), NULL);
It's not an integer, its a BYTE.

Regarding the GetAsyncKeyState call, you are checking it incorrectly. If you take a look at the MSDN page of GetAsyncKeyState, you'll see the following:

Quote Originally Posted by MSDN
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState.
This means, that your condition will also be true if you let go of the key inbetween the calls. You can bitmask the return value of GetAsyncKeyState. Check for GetAsyncKeyState( KEY ) & 0x8000 if you want to know whether the key is currently pressed or not.
Thanks for your help! I got the script working well. There will still quite a few big mistakes I made that I had to clean up (not sure if you didn't mention them to see if i was c+p lol), but once I figured it out I finally was able to get it functioning. I think that there are still much better ways to code this script, so I think my next project is to make a much cleaner and more simplistic script with comments.

Thanks!

p.s., how do I close this thread?
Quote Originally Posted by smore View Post
p.s., how do I close this thread?
You don't. You need to mention one of the current section Minions who are @Jim Morrison, @4nuoFZf9aE and myself to close any threads made by you that you wish to be closed.

/Solved & closed.
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us