Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
- #include "pch.h"
- #include <string>
- #include "Structs.h"
- #define HOOK_ADDRESS
- std::string text = "Fetthook";
- DWORD dwRenderText = 0x0041A150;
- DWORD JumpBack;
- Player* localPlayer = (Player*)0x029EA740;
- EntityList* entList = (EntityList*)0x0050F4F8;
- void SimpleJMP(BYTE* pAddress, DWORD dwJumpTo, DWORD size) {
- DWORD dwOldProtect, dwOldProtect2;
- VirtualProtect(pAddress, size, PAGE_EXECUTE_READWRITE, &dwOldProtect);
- auto dwRelAddr = (DWORD)(dwJumpTo - (DWORD)pAddress) - 5;
- *pAddress = 0xE9;
- *((DWORD*)(pAddress + 0x1)) = dwRelAddr;
- VirtualProtect(pAddress, size, dwOldProtect, &dwOldProtect2);
- }
- void onAimbot() {
- if (GetAsyncKeyState(0x05)) {
- Vector3 headFromEnemy = entList->list[1]->head;
- Vector3 ourHead = localPlayer->head;
- Vector3 vecDirection = headFromEnemy - ourHead;
- //vecDirection.Normalize();
- Vector2 vecViewAngle;
- if (vecDirection.x == 0 && vecDirection.y == 0 && false) {
- vecViewAngle.y = 0; //yaw
- if (vecDirection.z > 0) {
- vecViewAngle.x = 270;
- }
- else {
- vecViewAngle.x = 90;
- }
- }
- else {
- vecViewAngle.y = -atan2(vecDirection.x, vecDirection.y) / PI * 180 + 180;
- float tmp = sqrtf(powf(vecDirection.x, 2) + powf(vecDirection.y, 2));
- vecViewAngle.x = (atan2(vecDirection.z, tmp) * 180 / PI);
- }
- //vecViewAngle.Normalize();
- //localPlayer.pitch = vecViewAngle.x;
- //localPlayer.yaw = vecViewAngle.y;
- localPlayer->pitch = vecViewAngle.x;
- localPlayer->yaw = vecViewAngle.y;
- }
- }
- void RenderText(const char* text, int x, int y) {
- _asm {
- mov eax, 0xFF
- push - 1
- push - 1
- push 0x00
- push 0x00
- push y
- push x
- push text
- call dwRenderText
- add esp, 1Ch
- }
- }
- __declspec(naked) void Hook() {
- _asm pushad;
- RenderText(text.c_str(), 100, 100);
- onAimbot();
- _asm
- {
- popad;
- mov eax, 0FFh;
- jmp [JumpBack];
- }
- }
- BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- JumpBack = 0x0040BA4A + 5;
- SimpleJMP((PBYTE)0x0040BA4A, (DWORD)Hook, 5);
- case DLL_THREAD_ATTACH:
- case DLL_THREAD_DETACH:
- case DLL_PROCESS_DETACH:
- break;
- }
- return TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement