Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //sorry for bad code it was mostly bonded together, and also didnt knew how to send the files soo i just pasted all .h files into this //one to be single file
- // gameclasses.h
- struct Vector3 { float X, Y, Z; };
- class Entity
- {
- public:
- char pad_0000[4]; //0x0000
- Vector3 HeadPos; //0x0004
- Vector3 Velocity; //0x0010
- int32_t X_speed; //0x001C
- int32_t N000005BD; //0x0020
- int32_t N000005BE; //0x0024
- Vector3 MinusVelocity; //0x0028
- Vector3 Pos; //0x0034
- Vector3 angle; //0x0040
- char pad_004C[4]; //0x004C
- float JumpHeight; //0x0050
- int32_t TicksInAir; //0x0054
- float LocalHitBoxWidth; //0x0058
- float PosZOfHeadFromBody; //0x005C
- float PosZOfHeadFromBodyConst; //0x0060
- float LocalHitBoxHeight; //0x0064
- char pad_0068[1]; //0x0068
- bool BonLand; //0x0069
- char pad_006A[1]; //0x006A
- bool Bjump; //0x006B
- char pad_006C[2]; //0x006C
- bool Bcrouched; //0x006E
- char pad_006F[1]; //0x006F
- bool BstandingStill; //0x0070
- bool Bscoped; //0x0071
- char pad_0072[14]; //0x0072
- int8_t FrontBack; //0x0080
- int8_t LeftRight; //0x0081
- int8_t Spectator; //0x0082
- bool BnotDrawBody; //0x0083
- float CrouchSpeed; //0x0084
- char pad_0088[4]; //0x0088
- bool BleftBTN; //0x008C
- bool BrightBTN; //0x008D
- bool BfrontBTN; //0x008E
- bool BbackBTN; //0x008F
- char pad_0090[104]; //0x0090
- int32_t Health; //0x00F8
- int32_t Armor; //0x00FC
- char pad_0100[4]; //0x0100
- int32_t SelectedWeapon; //0x0104
- char pad_0108[12]; //0x0108
- int32_t PistolReloadAmmo; //0x0114
- int32_t CarbineReloadAmmo; //0x0118
- int32_t ShotgunReloadAmmo; //0x011C
- int32_t AssaultReloadAmmo; //0x0120
- int32_t SniperReloadAmmo; //0x0124
- int32_t SubgunReloadAmmo; //0x0128
- char pad_012C[4]; //0x012C
- int32_t GrenadeReloadAmmo; //0x0130
- int32_t CPistolReloadAmmo; //0x0134
- char pad_0138[4]; //0x0138
- int32_t PistolAmmo; //0x013C
- int32_t CarbineAmmo; //0x0140
- int32_t ShotgunAmmo; //0x0144
- int32_t AssaultAmmo; //0x0148
- int32_t SniperAmmo; //0x014C
- int32_t SubgunAmmo; //0x0150
- char pad_0154[4]; //0x0154
- int32_t Grenades; //0x0158
- int32_t CPistolAmmo; //0x015C
- char pad_0160[40]; //0x0160
- int32_t KnifeUsed; //0x0188
- int32_t PistolShot; //0x018C
- int32_t CarbineShot; //0x0190
- int32_t ShotgunShot; //0x0194
- int32_t AssaultShot; //0x0198
- int32_t SniperShot; //0x019C
- int32_t SubgunShot; //0x01A0
- int32_t SomethingShot; //0x01A4
- int32_t GrenadesUsed; //0x01A8
- int32_t CPistolShot; //0x01AC
- char pad_01B0[52]; //0x01B0
- int32_t EntityID; //0x01E4
- char pad_01E8[20]; //0x01E8
- int32_t kills; //0x01FC
- char pad_0200[4]; //0x0200
- int32_t deaths; //0x0204
- char pad_0208[4]; //0x0208
- int32_t TeamKills; //0x020C
- char pad_0210[20]; //0x0210
- bool Bshoot; //0x0224
- char Name[16]; //0x0225
- char pad_0235[247]; //0x0235
- int8_t team; //0x032C
- char pad_032D[11]; //0x032D
- int32_t Fly; //0x0338
- int32_t N00000318; //0x033C
- char pad_0340[8]; //0x0340
- class WeaponStruct* KnifeWeaponStruct; //0x0348
- class WeaponStruct* PistolWeaponStruct; //0x034C
- class WeaponStruct* CarbineWeaponStruct; //0x0350
- class WeaponStruct* ShotgunWeaponStruct; //0x0354
- class WeaponStruct* SubgunWeaponStruct; //0x0358
- class WeaponStruct* SniperWeaponStruct; //0x035C
- class WeaponStruct* AssaultWeaponStruct; //0x0360
- class WeaponStruct* CpistolWeaponStruct; //0x0364
- class WeaponStruct* Grenade; //0x0368
- class WeaponStruct* DualPistol; //0x036C
- class WeaponStruct* LastWeaponSelected; //0x0370
- class WeaponStruct* CurrentWeaponSelected; //0x0374
- class WeaponStruct* CurrentWeaponSelected2; //0x0378
- class WeaponStruct* CurrentWeaponSelected3; //0x037C
- class WeaponStruct* CurrentWeaponSelected4; //0x0380
- class WeaponStruct* CurrentWeaponSelected5; //0x0384
- int32_t Tick; //0x0388
- }; //Size: 0x038C
- static_assert(sizeof(Entity) == 0x38C);
- class EntityArray
- {
- public:
- char pad_0000[4]; //0x0000
- class Entity* EntityPtrArray[32]; //0x0004
- }; //Size: 0x0084
- static_assert(sizeof(EntityArray) == 0x84);
- class WeaponStruct
- {
- public:
- int8_t IconID; //0x0004
- char pad_0005[3]; //0x0005
- class Entity* EntityPtr; //0x0008
- char* WeaponName; //0x000C
- int32_t* Ammo; //0x0010
- int32_t* AmmoInClip; //0x0014
- uint8_t ID; //0x0018
- uint8_t canShot; //0x0019
- char pad_001A[2]; //0x001A
- bool Bspraying; //0x001C
- char pad_001D[11]; //0x001D
- bool Bscoped; //0x0028
- char pad_0029[11]; //0x0029
- virtual void Function0();
- virtual void Function1();
- virtual void Function2();
- virtual void Function3();
- virtual void Function4();
- virtual void Function5();
- virtual void Function6();
- virtual void Function7();
- virtual void Function8();
- virtual void Function9();
- virtual void Function10();
- virtual void SomeFunction();
- }; //Size: 0x0034
- static_assert(sizeof(WeaponStruct) == 0x34);
- class N00001CC6
- {
- public:
- char pad_0000[4]; //0x0000
- }; //Size: 0x0004
- static_assert(sizeof(N00001CC6) == 0x4);
- class N00001D0F
- {
- public:
- char pad_0000[68]; //0x0000
- }; //Size: 0x0044
- static_assert(sizeof(N00001D0F) == 0x44);
- class N00001D8D
- {
- public:
- char pad_0000[68]; //0x0000
- }; //Size: 0x0044
- static_assert(sizeof(N00001D8D) == 0x44);
- class N00001E2C
- {
- public:
- char pad_0000[68]; //0x0000
- }; //Size: 0x0044
- static_assert(sizeof(N00001E2C) == 0x44);
- // dllmain.cpp
- #include "pch.h"
- #include <iostream>
- #include <windows.h>
- #include <TlHelp32.h>
- #include <vector>
- #include <thread>
- #include <random>
- #include <math.h>
- double M_PI = 3.14159265358979323846;
- bool debug = false;
- bool run = true, CTRL = false, CTRLToggle = false;
- int SpecSet;
- EntityArray* Entities; uintptr_t baseAddrs;
- //Functions______________________
- float YawFit(float value) {
- if (value > 360) { return YawFit(value - 360); }
- else if (value < 0) { return YawFit(value + 360); }
- else { return value; };
- };
- float PitchFit(float value) {
- if (value > 90) { return PitchFit(value - 90); }
- else if (value < -90) { return PitchFit(value + -90); }
- else { return value; };
- };
- double DegToRad(double angleDegrees) { return (angleDegrees)*M_PI/180.0; };
- double RadToDeg(double angleRadians) { return (angleRadians)*180.0/M_PI; };
- bool CheckEnts() {
- if (Entities != NULL) {
- return true;
- }
- else {
- Entities = *(EntityArray**)(baseAddrs + 0x10F4F8);
- return false;
- }
- };
- float power(float num) { return num * num; };
- float Distance(Vector3 vec1, Vector3 vec2) {
- return abs(sqrt(power(vec1.X - vec2.X) + power(vec1.Y - vec2.Y) + power(vec1.Z - vec2.Z)));
- // return abs(sqrt(power(vec1.X)+power(vec1.Y)+power(vec1.Z)) - sqrt(power(vec2.X) + power(vec2.Y) + power(vec2.Z)));
- };
- std::string TeamName(unsigned int teamNum) {
- if (teamNum % 2) {return "RVSF";} else {return "CLA";};
- };
- std::string Generate_random_string(std::size_t length) {
- const std::string CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
- std::random_device random_device;
- std::mt19937 generator(random_device());
- std::uniform_int_distribution<> distribution(0, CHARACTERS.size() - 1);
- std::string random_string;
- for (std::size_t i = 0; i < length; ++i)
- {
- random_string += CHARACTERS[distribution(generator)];
- }
- return random_string;
- };
- void memPatch(BYTE* addrs,SIZE_T size,BYTE* bytes) {
- DWORD oldProtect;
- VirtualProtect(addrs, size, PAGE_EXECUTE_READWRITE, &oldProtect);
- memcpy(addrs, bytes, size);
- VirtualProtect(addrs, size, oldProtect, &oldProtect);
- };
- DWORD WINAPI MainThread(HMODULE hModule) {
- //console allocation______________________________
- AllocConsole();
- FILE* f;
- freopen_s(&f, "CONOUT$", "w", stdout);
- SetConsoleTitle(L"AssaultCube hack");
- //finding base adress______________________________
- baseAddrs = (uintptr_t)GetModuleHandle(L"ac_client.exe");
- //getting entity pointer______________________________
- Entity* Player = *(Entity**)(baseAddrs + 0x109B74);
- Entities = *(EntityArray**)(baseAddrs+0x10F4F8);
- int *TotalPlayers = (int*)(baseAddrs + 0x10F500);
- //Defining game functions______________________________
- typedef Entity* (_cdecl* _Traceline)();
- _Traceline Traceline = (_Traceline)(baseAddrs + 0x607C0);
- typedef void(_cdecl* _FullBright)();
- _FullBright FullBright = (_FullBright)(baseAddrs + 0x4f040);
- //adresses specifiing if hack is ON/OFF______________________________
- bool BNoRecoil = false, BHH = false, BAH = false, BGH = false, Bflyhack = false, BSpectate = false, BBHop = false, BdrawEnts = false, BTriggerBot = false, BFullBright = false, BAimBot = false;
- bool* FBBool = (bool*)(baseAddrs + 0x1100A0), * EditMode = (bool*)(baseAddrs+0x10A1AB);
- std::cout.precision(4);
- int n = 0;
- while (run) {
- if (n == 50000) {
- system("cls");
- std::cout << "TOGGLE CTRL + BUTTON NEXT TO THE NAME OF HACK\n";
- std::cout << "if gamehack start with / then its single player\nsolo hacks are only visible in debug mode!\n";
- if (BdrawEnts && *TotalPlayers>00000000) {
- if (CheckEnts()) {
- for (int t = 0; t < *TotalPlayers - 1; t++) {
- std::cout << std::endl << (const char*)(Entities->EntityPtrArray[t]->Name) << " is in: " << TeamName(Entities->EntityPtrArray[t]->team) << " | ID: " << Entities->EntityPtrArray[t]->EntityID;
- };
- } else {
- std::cout << "couldnt find entity array, please join multiplayer or game with bots!\n press [Num5] to get back!";
- };
- }
- else {
- if (debug) {
- std::cout << "__________________VALUE INFO__________________\n";
- std::cout << "X position: " << Player->HeadPos.X << ", Yawn is: " << Player->angle.X << "\n----------------------\n";
- std::cout << "Y position: " << Player->HeadPos.Y << ", Pitch is: " << Player->angle.Y << "\n----------------------\n";
- std::cout << "Z position: " << Player->HeadPos.Z << ", Roll is: " << Player->angle.Z << "\n----------------------\n";
- std::cout << "Your team is: " << TeamName(Player->team) << "\n----------------------\n";
- std::cout << "front/back speed: " << signed(Player->FrontBack) << " right/left speed: " << signed(Player->LeftRight) << "\n----------------------\n"; // for some reason causing error...
- std::cout << "Ammo value is: " << Player->CurrentWeaponSelected->Ammo << "\n----------------------\n";
- std::cout << "Health value is: " << Player->Health << "\n----------------------\n";
- std::cout << "Kill/Deaths: " << Player->kills << "/" << Player->deaths << "\n----------------------\n";
- std::cout << "Total players: " << *TotalPlayers << "\n----------------------\n";
- }
- std::cout << "__________________HACK INFO__________________\n" << std::boolalpha; //MP HACKS
- std::cout << "\n[C] No recoil ---> " << BNoRecoil;
- std::cout << "\n[Q] Flyhack ---> " << Bflyhack << " detectable!";
- std::cout << "\n[E] Spectate --->" << BSpectate << " detectable!";
- std::cout << "\n[X] Bunnyhop --->" << BBHop;
- std::cout << "\n[Y] TriggerBot --->" << BTriggerBot;
- std::cout << "\n[H] AimBot (Test) --->" << BAimBot;
- std::cout << "\n[K] FullBright --->" << BFullBright;
- if (debug) { //SOLO HACKS
- std::cout << "\n[1] /Health hack ---> " << BHH;
- std::cout << "\n[2] /Ammo hack ---> " << BAH;
- std::cout << "\n[3] /Grenade hack ---> " << BGH;
- };
- };
- std::cout << "\n\n[9] Debuging mode---> " << debug << " | [END] exit";
- std::cout << "\nCTRL toggle : " << CTRL << " | [0] auto CTRL --->" << CTRLToggle;
- n = 0;
- };
- if (GetAsyncKeyState(VK_CONTROL) & 1) { CTRL = !CTRL; };
- if (GetAsyncKeyState(VK_NUMPAD0) & 1) { CTRLToggle = !CTRLToggle; };
- if (n % 200) {
- if (GetAsyncKeyState(VK_END) & 1 && CTRL) {
- fclose(f);
- FreeConsole();
- FreeLibraryAndExitThread(hModule, 0);
- return 0;
- run = !run;
- return 1;
- };
- if (debug) { // single player hacks
- if (GetAsyncKeyState(VK_NUMPAD1) & 1 && CTRL) {
- BHH = !BHH;
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(VK_NUMPAD2) & 1 && CTRL) {
- BAH = !BAH;
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(VK_NUMPAD3) & 1 && CTRL) {
- BGH = !BGH;
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(VK_NUMPAD5) & 1 && CTRL) {
- BdrawEnts = !BdrawEnts;
- };
- };
- if (GetAsyncKeyState(0x43) & 1 && CTRL) {
- BNoRecoil = !BNoRecoil;
- if (BNoRecoil) {
- memPatch((BYTE*)baseAddrs + 0x5BAA2, 3, (BYTE*)"\x90\x90\x90");
- //replace asm code for recoil with nop
- }
- else {
- memPatch((BYTE*)baseAddrs + 0x5BAA2, 3, (BYTE*)"\xD8\x4B\x50");
- //replace nops back with the code
- };
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(0x51) & 1 && CTRL) {
- Bflyhack = !Bflyhack;
- if (Bflyhack) {
- Player->Fly = 5;
- }
- else {
- Player->Fly = 0;
- };
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(0x58) & 1 && CTRL) {
- BBHop = !BBHop;
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(VK_NUMPAD9) & 1 && CTRL) {
- debug = !debug;
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(0x59) & 1 && CTRL) {
- BTriggerBot = !BTriggerBot;
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(0x45) & 1 && CTRL) {
- BSpectate = !BSpectate;
- if (!BSpectate) {
- Player->Spectator = 0;
- }
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(0x4B) & 1 && CTRL) {
- BFullBright = !BFullBright;
- if (BFullBright) {
- *FBBool = true;
- *EditMode = true;
- FullBright();
- *EditMode = false;
- }
- else {
- *FBBool = false;
- FullBright();
- };
- if (CTRLToggle) { CTRL = false; };
- };
- if (GetAsyncKeyState(0x48) & 1 && CTRL) {
- BAimBot = !BAimBot;
- if (CTRLToggle) { CTRL = false; };
- };
- };
- if (BTriggerBot) {
- Entity* aimed = Traceline();
- if (aimed != 0) {
- if (aimed->team != Player->team) {
- Player->Bshoot = true;
- } else {
- Player->Bshoot = false;
- }
- } else {
- Player->Bshoot = false;
- };
- };
- if (BSpectate && Player->Spectator != 4) { Player->Spectator = 0x4; } else if (!BSpectate && SpecSet > 0) { Player->Spectator = 0x0; SpecSet--; };
- if (BBHop) { Player->Bjump = true; };
- if (BAimBot) {
- if (CheckEnts()) {
- int BotID = NULL;
- float lowest = 9999;
- float dist = NULL;
- for (int t = 1; t < *TotalPlayers-1; t++) { //loops trought all entities!
- dist = Distance(Entities->EntityPtrArray[t]->HeadPos, Player->HeadPos);
- if ((dist < lowest) && dist < 200) {
- BotID = t;
- lowest = dist;
- };
- };
- if (BotID != NULL) {
- float DiffX = Player->HeadPos.X - Entities->EntityPtrArray[BotID]->HeadPos.X;
- float DiffY = Player->HeadPos.Y - Entities->EntityPtrArray[BotID]->HeadPos.Y;
- float DiffZ = Player->HeadPos.Z - Entities->EntityPtrArray[BotID]->HeadPos.Z;
- Player->angle.X = YawFit(180.0+RadToDeg(asin(DiffX/sqrt(power(DiffX)+power(DiffY)))));
- Player->angle.Y = PitchFit(2+RadToDeg(acos(sqrt(power(DiffZ)+(power(DiffX)+power(DiffY)))/sqrt(power(DiffX) + power(DiffY)))));
- };
- };
- };
- if (debug) {
- if (BHH) { Player->Health = 666; };
- if (BAH) { *Player->CurrentWeaponSelected->Ammo = 666; };
- if (BGH) { Player->Grenades = 5; };
- };
- n++;
- };
- fclose(f);
- FreeConsole();
- FreeLibraryAndExitThread(hModule, 0);
- return 0;
- return 1;
- };
- BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
- )
- {
- switch (ul_reason_for_call)
- {
- case DLL_PROCESS_ATTACH:
- CloseHandle(CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)MainThread, hModule, 0, nullptr));
- 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