Don't forget to press thanks if this helps you out.
Code:
This tutorial is expecting you to have a pre-made source from the site to study off of and add your own hacks to.
Now before we get started you will want to know a few things.
Addresses are the places where your codes/hacks are kept in the memory of your project. (Be it a game, program, or some other kind of file it's the same story when dissasembling.)
Pointers are specific addresses that point to an address in sections of dynamic memory, often in what we call "High Memory" or "DMA" areas. These are the best places for finding new hacks/codes.
Offsets are the ammount of lines in hex the final dynamic address is from wherever the pointer is pointing to. So if you have a pointer address of 0x00709d98 and it points to 010a9980 and the code you want is at say 010a998c then your offset is going to be 0c.
An easier way to describe this is by demonstrating with an actual War Rock cheat. I will be using No Recoil.
No Recoil is a dynamic cheat that has to be made with offsets, witch is why you'll see in the code we add the offsets to the pointer. We will get more into the demonstration as this tutorial continues.
Defining your objects is essential in code/hack making because without knowing where anything is youre game would crash. Like being in a dark building with no light at all and not knowing your surroundings. You're eventually going to trip on something and fall down.
We define our objects using 2 methods. The one you will end up using most is the #define method because it's required for all addresses, pointers, and offsets. So let's define our Player pointer, and our offsets for no recoil.
Code:
// Pointers
#define Playerpointer 0xC62388
// Offsets
#define OFS_NORECOIL1 0x1C
#define OFS_NORECOIL2 0x20
#define OFS_NORECOIL3 0x24
So now that we have them declared successfully at the top of our source code we need to start setting up our code.
There are many ways to make codes, you can use integers, booleans, floats and more. Booleans for those who don't know are simple true and false statements. With hex it would be 00000001 for true and 00000000 for false.
You have to determine witch method to use for writing your code. Do you want a float, integer, or boolean? Well this is usually easier to determine with experience, so we will use proccess of elimination. No this method is not the best way to go because it takes a lot longer. Even the pros guess sometimes though. /
So I will give this one to you because it's already released. It's a float. =P
So first we have to set up our function so we can start writing our code. We do this with the "void" statement.
Code:
void NoRecoil()
{
}
Never forget your brackets they are essential in defining a function.
Next thing we have to do is set up our pointer so the game will know where to go. We do this with the *(DWORD*) method.
Code:
void NoRecoil()
{
DWORD Player = *(DWORD*)Playerpointer;
}
Now that we have our pointer declared we can start our if statement for in activation. With offsets it's usually a greater than 0 statement, or "!= 0".
Code:
void NoRecoil()
{
DWORD Player = *(DWORD*)Playerpointer;
if ( Player != 0 )
{
}
}
Always remember that when putting more than one action or constant into the if statement you need the opening and closing brackets to define it. Now we can start writing our code. Since it's a float it's pretty simple. Floats go by decimal and whole values declared by an "f" like 0.0f is a float value of 0.
So we want a float value of 0 since our code after all is called No Recoil. We have 3 offsets to write this to so we will be writing the same thing for all three offsets. (This isn't always true with offsets, sometimes you have multiple values to write. It all depends on what you want your code to do.)
Code:
void NoRecoil()
{
DWORD Player = *(DWORD*)Playerpointer;
if ( Player != 0 )
{
*(float*)( Player + OFS_NORECOIL1 ) = 0.0f;
*(float*)( Player + OFS_NORECOIL2 ) = 0.0f;
*(float*)( Player + OFS_NORECOIL3 ) = 0.0f;
}
}
Now that we have our pointer and offsets declared, our function written we need to tell the game when to activate it. So I will give you all a function that does this. It's a basic if statement.
Code:
void snip()
{
for(;; )
{
if(*ingame) // Player hacks go here.
{
NoRecoil();
}
if(*outgame) // Server hacks all go in this section.
{
}
Sleep(200); // Prevent overload.
}
}
As you can see by reading the code snippet above I have already placed the function into the ingame section. You must put in game codes into the ingame section and server codes into the outgame section. (A few hint: No Spawn Wait is a server code!) Not all are obvious. Most player pointer codes are in game codes though.
Also, don't forget you need the attatchment proccess and the correctly included sections. Most of the codes/hacks on this site are fairly simple and easy to add. I hope this helps out. Below is the final source!
Code:
#include <stdio.h>
#include <windows.h>
// Pointers
#define Playerpointer 0xC62388
// Offsets
#define OFS_NORECOIL1 0x1C
#define OFS_NORECOIL2 0x20
#define OFS_NORECOIL3 0x24
HANDLE Warrock;
DWORD *ingame= (DWORD*)Playerpointer;
DWORD *outgame= (DWORD*)Serverpointer;
// No Recoil
void NoRecoil()
{
DWORD dwPlayerPtr = *(DWORD*)Playerpointer;
if(dwPlayerPtr != 0)
{
*(float*)(dwPlayerPtr+OFS_NORECOIL1) = 0;
*(float*)(dwPlayerPtr+OFS_NORECOIL2) = 0;
*(float*)(dwPlayerPtr+OFS_NORECOIL3) = 0;
}
}
//Any other hacks you decide to add go above here
//Hack are put into the game here
void snip()
{
for(;; )
{
if(*ingame) // Player hacks go here.
{
NoRecoil();
}
if(*outgame) // Server hacks all go in this section.
{
}
Sleep(200); // Prevent overload.
}
}
BOOL WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
{
if(dwReason == DLL_PROCESS_ATTACH)
{
MessageBoxA(NULL, "DLL was injected successfully.", "SeptFicelle", MB_OK); // Success message.
MessageBoxA(NULL, "Thanks for using my source code. =)", "SeptFicelle", MB_OK); // Thanks message.
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)snip, 0, 0, 0); // Initiate the hack thread.
}
return TRUE;
}
More to be added later. - SeptFicelle