Credits: @Merccy2 (Did the bitmasked value check and explained it) @jkfauvel (Helped me alot starting out with game hacking.) and Fleep for ProcMem (Think he created itxD)
Try and learn from it, dont just C&P might be detected or not. Haven't tried.
Decided to release my Source since I've learned so much from here
/* Credits Pscyhobitch @ mpgh.net */
#include "ProcMem.h"
#include <iostream>
#include <Windows.h>
#include <string>
using namespace std;
ProcMem Mem; // Shortcut for ProcMem.
/* Addresses */
const DWORD playerBase = 0x00A7094C; // localplayer (Is the common names for theese in dumpers etc.)
const DWORD entityBase = 0x04A13264; // entity list. (Same as above...)
const DWORD flagOffset = 0x100; // The flag offset, used in reading memory.
/* Defining Virtual keys */
#define space_bar 0x20 // space bar.
#define KEY9 0x39 // the normal 9 used for hopping.
#define KEY9SC 0x0A // Scan code for 9.
#define insert 0x2D // Insert virtual key code.
#define Del 0x2E // delete virtual key code.
#define pressed 0x8000 // The proper way to use GetAsyncKeyState is to BitAND the return value with 0x8000. credits to some random on the internet.
/* Functions */
void bhopCall(bool * onOff);
void bhop();
void jump();
/* Struct used in reading our games memory! */
struct read_t
{
DWORD ClientDLL; // Declarations.
DWORD localPlayer;
int Flags;
void ReadInfo()
{
Mem.Process("csgo.exe"); //Set process name
ClientDLL = Mem.Module("client.dll"); //Module to read from
localPlayer = Mem.Read<DWORD>(ClientDLL + playerBase); //Get our player's information
Flags = Mem.Read<int>(localPlayer + flagOffset); //Get flag state
}
}read; // shortcut thingy.
/* Main function! */
int main()
{
SetConsoleTitle("hack bhop"); // Sets the title of the hack.
cout << "ALL CREDITS TO PSYCHOBITCH MPGH.NET!\n"; // Prints what is inside of the quotations.
cout << "Press Insert to turn on/off and delete to quick exit!\n\n"; // Same as above.
bool onOff = false; // Our bool to tell if it on or off.
while(!(GetAsyncKeyState(Del) & pressed)) bhopCall(&onOff); /* While loop, this is where we implement our quick exit.
so, While del (delete button) is not pressed do bhopCall and give it the addres of onOff.
Basically a infinite loop untill del is pressed (Defined at top.
*/
}
/* the bhopCall where we have to pass the argument onOff with * as it is a pointer.(Same at top) */
void bhopCall(bool * onOff)
{
if (GetAsyncKeyState(insert) & pressed && !*onOff) // If insert is pressed and onOff is already false do the following lines (Stuff inside curly brackets).
{
*onOff = true; // Sets onOff to true.
cout << "Bhop on.\n"; // Prints "Bhop on" the \n is a endline can also be made like this cout << "text" << endl;
Sleep(100); // Sleeps for a 100 milliseconds.
}
else if (GetAsyncKeyState(insert) & pressed && *onOff) // If insert is pressed and onOff is already true do the following lines (Stuff inside curly brackets).
{
*onOff = false; // Sets onOff to false.
cout << "Bhop off.\n"; // prints "bhop off". See explanation above.
Sleep(100); // Sleeps for a 100 milliseconds.
}
if (*onOff) bhop(); // If onOff is == true do bhop. You dont have to type *onOff == true because the compiler asumes it should be true if not told to search otherwise.
}
/* jump functions */
void jump()
{
Sleep(10); // Sleeps for 10 milliseconds.
keybd_event(KEY9, KEY9SC, 0, 0); // Sends a virtual key press.
Sleep(10); // Sleeps for 10 milliseconds
keybd_event(KEY9, KEY9SC, KEYEVENTF_KEYUP, 0); // Sends a virtual key press.
}
/* Actual bhop function */
void bhop()
{
read.ReadInfo(); // We're gonna be reading from our struct, so we need to read the readInfo function so we can use its variables.
if (GetAsyncKeyState(space_bar) & pressed && read.Flags & 0x1 == 1) jump(); // If user is holding space and flag statement and 0x1 == 1 jump.
// Quoted from Merccy2 why it should be & 0x1 == 1 :)
/*
m_fFlags is a bitmasked value.
The first bit (2 ^ 0 = 1) is the bit that is 1 when you are on the ground.
The second bit (2 ^ 1 = 2) is the bit that is 1 when you are crouching.
If you are checking m_fFlags to 257 it won't work when you are on fire (1 of the bits will change hence changing the complete value).
http://en.wikipedia.org/wiki/Mask_%28computing%29 < Read about it here.
*/
}
If there is any spelling misstakes or a wrong explanation somewhere please add me on skype or post here giving me feedback!
I remember this kind of source code its belong to my friend neither...a lot of changed but originally belong to him....
Originally Posted by COD3RIN
I remember this kind of source code its belong to my friend neither...a lot of changed but originally belong to him....
I wrote it for this source release using stuff @jkfauvel has teached me, it may look like your "friend"s source, but this is no copy paste.
Aswell as using stuff from my External bhop tutorial I made.
Originally Posted by Yemiez
I wrote it for this source release using stuff @jkfauvel has teached me, it may look like your "friend"s source, but this is no copy paste.
Aswell as using stuff from my External bhop tutorial I made.
Ok thanks for feedback keep up in this section..
Quick question, What do u guys use to compile cheats? I always get errors when using Visual Studios 2013's IDE.. And it does not matter what i do, I will always get "Cannot open include file: 'ProcMem.h': No such file or directory", But that name is correct in my #Include and the file itself. Very frustrating.
Originally Posted by ghostmanlinkan
Quick question, What do u guys use to compile cheats? I always get errors when using Visual Studios 2013's IDE.. And it does not matter what i do, I will always get "Cannot open include file: 'ProcMem.h': No such file or directory", But that name is correct in my #Include and the file itself. Very frustrating.
Show screenshot.
Can't post links.. http*:*//i.imgur*.com/8av5*03Y.png
Remove the "*" from the link.
Fixed the ProcMem, It seems. All I did was start a new project.
Originally Posted by ghostmanlinkan
Can't post links.. http*:*//i.imgur*.com/8av5*03Y.png
Remove the "*" from the link.
Fixed the ProcMem, It seems. All I did was start a new project.
Add me on skype not to keep bumping theese posts and i'll help you from there.
Originally Posted by ghostmanlinkan
Quick question, What do u guys use to compile cheats? I always get errors when using Visual Studios 2013's IDE.. And it does not matter what i do, I will always get "Cannot open include file: 'ProcMem.h': No such file or directory", But that name is correct in my #Include and the file itself. Very frustrating.
Ofc you are getting errors.... You need to have ProcMem.h and .cpp on same folder as ur project. Then add it to the project (add -> existing item -> select both cpp and header from ur projects folder)
How can you give new links to pastebin add-on because I personally do not work.
One quick question. Is it safe to use this code and how do you see if a code "is safe"?
Btw: Nice post, keep it up!