Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "AVA.hpp"
- struct BoundingBox
- {
- FVector vec1;
- FVector vec2;
- FVector vec3;
- FVector vec4;
- FVector vec5;
- FVector vec6;
- FVector vec7;
- FVector vec8;
- };
- BOOL CarregaFonte = false;
- INT MenuSelection = 1;
- INT Current = true;
- INT PosX = 30;
- INT PosY = 70;
- INT Posy = 60;
- CHAR* Opt_Opções[] = { "0", "1" };
- CHAR* Opt_Menu[] = { "+", "-" };
- int iCount;
- BoundingBox boundingBox[20];
- int a;
- int b;
- template <typename T>
- T GetInstanceOf(UClass* pClass)
- {
- UObject* pObjectInstance = nullptr;
- //Check if GObjObjects does not equal zero
- if (UObject::GObjObjects())
- {
- //Loop through all objects
- for (int i = 0; i < UObject::GObjObjects()->Count; ++i)
- {
- //IsReadableMemory check to avoid crashes
- if (UObject::GObjObjects()->Data[i])
- {
- //Get the current object
- UObject* pCheckObject = (*UObject::GObjObjects())(i);
- //Validate the current object
- if (pCheckObject && pCheckObject->IsA(pClass))
- {
- //Check if the current object is the default object for its class
- if (!strstr(pCheckObject->GetFullName(), "Default"))
- pObjectInstance = pCheckObject;
- }
- }
- }
- }
- return (T)pObjectInstance;
- };
- bool inline IsValidTarget(APawn *pTarget)
- {
- return pTarget
- && !pTarget->bDeleteMe
- && pTarget->Mesh
- && pTarget->Health > 0
- && pTarget->PlayerReplicationInfo;
- }
- FVector WorldToScreen(UCanvas *pCanvas, AavaPlayerController *pPlayerController, const FVector& vector)
- // you will have to understand 3d math before understand this
- {
- FVector delta = pPlayerController->Subtract_VectorVector(vector, pPlayerController->CalcViewLocation);
- FVector axisX;
- FVector axisY;
- FVector axisZ;
- pCanvas->GetAxes(pPlayerController->CalcViewRotation, &axisX, &axisY, &axisZ);
- FVector transformed;
- transformed.X = pPlayerController->Dot_VectorVector(delta, axisY);
- transformed.Y = pPlayerController->Dot_VectorVector(delta, axisZ);
- transformed.Z = pPlayerController->Dot_VectorVector(delta, axisX);
- if (transformed.Z < 1.00f)
- transformed.Z = 1.00f;
- float FOVAngle = pPlayerController->GetFOVAngle();
- FVector result;
- result.X = (pCanvas->ClipX / 2.0f) + transformed.X * ((pCanvas->ClipX / 2.0f) / pPlayerController->Tan(FOVAngle * CONST_Pi / 360.0f)) / transformed.Z;
- result.Y = (pCanvas->ClipY / 2.0f) + -transformed.Y * ((pCanvas->ClipX / 2.0f) / pPlayerController->Tan(FOVAngle * CONST_Pi / 360.0f)) / transformed.Z;
- result.Z = 0;
- return result;
- }
- void BoundingBox3D(UCanvas *pCanvas, AavaPlayerController *pPlayerController, APawn *pPawn, BoundingBox& boundingBox)
- {
- FBox box;
- pPawn->GetComponentsBoundingBox(&box);
- if (box.IsValid)
- {
- boundingBox.vec1 = WorldToScreen(pCanvas, pPlayerController, box.Min);
- boundingBox.vec2 = WorldToScreen(pCanvas, pPlayerController, box.Max);
- boundingBox.vec3 = box.Min;
- boundingBox.vec3.X = box.Max.X;
- boundingBox.vec3 = WorldToScreen(pCanvas, pPlayerController, boundingBox.vec3);
- boundingBox.vec4 = box.Min;
- boundingBox.vec4.Y = box.Max.Y;
- boundingBox.vec4 = WorldToScreen(pCanvas, pPlayerController, boundingBox.vec4);
- boundingBox.vec5 = box.Min;
- boundingBox.vec5.Z = box.Max.Z;
- boundingBox.vec5 = WorldToScreen(pCanvas, pPlayerController, boundingBox.vec5);
- boundingBox.vec6 = box.Max;
- boundingBox.vec6.X = box.Min.X;
- boundingBox.vec6 = WorldToScreen(pCanvas, pPlayerController, boundingBox.vec6);
- boundingBox.vec7 = box.Max;
- boundingBox.vec7.Y = box.Min.Y;
- boundingBox.vec7 = WorldToScreen(pCanvas, pPlayerController, boundingBox.vec7);
- boundingBox.vec8 = box.Max;
- boundingBox.vec8.Z = box.Min.Z;
- boundingBox.vec8 = WorldToScreen(pCanvas, pPlayerController, boundingBox.vec8);
- }
- }
- //void DrawString(LPCSTR pString, int X, int Y, D3DCOLOR Color)
- //{
- // RECT rect = { X, Y, 0, 0 };
- // pD3DFont->DrawText(NULL, pString, -1, &rect, DT_NOCLIP, Color);
- //}
- void Draw2DLine(const FVector& f, const FVector& t, D3DCOLOR Color)
- {
- D3DXVECTOR2 vLine[2];
- vLine[0].x = f.X;
- vLine[0].y = f.Y;
- vLine[1].x = t.X;
- vLine[1].y = t.Y;
- pLine->Draw(vLine, 2, Color);
- }
- HRESULT WINAPI hkEndScene(LPDIRECT3DDEVICE9 pDevice) // try it xD
- {
- //if (!pD3DFont) // inizialize font
- // D3DXCreateFont(pDevice, 21, 0, FW_THIN, 1, 0, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Courier New", &pD3DFont);
- if (GetAsyncKeyState(VK_HOME) & 1)
- {
- BaseJanela.Mostrar = !BaseJanela.Mostrar;
- }
- if (BaseJanela.Mostrar)
- {
- Current = 1;
- if (GetAsyncKeyState(VK_UP) & 1)
- MenuSelection--;
- if (GetAsyncKeyState(VK_DOWN) & 1)
- MenuSelection++;
- DrawRect(pDevice, PosX - 10, PosY - 22, 180, 20, Red);
- GravaTexto(PosX + 38, PosY - 20, Orange, Fonte[13], "Elite Cheats");
- Base(pDevice, PosX - 10, Posy + 2 + (MenuSelection * 15), 180, 13, Green, Green, Green);
- Additem("UAV", 1, Item[1], 0, Opt_Opções, pDevice);
- Additem("ESP", 1, Item[2], 0, Opt_Opções, pDevice);
- /* Additem("Unlimited Ammo", 1, Item[3], 0, Opt_Opções, pDevice);
- Additem("Super Weapons", 1, Item[4], 0, Opt_Opções, pDevice);
- Additem("Fast Reload", 1, Item[5], 0, Opt_Opções, pDevice);
- Additem("Nospread", 1, Item[6], 0, Opt_Opções, pDevice);
- Additem("Colors Red/Green", 1, Item[7], 0, Opt_Opções, pDevice);
- Additem("Anti AFK Kick", 1, Item[9], 0, Opt_Opções, pDevice);
- Additem("Anti Kick", 1, Item[10], 0, Opt_Opções, pDevice);
- Additem("Night Vision", 1, Item[11], 0, Opt_Opções, pDevice);
- Additem("No Recoil", 1, Item[12], 0, Opt_Opções, pDevice);
- Additem("No Flash", 1, Item[13], 0, Opt_Opções, pDevice);
- Additem("Rapid Fire", 1, Item[14], 0, Opt_Opções, pDevice);
- Additem("Player Bob", 1, Item[15], 0, Opt_Opções, pDevice);
- Additem("CrossHair D3D", 1, Item[8], 0, Opt_Opções, pDevice);
- Additem("CrossHair Custom_1", 1, Item[16], 0, Opt_Opções, pDevice);
- Additem("CrossHair Custom_2", 1, Item[17], 0, Opt_Opções, pDevice);
- Additem("CrossHair Custom_3", 1, Item[18], 0, Opt_Opções, pDevice);
- Additem("CrossHair Custom_4", 1, Item[20], 0, Opt_Opções, pDevice);
- Additem("CrossHair Custom_5", 1, Item[22], 0, Opt_Opções, pDevice);
- Additem("CrossHair Custom_6", 1, Item[23], 0, Opt_Opções, pDevice);
- Additem("Hide CrossHair", 1, Item[24], 0, Opt_Opções, pDevice);
- Additem("Restore CrossHair", 1, Item[21], 0, Opt_Opções, pDevice);
- Additem("Names and Healthbars", 1, Item[19], 0, Opt_Opções, pDevice);*/
- if (MenuSelection >= Current)
- MenuSelection = 1;
- if (MenuSelection < 1)
- MenuSelection = Current - 1;
- }
- if (!pLine)
- D3DXCreateLine(pDevice, &pLine); // inizialize lines
- //DrawString("AVA Hack", 10, 10, D3DCOLOR_RED); // draw what i actually am
- for (int i = 0; i < iCount; i++)
- {
- auto& _boundingBox = boundingBox[i];
- // do it urself xD
- Draw2DLine(_boundingBox.vec1, _boundingBox.vec5, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec2, _boundingBox.vec8, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec3, _boundingBox.vec7, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec4, _boundingBox.vec6, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec1, _boundingBox.vec3, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec1, _boundingBox.vec4, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec8, _boundingBox.vec3, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec8, _boundingBox.vec4, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec2, _boundingBox.vec6, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec2, _boundingBox.vec7, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec5, _boundingBox.vec6, D3DCOLOR_ARGB(255, 255, 0, 0));
- Draw2DLine(_boundingBox.vec5, _boundingBox.vec7, D3DCOLOR_ARGB(255, 255, 0, 0));
- }
- return oEndScene(pDevice); // call original EndScene so that i can do whatever game does
- }
- void Patch_D3DVMT()//are you getting EndScene Hook message in console? ok try now
- {
- while (true) // try now
- {
- Sleep(1); // anti-CPU overload
- static DWORD ES_addr = NULL;
- if (!ES_addr)
- ES_addr = *(DWORD*)(FindPattern("AVA.exe", ES_Pattern, ES_Mask) + ES_Offset);
- DWORD dwDevice = *(DWORD*)(ES_addr); // pDevice
- //DWORD dwDevice = *(DWORD*)(0x1B5CC84); // pDevice
- if (!dwDevice) continue; // wait for pDevice initialized
- DWORD dwVMT = *(DWORD*)(dwDevice);// VMT
- if (!dwVMT) continue; // wait for VMT initialized
- DWORD dwEndScene = *(DWORD*)(dwVMT + dwOff); // EndScene
- if (!dwEndScene) continue; // wait for EndScene initialized
- if (!oEndScene) // get original EndScene function pointer
- oEndScene = (tEndScene)dwEndScene;
- if (dwEndScene != (DWORD)&hkEndScene) // if EndScene called by game is not your EndScene function
- {
- DWORD dwOldProtect;
- VirtualProtect((LPVOID)(dwVMT + dwOff), 4, PAGE_EXECUTE_READWRITE, &dwOldProtect); // unprotect memory giving write access
- *(DWORD*)(dwVMT + dwOff) = (DWORD)&hkEndScene; // replace game EndScene with your EndScene
- VirtualProtect((LPVOID)(dwVMT + dwOff), 4, dwOldProtect, NULL); // restore previous protection
- }
- } // simple until here?
- }
- void OnAttach()
- {
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Patch_D3DVMT, NULL, NULL, NULL);
- unsigned long address;
- Beep(750, 300);
- AllocConsole();
- //SetConsoleTitle("AVA PUBLIC VERSION 1.3");
- //FILE *file = nullptr;
- //freopen_s(&file, "CONOUT$", "w", stdout);
- //freopen_s(&file, "CONIN$", "r", stdin);
- while (!UObject::GObjObjects()
- || UObject::GObjObjects()->Count < 100001)
- Sleep(100);
- UGameEngine *pGameEngine = nullptr;
- while (!pGameEngine
- || !pGameEngine->IsA(UGameEngine::StaticClass()))
- {
- pGameEngine = GetInstanceOf<UGameEngine*>(UGameEngine::StaticClass());
- Sleep(100);
- }
- AavaPlayerController *pPlayerController = nullptr;
- UCanvas *pCanvas = nullptr;
- while (true)
- {
- if (!pGameEngine
- || !pGameEngine->GamePlayers.Data)
- continue;
- while (!pCanvas
- || !pCanvas->IsA(UCanvas::StaticClass()))
- {
- pCanvas = GetInstanceOf<UCanvas*>(UCanvas::StaticClass());
- Sleep(100);
- }
- pPlayerController = (AavaPlayerController*)pGameEngine->GamePlayers.Data[0]->Actor;
- if (!pPlayerController
- || !pPlayerController->IsA(AavaPlayerController::StaticClass()))
- continue;
- AavaPawn *pPawn = (AavaPawn*)pPlayerController->Pawn;
- if (!pPawn
- || !pPawn->IsA(AavaPawn::StaticClass())
- || !pPawn->WorldInfo)
- continue;
- iCount = 0;
- // Loop through the pawns
- for (APawn *pTarget = pPawn->WorldInfo->PawnList; pTarget; pTarget = pTarget->NextPawn)
- {
- if (pTarget == pPawn
- || !pTarget->IsA(AavaPawn::StaticClass())
- || !IsValidTarget(pTarget)
- || pPlayerController->IsSameTeam(pTarget))
- continue;
- if (Item[1] == 1)
- {
- ((AavaPawn*)pTarget)->bTargetted = true;
- }
- if (Item[1] == 0)
- {
- ((AavaPawn*)pTarget)->bTargetted = false;
- }
- if (Item[2] == 1)
- {
- BoundingBox3D(pCanvas, pPlayerController, pTarget, boundingBox[iCount++]);
- }
- if (Item[2] == 0)
- {
- }
- }
- Sleep(100);
- }
- }
- BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
- {
- switch (dwReason)
- {
- case DLL_PROCESS_ATTACH:
- DisableThreadLibraryCalls(hInstance);
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)OnAttach, NULL, NULL, NULL);
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement