and again they deleted my hack with the reason its packet -_-".. if you mods are not lazy and read the forum.... i had posted like 8 virus scans and it was clearly that the file was save.... im not going to upload it again because the only thing here is Bullshit... waiting 2 days for getting my post deleted -_-"
Well here you guys the Source!
cMain.cpp
Code:
#include "hMain.h"
int Width = 800;
int Height = 600;
const MARGINS Margin = { 0, 0, Width, Height };
char lWindowName[256] = "Basic Overlay - v0.1 - Credits: Grab";
HWND hWnd;
char tWindowName[256] = "Battlefield 4™"; /* tWindowName ? Target Window Name */
HWND tWnd;
RECT tSize;
DWORD pid; //Process ID
HANDLE pHandle; //Process handle
MSG Message;
LRESULT CALLBACK WinProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch (Message)
{
case WM_PAINT:
Render();
break;
case WM_CREATE:
DwmExtendFrameIntoClientArea(hWnd, &Margin);
break;
case WM_DESTROY:
PostQuitMessage(1);
return 0;
default:
return DefWindowProc(hWnd, Message, wParam, lParam);
break;
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hSecInstance, LPSTR nCmdLine, INT nCmdShow)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)SetWindowToTarget, 0, 0, 0);
WNDCLASSEX wClass;
wClass.cbClsExtra = NULL;
wClass.cbSize = sizeof(WNDCLASSEX);
wClass.cbWndExtra = NULL;
wClass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(0, 0, 0));
wClass.hCursor = LoadCursor(0, IDC_ARROW);
wClass.hIcon = LoadIcon(0, IDI_APPLICATION);
wClass.hIconSm = LoadIcon(0, IDI_APPLICATION);
wClass.hInstance = hInstance;
wClass.lpfnWndProc = WinProc;
wClass.lpszClassName = lWindowName;
wClass.lpszMenuName = lWindowName;
wClass.style = CS_VREDRAW | CS_HREDRAW;
if(!RegisterClassEx(&wClass))
exit(1);
tWnd = FindWindow(0, tWindowName);
if (tWnd)
{
GetWindowRect(tWnd, &tSize);
Width = tSize.right - tSize.left;
Height = tSize.bottom - tSize.top;
hWnd = CreateWindowEx(WS_EX_TOPMOST | WS_EX_TRANSPARENT | WS_EX_LAYERED, lWindowName, lWindowName, WS_POPUP, 1, 1, Width, Height, 0, 0, 0, 0);
SetLayeredWindowAttributes(hWnd, 0, 1.0f, LWA_ALPHA);
SetLayeredWindowAttributes(hWnd, 0, RGB(0, 0, 0), LWA_COLORKEY);
ShowWindow( hWnd, SW_SHOW);
//Return to bf4
//ShowWindow(TargetWnd, SW_MAXIMIZE);
SetForegroundWindow(tWnd);
}
DirectXInit(hWnd);
for (;;)
{
if(PeekMessage(&Message, hWnd, 0, 0, PM_REMOVE))
{
DispatchMessage(&Message);
TranslateMessage(&Message);
}
Sleep(1);
}
return 0;
}
void SetWindowToTarget()
{
while(true)
{
tWnd = FindWindow(0, tWindowName);
if (tWnd)
{
GetWindowThreadProcessId(tWnd, &pid);
pHandle = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
GetWindowRect(tWnd, &tSize);
Width = tSize.right - tSize.left;
Height = tSize.bottom - tSize.top;
DWORD dwStyle = GetWindowLong(tWnd, GWL_STYLE);
if(dwStyle & WS_BORDER)
{
tSize.top += 23;
Height -= 23;
}
MoveWindow(hWnd, tSize.left, tSize.top, Width, Height, true);
}
else
{
char ErrorMsg[125];
sprintf(ErrorMsg, "Make sure %s is running!", tWindowName);
MessageBox(0, ErrorMsg, "Error - Cannot find the game!", MB_OK | MB_ICONERROR);
exit(1);
}
Sleep(100);
}
}
cDrawings.cpp
Code:
#include "hDrawings.h"
int DrawString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont)
{
RECT ShadowPos;
ShadowPos.left = x + 1;
ShadowPos.top = y + 1;
RECT FontPos;
FontPos.left = x;
FontPos.top = y;
ifont->DrawTextA(0, String, strlen(String), &ShadowPos, DT_NOCLIP, D3DCOLOR_ARGB(255, r / 3, g / 3, b / 3));
ifont->DrawTextA(0, String, strlen(String), &FontPos, DT_NOCLIP, D3DCOLOR_ARGB(255, r, g, b));
return 0;
}
int DrawShadowString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont)
{
RECT Font;
Font.left = x;
Font.top = y;
RECT Fonts;
Fonts.left = x+1;
Fonts.top = y;
RECT Fonts1;
Fonts1.left = x-1;
Fonts1.top = y;
RECT Fonts2;
Fonts2.left = x;
Fonts2.top = y+1;
RECT Fonts3;
Fonts3.left = x;
Fonts3.top = y-1;
ifont->DrawTextA(0, String, strlen(String), &Fonts3, DT_NOCLIP , D3DCOLOR_ARGB(255, 1, 1, 1));
ifont->DrawTextA(0, String, strlen(String), &Fonts2, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1));
ifont->DrawTextA(0, String, strlen(String), &Fonts1, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1));
ifont->DrawTextA(0, String, strlen(String), &Fonts, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1));
ifont->DrawTextA(0, String, strlen(String), &Font, DT_NOCLIP, D3DCOLOR_ARGB(255, r, g, b));
return 0;
}
void GradientFunc(int x, int y, int w, int h,int r, int g, int b, int a)
{
int iColorr,iColorg,iColorb;
for(int i = 1; i < h; i++)
{
iColorr = (int)((float)i/h*r);
iColorg = (int)((float)i/h*g);
iColorb = (int)((float)i/h*b);
FillRGB(x ,y+ i,w,1,r-iColorr,g-iColorg,b-iColorb,a);
}
}
void DrawLine(float x, float y, float xx, float yy, int r, int g, int b, int a)
{
D3DXVECTOR2 dLine[2];
p_Line->SetWidth( 1 );
dLine[0].x = x;
dLine[0].y = y;
dLine[1].x = xx;
dLine[1].y = yy;
p_Line->Draw( dLine, 2, D3DCOLOR_ARGB(a, r , g, b));
}
void FillRGB(float x, float y, float w, float h, int r, int g, int b, int a)
{
D3DXVECTOR2 vLine[2];
p_Line->SetWidth( w );
vLine[0].x = x + w/2;
vLine[0].y = y;
vLine[1].x = x + w/2;
vLine[1].y = y + h;
p_Line->Begin( );
p_Line->Draw( vLine, 2, D3DCOLOR_RGBA( r, g, b, a ) );
p_Line->End( );
}
void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a)
{
D3DXVECTOR2 points[5];
points[0] = D3DXVECTOR2(x, y);
points[1] = D3DXVECTOR2(x+width, y);
points[2] = D3DXVECTOR2(x+width, y+height);
points[3] = D3DXVECTOR2(x, y+height);
points[4] = D3DXVECTOR2(x, y);
p_Line->SetWidth(1);
p_Line->Draw(points, 5, D3DCOLOR_RGBA(r, g, b, a));
}
void DrawGUIBox(float x, float y, float w, float h, int r, int g, int b, int a, int rr, int gg, int bb, int aa)
{
DrawBox(x,y,w,h, 1,r ,g ,b ,a);
FillRGB(x,y,w,h,rr,gg,bb,a);
}
void DrawHealthBar(float x, float y, float w, float h, int r, int g)
{
FillRGB(x,y,w,h,r,g,0,255);
}
void DrawHealthBarBack(float x, float y, float w, float h)
{
FillRGB(x,y,w,h,0,0,0,255);
}
void DrawCenterLine(float x, float y, int width, int r, int g, int b)
{
D3DXVECTOR2 dPoints[2];
dPoints[0] = D3DXVECTOR2(x, y);
dPoints[1] = D3DXVECTOR2(Width / 2, Height);
p_Line->SetWidth(width);
p_Line->Draw(dPoints, 2, D3DCOLOR_RGBA(r, g, b, 255));
}
cDirectX.cpp
Code:
#include "hDirectX.h"
#include "cCheats.h"
IDirect3D9Ex* p_Object = 0;
IDirect3DDevice9Ex* p_Device = 0;
D3DPRESENT_PARAMETERS p_Params;
ID3DXLine* p_Line;
ID3DXFont* pFontSmall = 0;
Player pPlayer;
LocalPlayer lPlayer;
char cDist[300];
int r, g, b;
int DirectXInit(HWND hWnd)
{
if(FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, &p_Object)))
exit(1);
ZeroMemory(&p_Params, sizeof(p_Params));
p_Params.Windowed = TRUE;
p_Params.SwapEffect = D3DSWAPEFFECT_DISCARD;
p_Params.hDeviceWindow = hWnd;
p_Params.MultiSampleQuality = D3DMULTISAMPLE_NONE;
p_Params.BackBufferFormat = D3DFMT_A8R8G8B8 ;
p_Params.BackBufferWidth = Width;
p_Params.BackBufferHeight = Height;
p_Params.EnableAutoDepthStencil = TRUE;
p_Params.AutoDepthStencilFormat = D3DFMT_D16;
if(FAILED(p_Object->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &p_Params, 0, &p_Device)))
exit(1);
if(!p_Line)
D3DXCreateLine(p_Device, &p_Line);
//p_Line->SetAntialias(1); *removed cuz crosshair was blurred*
D3DXCreateFont(p_Device, 18, 0, 0, 0, false, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Calibri", &pFontSmall);
return 0;
}
int Render()
{
p_Device->Clear(0, 0, D3DCLEAR_TARGET, 0, 1.0f, 0);
p_Device->BeginScene();
if(tWnd == GetForegroundWindow())
{
//text with shadow
DrawShadowString("*************.me - ESP SRC", 10, 10, 240, 240, 250, pFontSmall);
if (updateFromGameContext() && readLocalPlayer(&lPlayer))
{
updateMatrices();
noRecoil(&lPlayer);
//Loop for each player
for (int i = 0; i < 64; i++)
{
if (readPlayer(&pPlayer, i))
{
if (pPlayer.clientSoldier == lPlayer.clientSoldier) continue;
float Distance = GetDistance(&pPlayer, &lPlayer);
if (pPlayer.m_teamId == lPlayer.m_teamId)
{
r = 0; g = 255;
}
else
{
r = 255; g = 0;
}
D3DXVECTOR3 vOut;
if (!worldToScreen(pPlayer.position, &vOut))
continue;
D3DXVECTOR3 screenPosl, screenPosr;
float anglex = XAngle(lPlayer.position.x, lPlayer.position.z, pPlayer.position.x, pPlayer.position.z, 0);
float posl[4], posr[4];
RotatePointAlpha(posl, -0.5, 0, 1.7, 0, 0, 0, -anglex + 90);
RotatePointAlpha(posr, 0.5, 0, 0, 0, 0, 0, -anglex + 90);
D3DXVECTOR3 vposl, vposr;
vposl.x = pPlayer.position.x + posl[0];
vposl.y = pPlayer.position.y + posl[2];
vposl.z = pPlayer.position.z + posl[1];
vposr.x = pPlayer.position.x + posr[0];
vposr.y = pPlayer.position.y + posr[2];
vposr.z = pPlayer.position.z + posr[1];
if (!worldToScreen(vposl, &screenPosl)) continue;
if (!worldToScreen(vposr, &screenPosr)) continue;
float w = abs(screenPosr.x - screenPosl.x);
float h = abs(screenPosl.y - screenPosr.y);
float x = screenPosr.x;
float y = screenPosl.y;
DrawBox(x, y, w, h, 2,r,g,0,255);
sprintf(cDist, "Distance: %f", Distance);
DrawString(cDist, x, y - 15, 0, 255, 0, pFontSmall);
DrawHealthBarBack(x, y - 25, 51, 6);
DrawHealthBar(x, y - 25, pPlayer.health / 2,5,0,200);
}
}
}
//crosshair
FillRGB(Width / 2 - 22, Height / 2, 44, 1, 240, 240, 250, 255);
FillRGB(Width / 2, Height / 2 - 22, 1, 44, 240, 240, 250, 255);
}
p_Device->EndScene();
p_Device->PresentEx(0, 0, 0, 0, 0);
return 0;
}
cCheats.cpp
Code:
#include "cCheats.h"
DWORD_PTR m_GameContext;
DWORD_PTR m_ClientPlayerManager;
DWORD_PTR idToPlayerMapOffset;
//World2Screen
D3DXMATRIXA16 viewProjecti********;
DWORD_PTR RenderView;
DWORD_PTR GameRenderer;
DWORD_PTR buffer;
bool recoil = 0;
static bool IsValid(DWORD_PTR ptr)
{
if (ptr && HIWORD(ptr) != NULL)
return true;
return false;
}
void RotatePointAlpha(float *outV, float x, float y, float z, float cx, float cy, float cz, float alpha)
{
D3DXMATRIX rot1;
::D3DXVECTOR4 vec;
vec.x = x - cx;
vec.z = y - cy;
vec.y = z - cz;
vec.w = 1.0;
::D3DXMatrixRotationY(&rot1, alpha*D3DX_PI / 180.0);
::D3DXVec4Transform(&vec, &vec, &rot1);
outV[0] = vec.x + cx;
outV[1] = vec.z + cy;
outV[2] = vec.y + cz;
};
float XAngle(float x1, float y1, float x2, float y2, float myangle)
{
float dl = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
if (dl == 0)dl = 1.0;
float dl2 = abs(x2 - x1);
float teta = ((180.0 / D3DX_PI)*acos(dl2 / dl));
if (x2<x1)teta = 180 - teta;
if (y2<y1)teta = teta*-1.0;
teta = teta - myangle;
if (teta>180.0)teta = (360.0 - teta)*(-1.0);
if (teta<-180.0)teta = (360.0 + teta);
return teta;
}
float GetDistance(Player* pPlayer, LocalPlayer* localPlayer)
{
float xD = pPlayer->position.x - localPlayer->position.x;
float yD = pPlayer->position.y - localPlayer->position.y;
float zD = pPlayer->position.z - localPlayer->position.z;
return sqrt(xD * xD + yD * yD + zD * zD);
}
bool updateFromGameContext() // Update offset, from the ClientGameContext
{
ReadProcessMemory(pHandle, (void*)(OFFSET_CLIENTGAMECONTEXT), &m_GameContext, sizeof(DWORD_PTR), NULL);
if (!IsValid(m_GameContext)) return false;
ReadProcessMemory(pHandle, (void*)(m_GameContext + 0x60), &m_ClientPlayerManager, sizeof(DWORD_PTR), NULL); //ClientPlayerManager
if (!IsValid(m_ClientPlayerManager)) return false;
ReadProcessMemory(pHandle, (void*)(m_ClientPlayerManager + 0x2A8), &idToPlayerMapOffset, sizeof(DWORD_PTR), NULL);
if (!IsValid(idToPlayerMapOffset)) return false;
return true;
}
bool readPlayer(Player* pPlayer, int id) //Read Player with his id, if player isn't valid return false.
{
memset(pPlayer, 0, sizeof(pPlayer));
ReadProcessMemory(pHandle, (void*)(idToPlayerMapOffset + (id * 0x8)), &pPlayer->clientPlayer, sizeof(DWORD_PTR), NULL);
if (!IsValid(pPlayer->clientPlayer)) return false;
ReadProcessMemory(pHandle, (void*)(pPlayer->clientPlayer + 0x40), &pPlayer->Name, sizeof(pPlayer->Name), NULL);
ReadProcessMemory(pHandle, (void*)(pPlayer->clientPlayer + 0x0DC0), &pPlayer->clientSoldier, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(pPlayer->clientPlayer + 0x0CBC), &pPlayer->m_teamId, sizeof(pPlayer->m_teamId), NULL);
if (!IsValid(pPlayer->clientSoldier)) return false;
ReadProcessMemory(pHandle, (void*)(pPlayer->clientSoldier + 0x591), &pPlayer->isOccluded, sizeof(BYTE), NULL);
ReadProcessMemory(pHandle, (void*)(pPlayer->clientSoldier + 0x490), &pPlayer->clientReplication, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(pPlayer->clientSoldier + 0x0140), &pPlayer->healthcomponent, sizeof(DWORD_PTR), NULL);
if (!IsValid(pPlayer->healthcomponent)) return false;
ReadProcessMemory(pHandle, (void*)(pPlayer->healthcomponent + 0x0020), &pPlayer->health, sizeof(pPlayer->health), NULL);
if (!IsValid(pPlayer->clientReplication)) return false;
ReadProcessMemory(pHandle, (void*)(pPlayer->clientReplication + 0x30), &pPlayer->position, sizeof(D3DXVECTOR3), NULL);
ReadProcessMemory(pHandle, (void*)(pPlayer->clientReplication + 0x50), &pPlayer->velocity, sizeof(D3DXVECTOR3), NULL);
ReadProcessMemory(pHandle, (void*)(pPlayer->clientReplication + 0x80), &pPlayer->state, sizeof(pPlayer->state), NULL);
return true;
}
bool readLocalPlayer(LocalPlayer* localPlayer)
{
memset(localPlayer, 0, sizeof(localPlayer));
ReadProcessMemory(pHandle, (void*)(m_ClientPlayerManager + 0x2A0), &localPlayer->clientPlayer, sizeof(DWORD_PTR), NULL);
if (!IsValid(localPlayer->clientPlayer)) return false;
ReadProcessMemory(pHandle, (void*)(localPlayer->clientPlayer + 0x40), &localPlayer->Name, sizeof(localPlayer->Name), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientPlayer + 0x0DC0), &localPlayer->clientSoldier, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientPlayer + 0x0CBC), &localPlayer->m_teamId, sizeof(localPlayer->m_teamId), NULL);
if (!IsValid(localPlayer->clientSoldier)) return false;
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x490), &localPlayer->clientReplication, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x0140), &localPlayer->healthcomponent, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x4D8), &localPlayer->flYaw, sizeof(FLOAT), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x4DC), &localPlayer->flPitch, sizeof(FLOAT), NULL);
if (!IsValid(localPlayer->healthcomponent)) return false;
ReadProcessMemory(pHandle, (void*)(localPlayer->healthcomponent + 0x0020), &localPlayer->health, sizeof(localPlayer->health), NULL);
if (!IsValid(localPlayer->clientReplication)) return false;
ReadProcessMemory(pHandle, (void*)(localPlayer->clientReplication + 0x30), &localPlayer->position, sizeof(D3DXVECTOR3), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientReplication + 0x50), &localPlayer->velocity, sizeof(D3DXVECTOR3), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientReplication + 0x80), &localPlayer->state, sizeof(localPlayer->state), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->clientSoldier + 0x0550), &localPlayer->m_soldierWeaponsComponent, sizeof(DWORD_PTR), NULL);
if (IsValid(localPlayer->m_soldierWeaponsComponent))
ReadProcessMemory(pHandle, (void*)(localPlayer->m_soldierWeaponsComponent + 0x09A8), &localPlayer->activeSlot, sizeof(localPlayer->activeSlot), NULL);
ReadProcessMemory(pHandle, (void*)(localPlayer->m_soldierWeaponsComponent + 0x07A0), &localPlayer->m_currentAnimatedWeaponHandler, sizeof(DWORD_PTR), NULL);
if (IsValid(localPlayer->m_currentAnimatedWeaponHandler))
ReadProcessMemory(pHandle, (void*)(localPlayer->m_currentAnimatedWeaponHandler + localPlayer->activeSlot * 0x8), &localPlayer->m_clientSoldierWeapon, sizeof(DWORD_PTR), NULL);
if (IsValid(localPlayer->m_clientSoldierWeapon))
ReadProcessMemory(pHandle, (void*)(localPlayer->m_clientSoldierWeapon + 0x49c0), (void*)&localPlayer->m_correctedFiring, sizeof(DWORD_PTR), NULL);
if (IsValid(localPlayer->m_correctedFiring))
ReadProcessMemory(pHandle, (void*)(localPlayer->m_correctedFiring + 0x78), (void*)&localPlayer->m_weaponSway, sizeof(DWORD_PTR), NULL);
return true;
}
void noRecoil(LocalPlayer* localPlayer)
{
if (IsValid(localPlayer->m_weaponSway) && (localPlayer->activeSlot == 0 || localPlayer->activeSlot == 1))
WriteProcessMemory(pHandle, (void*)(localPlayer->m_weaponSway + 0x1E8), &recoil, sizeof(bool), NULL);
}
void updateMatrices()
{
ReadProcessMemory(pHandle, (void*)(OFFSET_GAMERENDERER), &GameRenderer, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(GameRenderer + 0x60), &RenderView, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(RenderView + 0x420), &viewProjecti********, sizeof(viewProjecti********), NULL);
}
bool worldToScreen(D3DXVECTOR3 vWorldLocationVec3, D3DXVECTOR3* vOut)
{
unsigned int screenWidth, screenHeight;
ReadProcessMemory(pHandle, (void*)(OFFSET_DXRENDERER), &buffer, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(buffer + 0x38), &buffer, sizeof(DWORD_PTR), NULL);
ReadProcessMemory(pHandle, (void*)(buffer + 0x28), &screenWidth, sizeof(screenWidth), NULL);
ReadProcessMemory(pHandle, (void*)(buffer + 0x2C), &screenHeight, sizeof(screenHeight), NULL);
float mX = screenWidth * 0.5f;
float mY = screenHeight * 0.5f;
float w =
viewProjecti********(0, 3) * vWorldLocationVec3.x +
viewProjecti********(1, 3) * vWorldLocationVec3.y +
viewProjecti********(2, 3) * vWorldLocationVec3.z +
viewProjecti********(3, 3);
if (w < 0.65f)
{
vOut->z = w;
return false;
}
float x =
viewProjecti********(0, 0) * vWorldLocationVec3.x +
viewProjecti********(1, 0) * vWorldLocationVec3.y +
viewProjecti********(2, 0) * vWorldLocationVec3.z +
viewProjecti********(3, 0);
float y =
viewProjecti********(0, 1) * vWorldLocationVec3.x +
viewProjecti********(1, 1) * vWorldLocationVec3.y +
viewProjecti********(2, 1) * vWorldLocationVec3.z +
viewProjecti********(3, 1);
vOut->x = mX + mX * x / w;
vOut->y = mY - mY * y / w;
vOut->z = w;
return true;
}
hMain.h
Code:
#ifndef HMAIN_H
#define HMAIN_H
#include "hDirectX.h"
#include <Windows.h>
#include <iostream>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#include <dwmapi.h>
#pragma comment(lib, "dwmapi.lib")
extern int Width;
extern int Height;
extern char lWindowName[256];
extern HWND hWnd;
extern char tWindowName[256];
extern HWND tWnd;
extern RECT tSize;
extern MSG Message;
extern bool Debug_Border;
extern HANDLE pHandle;
LRESULT CALLBACK WinProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hSecInstance, LPSTR nCmdLine, INT nCmdShow);
void SetWindowToTarget();
#endif
hDrawings.h
Code:
#ifndef HDRAWFUNC_H
#define HDRAWFUNC_H
#include "hDirectX.h"
#pragma warning( disable : 4244 ) //remove the incoming warns
#pragma warning( disable : 4996 ) //remove the incoming warns
#include <d3dx9.h>
#include <d3d9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
void GradientFunc(int x, int y, int w, int h,int r, int g, int b, int a);
void DrawCenterLine(float x, float y, int r, int g, int b, int a);
void DrawLine(float x, float y, float xx, float yy, int r, int g, int b, int a);
void FillRGB(float x, float y, float w, float h, int r, int g, int b, int a);
void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a);
void DrawGUIBox(float x, float y, float w, float h, int r, int g, int b, int a, int rr, int gg, int bb, int aa);
void DrawHealthBar(float x, float y, float w, float h, int r, int g);
void DrawHealthBarBack(float x, float y, float w, float h);
int DrawString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont);
int DrawShadowString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont);
#endif
hDirectX.h
Code:
#ifndef HDIRECTX_H
#define HDIRECTX_H
#include "hMain.h"
#include "hDrawings.h"
#include <Windows.h>
#include <iostream>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#include <dwmapi.h>
#pragma comment(lib, "dwmapi.lib")
extern IDirect3D9Ex* p_Object;
extern IDirect3DDevice9Ex* p_Device;
extern D3DPRESENT_PARAMETERS p_Params;
extern ID3DXLine* p_Line;
extern ID3DXFont* pFontSmall;
int DirectXInit(HWND hWnd);
int Render();
#endif
cCheats.h
Code:
#ifndef CHEATS_H
#define CHEATS_H
#include "hMain.h"
#include "hDrawings.h"
#include <Windows.h>
#include <iostream>
#include <d3d9.h>
#include <d3dx9.h>
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
#include <dwmapi.h>
#pragma comment(lib, "dwmapi.lib")
#define OFFSET_CLIENTGAMECONTEXT 0x142384108
#define OFFSET_DXRENDERER 0x14242F488
#define OFFSET_GAMERENDERER 0x142385028
#define OFFSET_ANGLES 0x1420C4AB0
#define OFFSET_WORLDRENDERSETTINGS 0x142384188
class Player
{
public:
//Client Player
DWORD_PTR clientPlayer;
char Name[0x10];
unsigned int m_teamId;
//ClientControllableEntity
DWORD_PTR clientSoldier;
BYTE isOccluded;
//ClientSoldierReplication
DWORD_PTR clientReplication;
D3DXVECTOR3 position;
D3DXVECTOR3 velocity;
int state;
//LifeModule
DWORD_PTR healthcomponent;
FLOAT health;
};
class LocalPlayer : public Player
{
public:
float flYaw;
float flPitch;
//Weapon
DWORD_PTR m_soldierWeaponsComponent;
DWORD_PTR m_currentAnimatedWeaponHandler;
DWORD_PTR m_clientSoldierWeapon;
DWORD_PTR m_correctedFiring;
DWORD_PTR m_weaponSway;
INT activeSlot;
};
bool updateFromGameContext();
bool readPlayer(Player* pPlayer, int id);
bool readLocalPlayer(LocalPlayer* localPlayer);
float GetDistance(Player* pPlayer, LocalPlayer* localPlayer);
void noRecoil(LocalPlayer* localPlayer);
//ESP
void updateMatrices();
bool worldToScreen(D3DXVECTOR3 vWorldLocationVec3, D3DXVECTOR3* vOut);
float XAngle(float x1, float y1, float x2, float y2, float myangle);
void RotatePointAlpha(float *outV, float x, float y, float z, float cx, float cy, float cz, float alpha);
#endif
Enjoy!