Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream>
- #include "CProcess.h"
- #include "offsets.h"
- #include "Needed.h"
- #include "CMath.h"
- using namespace std;
- CProcess gProcess;
- CMath gMath;
- bool doAim = true;
- typedef struct C_LocalBasePlayer
- {
- DWORD dw_BasePointer;
- int iTeam;
- int iCrosshairID;
- int iFOV;
- float vAngles[3];
- float vPosition[3];
- float vPunchAngles[3];
- bool OnGround;
- void WipeStruct(void)
- {
- this->dw_BasePointer = 0x0;
- this->iCrosshairID = 0;
- this->iTeam = 0;
- this->vPosition[0] = 0;
- this->vPosition[1] = 0;
- this->vPosition[2] = 0;
- this->vAngles[0] = 0;
- this->vAngles[1] = 0;
- this->vAngles[2] = 0;
- this->iFOV = 0;
- this->vPunchAngles[0] = 0;
- this->vPunchAngles[1] = 0;
- this->vPunchAngles[2] = 0;
- }
- void FillStruct(void)
- {
- this->WipeStruct();
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwClient + c_dwLocalBaseEntity), &this->dw_BasePointer, sizeof(DWORD), 0); //LocalBaseEntity pointer
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwClient + 0x774354), &this->OnGround, sizeof(bool), 0); //1 if on ground / 0 if in air
- ReadProcessMemory(gProcess.hProcess, (PVOID)(this->dw_BasePointer + 0xD7C + 0x6C), &this->vPunchAngles, 12, 0); //0xD7C - m_Local
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(this->dw_BasePointer + c_dwBaseEntityTeam), &this->iTeam, sizeof(int), 0);
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(this->dw_BasePointer + c_dwBaseEntityCrosshairID), &this->iCrosshairID, sizeof(int), 0);
- ReadProcessMemory(gProcess.hProcess, (PVOID)(gProcess.dwEngine + c_dwLocalViewAngles), &this->vAngles, 12, 0);
- ReadProcessMemory(gProcess.hProcess, (PVOID)(gProcess.dwEngine + c_dwLocalPosition), &this->vPosition, 12, 0);
- }
- void cmd_Jump(void)
- {
- keybd_event(MapVirtualKey(VK_SPACE, 0), 0x39, KEYEVENTF_EXTENDEDKEY, 0);
- Sleep(30);
- keybd_event(MapVirtualKey(VK_SPACE, 0), 0x39, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
- }
- //baseentity+0x1410 - flash alpha
- void NoFlash(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(this->dw_BasePointer + 0x1410), &zero, 4, 0);
- }
- //client+0x773D18 - r_drawparticles
- void NoSmoke(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwClient + 0x773D18), &zero, 4, 0);
- }
- /*//engine+0x54EFC0 - mat_wireframe
- void MatWireframe(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwEngine + 0x54EFC0), &one, 4, 0);
- }
- //client+0x741F20 - r_drawothermodels
- void Wireframe(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwClient + 0x741F20), &two, 4, 0);
- }
- //engine+0x5A3B10 - sv_cheats
- void Cheats(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwClient + 0x741F20), &two, 4, 0);
- }
- //engine+0x58D7E4 - sv_pure
- void Pure(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwEngine + 0x58D7E4), &zero, 4, 0);
- }
- //engine+0x5A3D50 - sv_consistency
- void Consistency(void)
- {
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwEngine + 0x5A3D50), &zero, 4, 0);
- }*/
- void cmd_Attack(void)
- {
- doAim = false;
- mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
- mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
- Sleep(100);
- doAim = true;
- }
- void cmd_Attack2(void)
- {
- mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);
- mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);
- }
- void mp_playerid(void)
- {
- int i_True = 0;
- WriteProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwServer + 0x606BF0), &i_True, sizeof(int), 0);
- }
- bool b_OnGround(void)
- {
- return (this->OnGround == 1);
- }
- int b_PlayerInCrosshair(void)
- {
- return (this->iCrosshairID > 0 && this->iCrosshairID < 64);
- }
- } LocalBasePlayer;
- typedef struct C_BasePlayer
- {
- DWORD dw_BasePointer;
- DWORD dw_RadarBase;
- float vPosition[3];
- float vAngles[3];
- int iHealth;
- int iTeam;
- int iLifeState;
- float BonePosition[3];
- DWORD m_dwBoneMatrix;
- float vecBone[3];
- void WipeStruct(void)
- {
- this->dw_BasePointer = 0x0;
- this->m_dwBoneMatrix = 0x0;
- this->dw_RadarBase = 0x0;
- this->iTeam = 0;
- this->iHealth = 0;
- this->vecBone[0] = 0;
- this->vecBone[1] = 0;
- this->vecBone[2] = 0;
- this->vPosition[0] = 0;
- this->vPosition[1] = 0;
- this->vPosition[2] = 0;
- this->iLifeState = 0;
- }
- void FillStruct(int i_Player)
- {
- this->WipeStruct();
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(gProcess.dwClient + c_dwBaseEntity + (i_Player * 0x10)), &this->dw_BasePointer, sizeof(DWORD), 0);
- ReadProcessMemory(gProcess.hProcess, (PVOID)(this->dw_BasePointer + 0x538), &m_dwBoneMatrix, 4, NULL );
- //bones
- ReadProcessMemory(gProcess.hProcess, ( PVOID )( m_dwBoneMatrix + (0x30 * (14)) + 0x0C ), &vecBone[0], 4, NULL );
- ReadProcessMemory(gProcess.hProcess, ( PVOID )( m_dwBoneMatrix + (0x30 * (14)) + 0x1C ), &vecBone[1], 4, NULL );
- ReadProcessMemory(gProcess.hProcess, ( PVOID )( m_dwBoneMatrix + (0x30 * (14)) + 0x2C ), &vecBone[2], 4, NULL );
- //pos
- ReadProcessMemory(gProcess.hProcess, (PVOID)(this->dw_BasePointer + 0x2FC), &this->vPosition, 12, 0);
- //team & health
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(this->dw_BasePointer + 0x98), &this->iTeam, sizeof(int), 0);
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(this->dw_BasePointer + 0x90), &this->iHealth, sizeof(int), 0);
- ReadProcessMemory(gProcess.hProcess, (PBYTE*)(this->dw_BasePointer + 0x8F), &this->iLifeState, sizeof(int), 0);
- }
- bool b_isEnemy(LocalBasePlayer &LocalPlayer)
- {
- return (this->iTeam != LocalPlayer.iTeam);
- }
- } BasePlayer[64];
- LocalBasePlayer Local;
- BasePlayer Entity;
- void DropTarget(void)
- {
- fAimAngles[0] = 0;
- fAimAngles[1] = 0;
- fAimAngles[2] = 0;
- fNearestTarget = 99999.9f;
- iNearestTarget = -1;
- }
- void Update(void)
- {
- while(true)
- {
- gProcess.Initialize();
- Local.mp_playerid();
- Local.NoFlash();
- Local.NoSmoke();
- /*Local.Wireframe();
- Local.Cheats();
- Local.Pure();
- Local.Consistency();*/
- Sleep(5000);
- }
- }
- void Aim(void)
- {
- while(true)
- {
- Sleep(1);
- Local.FillStruct();
- for(int i_Player = 0; i_Player < 64; i_Player++)
- {
- DropTarget();
- Entity[i_Player].FillStruct(i_Player);
- float fFov = gMath.GetFOV( Local.vAngles, Local.vPosition, Entity[i_Player].vecBone );
- if ( ( fFov <= 50 ) && ( fFov < fNearestTarget ) && (Entity[i_Player].iHealth > 1) && Entity[i_Player].b_isEnemy(Local) )
- {
- fNearestTarget = gMath.GetFOV( Local.vAngles, Local.vPosition, Entity[i_Player].vecBone );
- iNearestTarget = i_Player;
- }
- if ( iNearestTarget != -1)
- {
- if(GetAsyncKeyState(1/*mouse1*/) && doAim)
- {
- gMath.CalcAngle(Local.vPosition, Entity[iNearestTarget].vecBone, fAimAngles);
- //leeb norecoil
- fAimAngles[0] -= Local.vPunchAngles[0] * 2.0f;
- fAimAngles[1] -= Local.vPunchAngles[1] * 2.0f;
- fAimAngles[2] -= Local.vPunchAngles[2] * 2.0f;
- SetViewAngles( fAimAngles );
- }
- }
- DropTarget();
- }
- }
- }
- void Trigger(void)
- {
- while(true)
- {
- Sleep(1);
- Entity[Local.iCrosshairID].FillStruct(Local.iCrosshairID);
- if (GetAsyncKeyState(18/*ALT*/) && Local.b_PlayerInCrosshair() && Entity[Local.iCrosshairID].b_isEnemy(Local))
- {
- Local.cmd_Attack();
- }
- /*Knifebot
- if(Local.b_PlayerInCrosshair() && (gMath.GetDistance(Entity[Local.m_i_CrosshairID].v_Position, Local.v_Position )) <= 90)
- {
- Local.cmd_Attack2();
- }
- */
- }
- }
- void Bhop(void)
- {
- while(true)
- {
- Sleep(1);
- if(Local.b_OnGround() && GetAsyncKeyState(32))
- {
- Local.cmd_Jump();
- }
- }
- }
- int main()
- {
- gProcess.Initialize();
- Local.mp_playerid();
- Local.NoFlash();
- Local.NoSmoke();
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Update, 0, 0, 0);
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Trigger, 0, 0, 0);
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Bhop, 0, 0, 0);
- CreateThread(0, 0, (LPTHREAD_START_ROUTINE)Aim, 0, 0, 0);
- while (FindWindow(NULL, "Counter-Strike Source"))
- Sleep(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement