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();
}
}