πŸ˜‰ C++ Bunny Hop & Trigger Source

Posts 1–3 of 3 Β· Page 1 of 1
πŸ˜‰ C++ Bunny Hop & Trigger Source
Here is a working Bunnyhop and Trigger hack,if you have the right Offsets, if not, dump the game =D

Code:
		if (bhopstatus == true)
		{
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_PlayerBase), &__dw_LocalPlayer, sizeof(DWORD), NULL);

			ReadProcessMemory(fProcess.__HandleProcess, (void *)(__dw_LocalPlayer + __dw_flagsoff), &__by_flagsstat, sizeof(BYTE), NULL);

			if (bhopstatus == true && (GetAsyncKeyState(VK_SPACE)))
			{

				if (__by_flagsstat == 1 || __by_flagsstat == 3 || __by_flagsstat == 5 || __by_flagsstat == 7)
				{
					WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_jumpstatoff), &btrue,  sizeof(bool), NULL);
					Sleep(60);
					WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_jumpstatoff), &bfalse, sizeof(bool), NULL);
				}

			}
		}
And here the Trigger
Code:
		if (btriggerHack == true)
		{
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_PlayerBase), &__dw_LocalPlayer, sizeof(DWORD), NULL);
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(__dw_LocalPlayer + __dwHealthOffset), &LocalPlayerHealth, sizeof(DWORD), NULL);
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(__dw_LocalPlayer + __dwTeamOffset), &LocalTeam, sizeof(DWORD), NULL);
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(__dw_LocalPlayer + __dwCrosshairOffset), &CrosshairID, sizeof(DWORD), NULL);
			ReadProcessMemory(fProcess.__HandleProcess, (void *)((fProcess.__dwordClient + __dwEnemyBase + ((CrosshairID - 1) * __dwEntityLoop))), &EnemyInCH, sizeof(DWORD), NULL);
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(EnemyInCH + __dwHealthOffset), &EnemyCrosshairHealth, sizeof(DWORD), NULL);
			ReadProcessMemory(fProcess.__HandleProcess, (void *)(EnemyInCH + __dwTeamOffset), &EnemyCrosshairTeam, sizeof(DWORD), NULL);

			if (LocalTeam != EnemyCrosshairTeam && EnemyCrosshairHealth > 0)
			{
				WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dwAttack), &btrue, sizeof(bool), NULL);
				Sleep(60);
				WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dwAttack), &bfalse, sizeof(bool), NULL);
			}
		}
If there are some questions, only comment this thread
/Moved to the correct section.
Quote Originally Posted by xShouty View Post
Here is a working Bunnyhop and Trigger hack
The code you provided yet alone isn't working, it will give compiler errors. You are not including the buffers you're saving your read data from ReadProcessMemory.
Also, you are not checking if ReadProcessMemory succeeded or not.

A few concerns regarding your code.

Quote Originally Posted by xShouty View Post
[CODE]if (bhopstatus == true)
An if statement get's executed if the condition within the brackets evaluate to true. This means that if a boolean is true, you can just check it with
Code:
if ( MyBool )
The boolean is true, resulting in the condition to evaluate to true. No need for the ugly MyBool == true. If you want to check if the boolean is false, you cpuld check it like this

Code:
if ( MyBool != true )
or, easier and cleaner

Code:
if ( !MyBool )
Code:
ReadProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_PlayerBase), &__dw_LocalPlayer, sizeof(DWORD), NULL);
You are not checking whether ReadProcessMemory succeeded or not. You can do this in 2 ways. You can check the return value of ReadProcessMemory, which is a BOOL ( not a bool! ). A bool is 1 byte long, a BOOL is 4 bytes long. If ReadProcessMemory succeeded, it returns a nonzero value. The other way is to check the last parameter of ReadProcessMemory, which will be equal to the amount of bytes ReadProcessMemory has read. To make your life a little bit easier, you can create a wrapper function for your ReadProcessMemory calls. This way, you don't have to type out the entire ReadProcessMemory call everytime you want to use it.

Example:

Code:
template< class Type >
bool Read( DWORD Address, Type* Buffer )
{
	auto BytesRead = SIZE_T( );

	return ReadProcessMemory( *Process->GetHandle( ), reinterpret_cast< LPCVOID >( Address ), Buffer, sizeof( Type ), &BytesRead ) && BytesRead == sizeof( Type );
}
You can use it like this:

Code:
auto Flags = BYTE( );

if ( Read< BYTE >( Base + Offset, &Flags ) )
	// Successful
else
	// Failed
Code:
if (bhopstatus == true && (GetAsyncKeyState(VK_SPACE)))
Again, you are checking for bhopstatus == true, which is unnecessary. The brackets around the GetAsyncKeyState call are unnecessary aswell.
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.

Code:
if (__by_flagsstat == 1 || __by_flagsstat == 3 || __by_flagsstat == 5 || __by_flagsstat == 7)
If you think about what you are doing there, you can resolve this much easier.
Let's convert each number into bits.

1 - 00000001
3 - 00000011
5 - 00000101
7 - 00000111

Now let's take a look at what's the same every time. Exactly, the very first bit ( the one on the right ). You are essentially checking if the very first bit is set. You can do this much easier by bitmasking the result by 1.

Code:
if ( __by_flagsstat & 1 )
	// Player is currently on the ground
Code:
WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_jumpstatoff), &btrue,  sizeof(bool), NULL);
Sleep(60);
WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_jumpstatoff), &bfalse, sizeof(bool), NULL);
The memory you are writing to here is not 1 byte long, it's an integer. When you look into how CSGO handles those movement key states, you notice that jump is set to 4 when you are not jumping, and set to 5 when you are pressing the jump key. When you are scrolling the mouse however, jump gets set to 6, which presses the jump key once and releases it right after.

This being said, all you have to do is

Code:
WriteProcessMemory(fProcess.__HandleProcess, (void *)(fProcess.__dwordClient + __dw_jumpstatoff), 6,  sizeof(int), NULL);
without the need of a sleep statement between 2 WriteProcessMemory calls. The same principle can be used for your attack in your triggerbot.

Also, you can create another wrapper function for WriteProcessMemory.

Code:
ReadProcessMemory(fProcess.__HandleProcess, (void *)(__dw_LocalPlayer + __dwHealthOffset), &LocalPlayerHealth, sizeof(DWORD), NULL);
This isn't necessarily wrong, however, you should always use the type the game is using. Healthvalues aren't stored as a DWORD ( which is typedefined as unsigned int, so it doesn't really matter ), they are stored as ints.
Posts 1–3 of 3 Β· Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us