├── README.md ├── common.h ├── DirectX.h ├── Drawing.h ├── DirectX.cpp ├── World.hpp ├── ExternalDayZ.cpp ├── Drawing.cpp ├── Utils.hpp └── Hack.cpp /README.md: -------------------------------------------------------------------------------- 1 | # ExternalDayZ 2 | DayZ Hack 3 | 4 | -Player, Loot, Object ESP, tents, etc. 5 | 6 | -Speedhack 7 | 8 | -Daylight hack (always day). 9 | 10 | -Teleporting bullets functionality available. 11 | -------------------------------------------------------------------------------- /common.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "DirectX.h" 4 | 5 | #pragma warning(disable:4996) 6 | 7 | LRESULT CALLBACK WinProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); 8 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hSecInstance, LPSTR nCmdLine, INT nCmdShow); 9 | void SetWindowToTarget(); -------------------------------------------------------------------------------- /DirectX.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Drawing.h" 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #pragma comment(lib, "d3d9.lib") 11 | #pragma comment(lib, "d3dx9.lib") 12 | 13 | #include 14 | #pragma comment(lib, "dwmapi.lib") 15 | 16 | extern IDirect3D9Ex* p_Object; 17 | extern IDirect3DDevice9Ex* p_Device; 18 | extern D3DPRESENT_PARAMETERS p_Params; 19 | extern ID3DXLine* p_Line; 20 | extern ID3DXFont* pFontSmall; 21 | 22 | int DirectXInit(HWND hWnd); 23 | int Render(); 24 | void Hack(); -------------------------------------------------------------------------------- /Drawing.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "DirectX.h" 3 | 4 | #pragma warning( disable : 4244 ) //remove the incoming warns 5 | #pragma warning( disable : 4996 ) //remove the incoming warns 6 | 7 | #include 8 | #include 9 | #pragma comment(lib, "d3d9.lib") 10 | #pragma comment(lib, "d3dx9.lib") 11 | 12 | void GradientFunc(int x, int y, int w, int h, int r, int g, int b, int a); 13 | void DrawCenterLine(float x, float y, int r, int g, int b, int a); 14 | void DrawLine(float x, float y, float xx, float yy, int r, int g, int b, int a); 15 | void FillRGB(float x, float y, float w, float h, int r, int g, int b, int a); 16 | void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a); 17 | 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); 18 | void DrawHealthBar(float x, float y, float w, float h, int r, int g); 19 | void DrawHealthBarBack(float x, float y, float w, float h); 20 | 21 | int DrawString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont); 22 | int DrawShadowString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont); -------------------------------------------------------------------------------- /DirectX.cpp: -------------------------------------------------------------------------------- 1 | #include "DirectX.h" 2 | 3 | 4 | IDirect3D9Ex* p_Object = 0; 5 | IDirect3DDevice9Ex* p_Device = 0; 6 | D3DPRESENT_PARAMETERS p_Params; 7 | 8 | ID3DXLine* p_Line; 9 | ID3DXFont* pFontSmall = 0; 10 | 11 | extern int Width; 12 | extern int Height; 13 | extern char lWindowName[256]; 14 | extern HWND hWnd; 15 | extern char tWindowName[256]; 16 | extern HWND tWnd; 17 | extern RECT tSize; 18 | extern MSG Message; 19 | extern bool Debug_Border; 20 | 21 | int DirectXInit(HWND hWnd) 22 | { 23 | if (FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, &p_Object))) 24 | exit(1); 25 | 26 | ZeroMemory(&p_Params, sizeof(p_Params)); 27 | p_Params.Windowed = TRUE; 28 | p_Params.SwapEffect = D3DSWAPEFFECT_DISCARD; 29 | p_Params.hDeviceWindow = hWnd; 30 | p_Params.MultiSampleQuality = D3DMULTISAMPLE_NONE; 31 | p_Params.BackBufferFormat = D3DFMT_A8R8G8B8; 32 | p_Params.BackBufferWidth = Width; 33 | p_Params.BackBufferHeight = Height; 34 | p_Params.EnableAutoDepthStencil = TRUE; 35 | p_Params.AutoDepthStencilFormat = D3DFMT_D16; 36 | p_Params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; 37 | 38 | if (FAILED(p_Object->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &p_Params, 0, &p_Device))) 39 | exit(1); 40 | 41 | if (!p_Line) 42 | D3DXCreateLine(p_Device, &p_Line); 43 | 44 | D3DXCreateFont(p_Device, 16, 0, 0, 0, false, DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &pFontSmall); 45 | 46 | return 0; 47 | } 48 | 49 | int Render() 50 | { 51 | p_Device->Clear(0, 0, D3DCLEAR_TARGET, 0, 1.0f, 0); 52 | p_Device->BeginScene(); 53 | 54 | if (tWnd == GetForegroundWindow()) 55 | { 56 | Hack(); 57 | //text with shadow 58 | 59 | 60 | //text without shadow 61 | //DrawString("Greetings", 5, 15, 240, 240, 250, pFontSmall); 62 | 63 | //colored rects 64 | //FillRGB(30, 40, 10, 10, 255, 0, 0, 155); 65 | //FillRGB(30, 60, 10, 10, 0, 255, 0, 155); 66 | //FillRGB(30, 80, 10, 10, 0, 0, 255, 155); 67 | 68 | //crosshair 69 | //FillRGB(Width / 2 - 22, Height / 2, 44, 1, 240, 240, 250, 255); 70 | // FillRGB(Width / 2, Height / 2 - 22, 1, 44, 240, 240, 250, 255); 71 | } 72 | 73 | p_Device->EndScene(); 74 | p_Device->PresentEx(0, 0, 0, 0, 0); 75 | return 0; 76 | } 77 | -------------------------------------------------------------------------------- /World.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Utils.hpp" 3 | #include 4 | 5 | #pragma comment(lib, "DriverController.lib") 6 | using namespace DriverControl; 7 | 8 | DriverController driver("DayZ_x64.exe"); 9 | 10 | class World 11 | { 12 | public: 13 | World() 14 | { 15 | this->modulebase = driver.GetModuleBase("DayZ_x64.exe"); 16 | std::cout << std::hex << this->modulebase << std::endl << std::endl; 17 | } 18 | 19 | uintptr_t GetLocalEntity(); 20 | TransData GetTransData(); 21 | Vec3 GetVisualState(uintptr_t entity); 22 | Vec3 GetObjectVisualState(uintptr_t entity); 23 | 24 | uintptr_t modulebase = NULL; 25 | uintptr_t dw_world = 0xDEA710; 26 | uintptr_t dw_network_manager = 0xD96A70; 27 | uintptr_t dw_playerOn = 0x2890; 28 | uintptr_t dw_camera = 0x1B8; 29 | uintptr_t dw_manVisualState = 0x88; 30 | uintptr_t dw_objectVisualState = 0x130; 31 | uintptr_t dw_networkId = 0x588; 32 | uintptr_t dw_NearEntityTable = 0xE90; 33 | uintptr_t dw_FarEntityTable = 0xFD8; 34 | uintptr_t dw_bulletTable = 0xD48; 35 | uintptr_t dw_ItemsOnGround = 0x1F90; 36 | //uintptr_t dw_ItemsOnGround = 0x1f78; 37 | //uintptr_t dw_itemName = 0x618; //dereference as char* 38 | private: 39 | //Near Entity Table = 0xE78; // Size = 0xE80 40 | //Further = 0xFC0 41 | // 42 | }; 43 | 44 | 45 | uintptr_t World::GetLocalEntity() 46 | { 47 | uintptr_t dwWorld = driver.rpm(this->modulebase + this->dw_world); 48 | if (dwWorld) 49 | { 50 | uintptr_t playerOn = driver.rpm(dwWorld + this->dw_playerOn); 51 | if (playerOn) 52 | { 53 | uintptr_t entity = driver.rpm(playerOn + 0x8); 54 | if (entity) 55 | { 56 | return entity; 57 | } 58 | } 59 | } 60 | return NULL; 61 | } 62 | 63 | TransData World::GetTransData() 64 | { 65 | uintptr_t dwWorld = driver.rpm(this->modulebase + this->dw_world); 66 | if (dwWorld) 67 | { 68 | uintptr_t camera = driver.rpm(dwWorld + this->dw_camera); 69 | 70 | if (camera) 71 | { 72 | TransData transData = driver.rpm(camera); 73 | return transData; 74 | } 75 | } 76 | 77 | TransData data; 78 | return data; 79 | } 80 | 81 | Vec3 World::GetVisualState(uintptr_t entity) 82 | { 83 | if (entity) 84 | { 85 | uintptr_t renderVisualState = driver.rpm(entity + this->dw_objectVisualState); 86 | 87 | if (renderVisualState) 88 | { 89 | Vec3 pos = driver.rpm(renderVisualState + 0x2C); 90 | return pos; 91 | } 92 | } 93 | 94 | return Vec3(-1, -1, -1); 95 | } 96 | 97 | Vec3 World::GetObjectVisualState(uintptr_t entity) 98 | { 99 | if (entity) 100 | { 101 | uintptr_t renderVisualState = driver.rpm(entity + this->dw_objectVisualState); 102 | 103 | if (renderVisualState) 104 | { 105 | Vec3 pos = driver.rpm(renderVisualState + 0x2C); 106 | return pos; 107 | } 108 | } 109 | 110 | return Vec3(-1, -1, -1); 111 | } -------------------------------------------------------------------------------- /ExternalDayZ.cpp: -------------------------------------------------------------------------------- 1 | #include "common.h" 2 | 3 | int Width = 1920; 4 | int Height = 1080; 5 | char lWindowName[256] = "saud3289ujdisadj9832jdiosakda"; 6 | HWND hWnd; 7 | char tWindowName[256] = "DayZ"; 8 | HWND tWnd; 9 | RECT tSize; 10 | MSG Message; 11 | bool Debug_Border; 12 | 13 | const MARGINS Margin = { 0, 0, Width, Height }; 14 | 15 | void WINAPI ConsoleInit() 16 | { 17 | if (!AllocConsole()) return; 18 | 19 | char* input = (char*)malloc(256); 20 | //ZeroMemory() 21 | memset(input, 0, sizeof(input)); 22 | 23 | SetConsoleTitle("Console"); 24 | freopen("CONIN$", "rb", stdin); 25 | freopen("CONOUT$", "wb", stdout); 26 | freopen("CONOUT$", "wb", stderr); 27 | 28 | HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); 29 | SMALL_RECT rect = { 0, 0, 200, 500 }; 30 | COORD consoleSize = { (short)100, (short)1000 }; 31 | SetConsoleWindowInfo(hConsole, TRUE, &rect); 32 | SetConsoleScreenBufferSize(hConsole, consoleSize); 33 | } 34 | 35 | bool InitHooks = true; 36 | 37 | int count = 0; 38 | 39 | LRESULT CALLBACK WinProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam) 40 | { 41 | switch (Message) 42 | { 43 | case WM_PAINT: 44 | SetWindowPos(tWnd, hWnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); 45 | Render(); 46 | break; 47 | 48 | case WM_CREATE: 49 | DwmExtendFrameIntoClientArea(hWnd, &Margin); 50 | break; 51 | 52 | case WM_DESTROY: 53 | PostQuitMessage(1); 54 | return 0; 55 | 56 | default: 57 | return DefWindowProc(hWnd, Message, wParam, lParam); 58 | break; 59 | } 60 | return 0; 61 | } 62 | 63 | 64 | void Init() 65 | { 66 | WNDCLASSEX wClass; 67 | wClass.cbClsExtra = NULL; 68 | wClass.cbSize = sizeof(WNDCLASSEX); 69 | wClass.cbWndExtra = NULL; 70 | wClass.hbrBackground = (HBRUSH)CreateSolidBrush(RGB(0, 0, 0)); 71 | wClass.hCursor = LoadCursor(0, IDC_ARROW); 72 | wClass.hIcon = LoadIcon(0, IDI_APPLICATION); 73 | wClass.hIconSm = LoadIcon(0, IDI_APPLICATION); 74 | wClass.hInstance = (HINSTANCE)GetModuleHandle(NULL); 75 | wClass.lpfnWndProc = WinProc; 76 | wClass.lpszClassName = lWindowName; 77 | wClass.lpszMenuName = lWindowName; 78 | wClass.style = CS_VREDRAW | CS_HREDRAW; 79 | RegisterClassEx(&wClass); 80 | tWnd = FindWindow(0, "DayZ"); 81 | if (tWnd) 82 | { 83 | GetWindowRect(tWnd, &tSize); 84 | Width = tSize.right - tSize.left; 85 | Height = tSize.bottom - tSize.top; 86 | hWnd = CreateWindowEx(NULL, lWindowName, lWindowName, WS_POPUP | WS_VISIBLE, 1, 1, Width, Height, 0, 0, 0, 0); 87 | 88 | std::cout << hWnd << std::endl; 89 | SetLayeredWindowAttributes(hWnd, 0, 1.0f, LWA_ALPHA); 90 | SetLayeredWindowAttributes(hWnd, 0, RGB(0, 0, 0), LWA_COLORKEY); 91 | std::cout << "Creating Window" << std::endl; 92 | SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_LAYERED | WS_EX_TRANSPARENT); 93 | ShowWindow(hWnd, SW_SHOW); 94 | } 95 | 96 | DirectXInit(hWnd); 97 | } 98 | 99 | int main() 100 | { 101 | Init(); 102 | while (1) 103 | { 104 | tWnd = FindWindow(0, tWindowName); 105 | 106 | if (PeekMessage(&Message, hWnd, 0, 0, PM_REMOVE)) //Try NULL for hwnd? 107 | { 108 | DispatchMessage(&Message); 109 | TranslateMessage(&Message); 110 | } 111 | Sleep(3); 112 | } 113 | } -------------------------------------------------------------------------------- /Drawing.cpp: -------------------------------------------------------------------------------- 1 | #include "Drawing.h" 2 | 3 | extern int Width; 4 | extern int Height; 5 | 6 | int DrawString(char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont) 7 | { 8 | //RECT ShadowPos; 9 | //ShadowPos.left = x + 1; 10 | //ShadowPos.top = y + 1; 11 | RECT FontPos; 12 | FontPos.left = x; 13 | FontPos.top = y; 14 | //ifont->DrawTextA(0, String, strlen(String), &ShadowPos, DT_NOCLIP, D3DCOLOR_ARGB(255, r / 3, g / 3, b / 3)); 15 | ifont->DrawTextA(0, String, -1, &FontPos, DT_NOCLIP, D3DCOLOR_ARGB(255, r, g, b)); 16 | return 0; 17 | } 18 | int DrawShadowString(const char* String, int x, int y, int r, int g, int b, ID3DXFont* ifont) 19 | { 20 | RECT Font; 21 | Font.left = x; 22 | Font.top = y; 23 | RECT Fonts; 24 | Fonts.left = x + 1; 25 | Fonts.top = y; 26 | RECT Fonts1; 27 | Fonts1.left = x - 1; 28 | Fonts1.top = y; 29 | RECT Fonts2; 30 | Fonts2.left = x; 31 | Fonts2.top = y + 1; 32 | RECT Fonts3; 33 | Fonts3.left = x; 34 | Fonts3.top = y - 1; 35 | ifont->DrawTextA(0, String, strlen(String), &Fonts3, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1)); 36 | ifont->DrawTextA(0, String, strlen(String), &Fonts2, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1)); 37 | ifont->DrawTextA(0, String, strlen(String), &Fonts1, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1)); 38 | ifont->DrawTextA(0, String, strlen(String), &Fonts, DT_NOCLIP, D3DCOLOR_ARGB(255, 1, 1, 1)); 39 | ifont->DrawTextA(0, String, strlen(String), &Font, DT_NOCLIP, D3DCOLOR_ARGB(255, r, g, b)); 40 | return 0; 41 | } 42 | 43 | void GradientFunc(int x, int y, int w, int h, int r, int g, int b, int a) 44 | { 45 | int iColorr, iColorg, iColorb; 46 | for (int i = 1; i < h; i++) 47 | { 48 | iColorr = (int)((float)i / h * r); 49 | iColorg = (int)((float)i / h * g); 50 | iColorb = (int)((float)i / h * b); 51 | FillRGB(x, y + i, w, 1, r - iColorr, g - iColorg, b - iColorb, a); 52 | } 53 | } 54 | void DrawLine(float x, float y, float xx, float yy, int r, int g, int b, int a) 55 | { 56 | D3DXVECTOR2 dLine[2]; 57 | 58 | p_Line->SetWidth(1); 59 | 60 | dLine[0].x = x; 61 | dLine[0].y = y; 62 | 63 | dLine[1].x = xx; 64 | dLine[1].y = yy; 65 | 66 | p_Line->Draw(dLine, 2, D3DCOLOR_ARGB(a, r, g, b)); 67 | 68 | } 69 | void FillRGB(float x, float y, float w, float h, int r, int g, int b, int a) 70 | { 71 | D3DXVECTOR2 vLine[2]; 72 | 73 | p_Line->SetWidth(w); 74 | 75 | vLine[0].x = x + w / 2; 76 | vLine[0].y = y; 77 | vLine[1].x = x + w / 2; 78 | vLine[1].y = y + h; 79 | 80 | p_Line->Begin(); 81 | p_Line->Draw(vLine, 2, D3DCOLOR_RGBA(r, g, b, a)); 82 | p_Line->End(); 83 | } 84 | void DrawBox(float x, float y, float width, float height, float px, int r, int g, int b, int a) 85 | { 86 | D3DXVECTOR2 points[5]; 87 | points[0] = D3DXVECTOR2(x, y); 88 | points[1] = D3DXVECTOR2(x + width, y); 89 | points[2] = D3DXVECTOR2(x + width, y + height); 90 | points[3] = D3DXVECTOR2(x, y + height); 91 | points[4] = D3DXVECTOR2(x, y); 92 | p_Line->SetWidth(1); 93 | p_Line->Draw(points, 5, D3DCOLOR_RGBA(r, g, b, a)); 94 | } 95 | 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) 96 | { 97 | DrawBox(x, y, w, h, 1, r, g, b, a); 98 | FillRGB(x, y, w, h, rr, gg, bb, a); 99 | } 100 | void DrawHealthBar(float x, float y, float w, float h, int r, int g) 101 | { 102 | FillRGB(x, y, w, h, r, g, 0, 255); 103 | } 104 | void DrawHealthBarBack(float x, float y, float w, float h) 105 | { 106 | FillRGB(x, y, w, h, 0, 0, 0, 255); 107 | } 108 | void DrawCenterLine(float x, float y, int width, int r, int g, int b) 109 | { 110 | D3DXVECTOR2 dPoints[2]; 111 | dPoints[0] = D3DXVECTOR2(x, y); 112 | dPoints[1] = D3DXVECTOR2(Width / 2, Height); 113 | p_Line->SetWidth(width); 114 | p_Line->Draw(dPoints, 2, D3DCOLOR_RGBA(r, g, b, 255)); 115 | } -------------------------------------------------------------------------------- /Utils.hpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | class Vec2 5 | { 6 | public: 7 | float x, y; 8 | Vec2() { x = y = 0.0f; }; 9 | void Zero() { x = y = 0.0f; }; 10 | void NineNull() { x = y = 999.9f; }; 11 | friend Vec2 operator - (Vec2 a, Vec2 b) 12 | { 13 | Vec2 temp; 14 | temp.x = a.x - b.x; 15 | temp.y = a.y - b.y; 16 | return temp; 17 | }; 18 | friend Vec2 operator + (Vec2 a, Vec2 b) 19 | { 20 | Vec2 temp; 21 | temp.x = a.x + b.x; 22 | temp.y = a.y + b.y; 23 | return temp; 24 | }; 25 | friend void operator += (Vec2& a, Vec2 b) 26 | { 27 | a.x += b.x; 28 | a.y += b.y; 29 | }; 30 | friend void operator -= (Vec2& a, Vec2 b) 31 | { 32 | a.x -= b.x; 33 | a.y -= b.y; 34 | }; 35 | friend Vec2 operator / (Vec2 a, float b) 36 | { 37 | Vec2 temp; 38 | temp.x = a.x / b; 39 | temp.y = a.y / b; 40 | return temp; 41 | }; 42 | }; 43 | 44 | class Vec3 45 | { 46 | public: 47 | float x, y, z; 48 | Vec3() { x = y = z = 0.0f; }; 49 | Vec3(float X, float Y, float Z) { x = X; y = Y; z = Z; }; 50 | void Zero() { x = y = z = 0.0f; }; 51 | void NineNull() { x = y = z = 999.9f; }; 52 | friend Vec3 operator - (Vec3 a, Vec3 b) 53 | { 54 | Vec3 temp; 55 | temp.x = a.x - b.x; 56 | temp.y = a.y - b.y; 57 | temp.z = a.z - b.z; 58 | return temp; 59 | }; 60 | friend Vec3 operator + (Vec3 a, Vec3 b) 61 | { 62 | Vec3 temp; 63 | temp.x = a.x + b.x; 64 | temp.y = a.y + b.y; 65 | temp.z = a.z + b.z; 66 | return temp; 67 | }; 68 | friend void operator += (Vec3& a, Vec3 b) 69 | { 70 | a.x += b.x; 71 | a.y += b.y; 72 | a.z += b.z; 73 | }; 74 | friend void operator -= (Vec3& a, Vec3 b) 75 | { 76 | a.x -= b.x; 77 | a.y -= b.y; 78 | a.z -= b.z; 79 | }; 80 | friend Vec3 operator * (Vec3 a, float b) 81 | { 82 | Vec3 temp; 83 | temp.x = a.x * b; 84 | temp.y = a.y * b; 85 | temp.z = a.z * b; 86 | return temp; 87 | }; 88 | }; 89 | 90 | struct TransData 91 | { 92 | char unknown0[8]; //0x0000 93 | Vec3 InvView_right; //0x0004 94 | Vec3 InvView_up; //0x0010 95 | Vec3 InvView_forward; //0x001C 96 | Vec3 InvView_Translation; //0x0028 97 | 98 | Vec2 pad; //0x0034 (x = 1,y = -1) 99 | 100 | 101 | Vec3 ViewPortMatrix1; //0x003C (x= viewPort.Width/2) 102 | Vec3 ViewPortMatrix2; //0x0048 -(y= viewPort.Height/2) 103 | 104 | Vec3 ViewPortMatrix3; 105 | //0x0054(x=viewPort.X + CenterScreenX,y=viewPort.Y + CenterScreenY,z=viewPort.MinZ) 106 | 107 | Vec3 ViewPortMatrix_unk; //not sure 108 | 109 | Vec3 ProjO1; //proj1.x 0x006C 110 | Vec3 ProjO2; //proj2.y 0x0078 111 | Vec3 ProjO3; //proj3.z 0x0084 =1.0001 112 | Vec3 ProjO4; //proj4.z 0x0090 113 | 114 | Vec3 Proj1; //proj1.x 0x009C 115 | Vec3 Proj2; //proj2.y 0x00A8 116 | Vec3 Proj3; //proj3.z 0x00B4 = 1.0 117 | Vec3 Proj4; //proj4.z 0x00C0 118 | 119 | Vec3 ProjD1; // 0x00CC x = 1/Proj._11 120 | Vec3 ProjD2; // 0x00D8 y = 1/Proj._22 121 | Vec3 ProjD3; // 0x00E4 z= 1 122 | Vec3 ProjD4; // 0x00F0 123 | 124 | Vec2 pad1; //.x bigass float 0x00FC 125 | 126 | Vec3 View_right; //0x0104 not the view 127 | Vec3 View_up; //0x0110 128 | Vec3 View_forward; //0x011C 129 | Vec3 View_Translation; //0x0128 130 | }; 131 | 132 | float Dot(Vec3 left, Vec3 right) 133 | { 134 | return (left.x * right.x) + (left.y * right.y) + (left.z * right.z); 135 | } 136 | 137 | int Distance(Vec3 first, Vec3 second) 138 | { 139 | return (int)sqrtf(((second.x - first.x) * (second.x - first.x)) + ((second.y - first.y) * (second.y - first.y)) + ((second.z - first.z) * (second.z - first.z))); 140 | } 141 | 142 | Vec3 WorldToScreen(Vec3 pos, TransData transData) 143 | { 144 | Vec3 temp; 145 | temp.x = pos.x - transData.InvView_Translation.x; 146 | temp.y = pos.y - transData.InvView_Translation.y; 147 | temp.z = pos.z - transData.InvView_Translation.z; 148 | 149 | float x = Dot(temp, transData.InvView_right); 150 | float y = Dot(temp, transData.InvView_up); 151 | float z = Dot(temp, transData.InvView_forward); 152 | 153 | Vec3 ToReturn; 154 | ToReturn.x = transData.ViewPortMatrix3.x * (1 + ((x / transData.ProjD1.x) / z)); 155 | ToReturn.y = transData.ViewPortMatrix3.y * (1 - ((y / transData.ProjD2.y) / z)); 156 | ToReturn.z = z; 157 | return ToReturn; 158 | } 159 | 160 | Vec3 Cross(Vec3 a, Vec3 b) 161 | { 162 | Vec3 product; 163 | product.x = (a.y * b.z) - (a.z * b.y); 164 | product.y = (a.z * b.x) - (a.x * b.z); 165 | product.z = (a.x * b.y) - (a.y * b.x); 166 | return product; 167 | } 168 | -------------------------------------------------------------------------------- /Hack.cpp: -------------------------------------------------------------------------------- 1 | #include "DirectX.h" 2 | #include "World.hpp" 3 | #include 4 | #include 5 | #include "common.h" 6 | #include 7 | #include 8 | #include 9 | 10 | World world; 11 | extern int Width; 12 | extern int Height; 13 | 14 | int renderdistance = 200; 15 | int itemRenderDistance = 100; 16 | uintptr_t centerTargetEnt; 17 | void BulletToHeadThread(); 18 | 19 | bool bulletsToHead = false; 20 | 21 | std::mutex bulletToHeadMutex; 22 | 23 | std::map nameCache; 24 | 25 | 26 | int distToCenter; 27 | int closestToCenter; 28 | 29 | int getDistanceFromCenter(uintptr_t entity, Vec3 w2s) 30 | { 31 | Vec3 centerScreen((Width / 2), (Height / 2), 0.0f); 32 | return Distance(centerScreen, w2s); 33 | } 34 | 35 | struct nameid 36 | { 37 | UINT64 pt1; 38 | UINT64 pt2; 39 | }; 40 | 41 | std::string getNameFromId(uintptr_t namePointer) 42 | { 43 | nameid ID = driver.rpm(namePointer + 0x10); 44 | std::map::iterator it = nameCache.find(ID.pt1 + ID.pt2); 45 | 46 | if (it == nameCache.end()) 47 | { 48 | 49 | int size = driver.rpm(namePointer + 0x8); 50 | char* name = new char[size]; 51 | driver.rpmRaw(namePointer + 0x10, name, size); 52 | //Adds name to cached list of objects we don't want to draw. 53 | if (strstr(name, "Animal") != NULL || strstr(name, "Zmb") != NULL || strstr(name, "Firewood") != NULL || strstr(name, "Barrel") || strstr(name, "Watchtower") || strstr(name, "Wood Pillar") || strstr(name, "Roof") || strstr(name, "Wall") != NULL || strstr(name, "Floor") || strstr(name, "Fireplace") != NULL || strstr(name, "Wire Mesh Barrier") != NULL || strstr(name, "Fence") != NULL) 54 | { 55 | std::string text = ""; 56 | nameCache.insert(std::pair(ID.pt1 + ID.pt2, text)); 57 | delete name; 58 | return text; 59 | } 60 | 61 | std::string text = std::string(name); 62 | delete name; 63 | nameCache.insert(std::pair(ID.pt1 + ID.pt2, text)); 64 | std::cout << "Added new item to cache: " << text << std::endl; 65 | return text; 66 | } 67 | else 68 | { 69 | return it->second; 70 | } 71 | } 72 | 73 | void BulletToHeadThread() 74 | { 75 | while (1) 76 | { 77 | if (bulletsToHead) 78 | { 79 | uintptr_t worldptr = driver.rpm(world.dw_world + world.modulebase); 80 | 81 | int bulletTableSize = driver.rpm(worldptr + world.dw_bulletTable + 0x8); 82 | 83 | if (bulletTableSize > 0) 84 | { 85 | bulletToHeadMutex.lock(); 86 | uintptr_t target = centerTargetEnt; 87 | bulletToHeadMutex.unlock(); 88 | 89 | Vec3 headpos = world.GetVisualState(target); 90 | 91 | for (size_t i = 0; i < bulletTableSize; i++) 92 | { 93 | uintptr_t bullet = driver.rpm(worldptr + world.dw_bulletTable + (i * 0x8)); 94 | uintptr_t visualState = driver.rpm(bullet + world.dw_objectVisualState); 95 | 96 | driver.wpm(headpos, visualState + 0x2C); 97 | } 98 | } 99 | 100 | } 101 | Sleep(5); 102 | } 103 | } 104 | 105 | 106 | void IterateItems(uintptr_t worldptr) 107 | { 108 | int objectTableSz = driver.rpm(worldptr + world.dw_ItemsOnGround + 0x8); 109 | 110 | std::stringstream all; 111 | uintptr_t entityTable = driver.rpm(worldptr + world.dw_ItemsOnGround); 112 | 113 | //TransData transData = world.GetTransData(); 114 | for (size_t i = 0; i < objectTableSz; i++) 115 | { 116 | TransData transData = world.GetTransData(); 117 | if (!entityTable) continue; 118 | 119 | int check = driver.rpm(entityTable + (i * 0x18)); 120 | 121 | if (check != 1) continue; 122 | 123 | uintptr_t entity = driver.rpm(entityTable + ((i * 0x18) + 0x8)); 124 | if (entity) 125 | { 126 | Vec3 Pos = world.GetObjectVisualState(entity); 127 | 128 | Vec3 outPos = WorldToScreen(Pos, transData); 129 | 130 | if (outPos.z >= 1.0f) 131 | { 132 | //draw 133 | } 134 | if (outPos.z < 1.0f) continue; 135 | 136 | uintptr_t localEnt = world.GetLocalEntity(); 137 | 138 | if (localEnt) 139 | { 140 | uintptr_t manvisualState = driver.rpm(localEnt + world.dw_manVisualState); 141 | 142 | if (manvisualState) 143 | { 144 | Vec3 localPos = driver.rpm(manvisualState + 0x2C); 145 | int dist = Distance(localPos, Pos); 146 | 147 | if (dist <= itemRenderDistance && dist > 0) 148 | { 149 | uintptr_t objectBase = driver.rpm(entity + 0xE0); 150 | uintptr_t cleanNamePtr = driver.rpm(objectBase + 0x450); 151 | 152 | 153 | 154 | std::string text = getNameFromId(cleanNamePtr); 155 | if (text.empty()) continue; 156 | 157 | std::stringstream all; 158 | all << text; 159 | all << " " << dist; 160 | DrawString((char*)all.str().c_str(), outPos.x, outPos.y, 240, 240, 260, pFontSmall); 161 | } 162 | } 163 | } 164 | } 165 | } 166 | } 167 | 168 | bool teleTent = false; 169 | UINT64 airdropContainer = 0; 170 | 171 | void IterateSlow(uintptr_t worldptr) 172 | { 173 | int slowEntityTableSz = driver.rpm(worldptr + 0x1F40 + 0x8); //Slow entity table 174 | 175 | uintptr_t localEnt = world.GetLocalEntity(); 176 | uintptr_t manvisualState = driver.rpm(localEnt + world.dw_manVisualState); 177 | Vec3 localPos = driver.rpm(manvisualState + 0x2C); 178 | 179 | for (size_t i = 0; i < slowEntityTableSz; i++) 180 | { 181 | uintptr_t entityTable = driver.rpm(worldptr + 0x1F40); 182 | 183 | int check = driver.rpm(entityTable + (i * 0x18)); 184 | 185 | if (check == 0) continue; 186 | 187 | uintptr_t entity = driver.rpm(entityTable + ((i * 0x18) + 0x8)); 188 | 189 | if (entity) 190 | { 191 | Vec3 Pos = world.GetObjectVisualState(entity); 192 | 193 | TransData transData = world.GetTransData(); 194 | 195 | Vec3 outPos = WorldToScreen(Pos, transData); 196 | if (outPos.z >= 1.0f) 197 | { 198 | if (localEnt) 199 | { 200 | if (manvisualState) 201 | { 202 | int dist = Distance(localPos, Pos); 203 | 204 | if (dist > 2 && dist <= renderdistance) 205 | { 206 | uintptr_t objectBase = driver.rpm(entity + 0xE0); 207 | uintptr_t cleanNamePtr = driver.rpm(objectBase + 0x68); 208 | 209 | UINT64 nameId = driver.rpm(cleanNamePtr + 0x10); 210 | std::string text = getNameFromId(cleanNamePtr); 211 | 212 | if (text.empty()) continue; 213 | std::stringstream all; 214 | all << text << " "; 215 | 216 | all << dist; //<< std::endl << objectname; 217 | 218 | 219 | DrawString((char*)all.str().c_str(), outPos.x, outPos.y, 240, 240, 250, pFontSmall); 220 | } 221 | } 222 | } 223 | } 224 | } 225 | } 226 | } 227 | 228 | 229 | bool items = false; 230 | 231 | bool gps = false; 232 | 233 | Vec3 GpsCoords; 234 | 235 | bool initthread = true; 236 | 237 | bool enableSpeed = false; 238 | int addr; 239 | bool iterAnimals = false; 240 | 241 | bool setInWall = false; 242 | bool setDay = false; 243 | Vec3 TargetPos; 244 | 245 | float daylight = 0.0f; 246 | 247 | void Hack() 248 | { 249 | if (initthread) 250 | { 251 | CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)BulletToHeadThread, NULL, NULL, NULL); 252 | initthread = false; 253 | } 254 | 255 | if (GetAsyncKeyState(VK_HOME) & 0x8000) 256 | { 257 | Sleep(200); 258 | enableSpeed = !enableSpeed; 259 | std::cout << enableSpeed << std::endl; 260 | 261 | if (enableSpeed) 262 | { 263 | addr = driver.rpm(world.modulebase + 0xD7DA08); 264 | driver.wpm(addr / 10, world.modulebase + 0xD7DA08); 265 | //std::cout << addr << std::endl; 266 | } 267 | 268 | else 269 | { 270 | driver.wpm(addr, world.modulebase + 0xD7DA08); 271 | } 272 | } 273 | 274 | 275 | std::stringstream rend; 276 | rend << "Render Distance: " << renderdistance << std::endl << "Item Render: " << itemRenderDistance; 277 | DrawString((char*)rend.str().c_str(), 20, 30, 240, 240, 250, pFontSmall); 278 | 279 | uintptr_t worldptr = driver.rpm(world.modulebase + world.dw_world); 280 | 281 | if (GetAsyncKeyState(VK_NUMPAD9) & 0x8000) 282 | { 283 | renderdistance += 100; 284 | } 285 | 286 | if (GetAsyncKeyState(VK_NUMPAD6) & 0x8000) 287 | { 288 | renderdistance -= 100; 289 | } 290 | 291 | if (GetAsyncKeyState(VK_NUMPAD8) & 0x8000) 292 | { 293 | itemRenderDistance += 100; 294 | } 295 | 296 | if (GetAsyncKeyState(VK_NUMPAD5) & 0x8000) 297 | { 298 | itemRenderDistance -= 100; 299 | } 300 | 301 | if (GetAsyncKeyState(VK_NUMPAD7) & 0x8000) 302 | { 303 | Sleep(100); 304 | gps = !gps; 305 | GpsCoords.y = 100; 306 | } 307 | 308 | if (GetAsyncKeyState(VK_NUMPAD4) & 0x8000) 309 | { 310 | GpsCoords.x += 100; 311 | if (GpsCoords.x >= 16000.f) 312 | { 313 | GpsCoords.x = 0; 314 | } 315 | } 316 | 317 | if (GetAsyncKeyState(VK_NUMPAD1) & 0x8000) 318 | { 319 | GpsCoords.z += 100; 320 | if (GpsCoords.z >= 16000.f) 321 | { 322 | GpsCoords.z = 0; 323 | } 324 | } 325 | 326 | if (GetAsyncKeyState(VK_NUMPAD0) & 0x8000) 327 | { 328 | Sleep(100); 329 | items = !items; 330 | } 331 | 332 | if (GetAsyncKeyState(VK_DELETE) & 0x8000) 333 | { 334 | Sleep(100); 335 | iterAnimals = !iterAnimals; 336 | } 337 | 338 | int closestToCenter = 99999; 339 | 340 | if (worldptr) 341 | { 342 | uintptr_t localEnt = world.GetLocalEntity(); 343 | uintptr_t manvisualState = driver.rpm(localEnt + world.dw_manVisualState); 344 | Vec3 localPos = driver.rpm(manvisualState + 0x2C); 345 | 346 | 347 | if (iterAnimals) 348 | { 349 | DrawString((char*)"Slow Animal Table", 20, 105, 240, 240, 250, pFontSmall); 350 | IterateSlow(worldptr); 351 | } 352 | 353 | if (items) 354 | { 355 | IterateItems(worldptr); 356 | DrawString((char*)"Items ON", 20, 75, 240, 240, 250, pFontSmall); 357 | } 358 | 359 | 360 | if (setDay) 361 | { 362 | DrawString((char*)"Day ON", 20, 150, 240, 240, 250, pFontSmall); 363 | 364 | driver.wpm(2.0f, worldptr + 0x28A8); 365 | } 366 | 367 | int nearEntityTableSz = driver.rpm(worldptr + world.dw_NearEntityTable + 0x8); 368 | int farEntityTableSz = driver.rpm(worldptr + world.dw_FarEntityTable + 0x8); 369 | 370 | 371 | if (gps) 372 | { 373 | TransData transData = world.GetTransData(); 374 | Vec3 gpsOut = WorldToScreen(GpsCoords, transData); 375 | int distGps = Distance(GpsCoords, localPos); 376 | std::stringstream gpscoords; 377 | 378 | std::stringstream gpsOn; 379 | gpsOn << "GPS ON: " << GpsCoords.x << " " << GpsCoords.z; 380 | DrawString((char*)gpsOn.str().c_str(), 20, 90, 255, 255, 255, pFontSmall); 381 | if (gpsOut.z >= 1.0f) 382 | { 383 | 384 | gpscoords << distGps; 385 | DrawString((char*)gpscoords.str().c_str(), gpsOut.x, gpsOut.y, 20, 255, 255, pFontSmall); 386 | } 387 | 388 | 389 | } 390 | for (size_t i = 0; i < nearEntityTableSz; i++) 391 | { 392 | TransData transData = world.GetTransData(); 393 | uintptr_t entityTable = driver.rpm(worldptr + world.dw_NearEntityTable); 394 | uintptr_t entity = driver.rpm(entityTable + (i * 0x8)); 395 | if (entity) 396 | { 397 | uintptr_t networkId = driver.rpm(entity + world.dw_networkId); 398 | if (networkId == 0) continue; 399 | 400 | Vec3 Pos = world.GetVisualState(entity); 401 | std::stringstream currentPos; 402 | currentPos << "x: " << localPos.x << "y: " << localPos.z; 403 | DrawString((char*)currentPos.str().c_str(), 20, 60, 240, 240, 250, pFontSmall); 404 | 405 | 406 | Vec3 outPos = WorldToScreen(Pos, transData); 407 | 408 | if (outPos.z >= 1.0f) 409 | { 410 | int dist = Distance(localPos, Pos); 411 | 412 | if (dist > 2 && dist <= renderdistance) 413 | { 414 | uintptr_t objectBase = driver.rpm(entity + 0xE0); 415 | uintptr_t cleanNamePtr = driver.rpm(objectBase + 0x450); 416 | 417 | int size = driver.rpm(cleanNamePtr + 0x8); 418 | 419 | if (size <= 3) 420 | { 421 | continue; 422 | } 423 | 424 | UINT64 nameId = driver.rpm(cleanNamePtr + 0x10); 425 | std::string text = getNameFromId(cleanNamePtr); 426 | if (text.empty()) continue; 427 | 428 | 429 | std::stringstream all; 430 | 431 | all << text << " "; 432 | 433 | all << dist; 434 | 435 | if (driver.rpm(entity + 0xF1) == 1) 436 | { 437 | DrawString((char*)all.str().c_str(), outPos.x, outPos.y, 137, 0, 11, pFontSmall); 438 | continue; 439 | } 440 | DrawString((char*)all.str().c_str(), outPos.x, outPos.y, 233, 0, 255, pFontSmall); 441 | } 442 | } 443 | } 444 | 445 | for (size_t i = 0; i < farEntityTableSz; i++) 446 | { 447 | TransData transData = world.GetTransData(); 448 | uintptr_t entityTable = driver.rpm(worldptr + world.dw_FarEntityTable); 449 | uintptr_t entity = driver.rpm(entityTable + (i * 0x8)); 450 | if (entity) 451 | { 452 | int networkId = driver.rpm(entity + world.dw_networkId); 453 | 454 | if (networkId == 0) continue; 455 | 456 | Vec3 Pos = world.GetVisualState(entity); 457 | 458 | TransData transData = world.GetTransData(); 459 | 460 | Vec3 outPos = WorldToScreen(Pos, transData); 461 | if (outPos.z >= 1.0f) 462 | { 463 | if (localEnt) 464 | { 465 | if (manvisualState) 466 | { 467 | int dist = Distance(localPos, Pos); 468 | 469 | if (dist > 2 && dist <= renderdistance) 470 | { 471 | uintptr_t objectBase = driver.rpm(entity + 0xE0); 472 | uintptr_t cleanNamePtr = driver.rpm(objectBase + 0x450); 473 | 474 | int size = driver.rpm(cleanNamePtr + 0x8); 475 | 476 | if (size <= 3) 477 | { 478 | continue; 479 | } 480 | 481 | 482 | UINT64 nameId = driver.rpm(cleanNamePtr + 0x10); 483 | std::string text = getNameFromId(cleanNamePtr); 484 | if (text.empty()) continue; 485 | 486 | std::stringstream all; 487 | 488 | all << text << " "; 489 | 490 | all << dist; //<< std::endl << objectname; 491 | 492 | if (driver.rpm(entity + 0xF1) == 1) 493 | { 494 | DrawString((char*)all.str().c_str(), outPos.x, outPos.y, 137, 0, 11, pFontSmall); 495 | continue; 496 | } 497 | DrawString((char*)all.str().c_str(), outPos.x, outPos.y, 233, 0, 255, pFontSmall); 498 | } 499 | } 500 | } 501 | } 502 | } 503 | } 504 | } 505 | } 506 | } 507 | //Near Entity Table = 0xE78; // Size = 0xE80 508 | //Further = 0xFC0 509 | // --------------------------------------------------------------------------------