Here @
Whispeurs, you can do it like this instead, it's cleaner. Also you can make structs to store values from both entities and our own.
NOTE: You need to include Windows.h libraries...
Code:
#include "ProcMem.h"
#include <Windows.h>
ProcMem Mem;
// Needs to be updated when counter strike is updated.
const DWORD LocalBase = 0xA6B91C;
const DWORD EntityBase = 0x4A0E034;
const DWORD m_iCrossHairID = 0x23F8;
// Does not change on updated, in other words, no need to update these!
const DWORD teamOffset = 0xF0;
const DWORD healthOffset = 0xFC;
const DWORD EntLoopDist = 0x10;
void killThemAll();
int main()
{
while (true)
{
killThemAll();
}
}
void killThemAll()
{
Mem.Process("csgo.exe"); //NOTE: if this doesnt work for you put instead Mem.GetProcess("csgo.exe")
DWORD ClientDll = Mem.Module("client.dll"); //Module
// Reading player's info
int localPlayer = Mem.Read<DWORD>(ClientDll + LocalBase);
int localTeam = Mem.Read<int>(localPlayer + teamOffset);
int CrossHairSwag = Mem.Read<int>(localPlayer + m_iCrossHairID);
//Reading entity info
DWORD EnemyInCH = Mem.Read<DWORD>(ClientDll + EntityBase + ((CrossHairSwag - 1) * EntLoopDist));
int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset);
int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
//NOTE: This includes our own information 'index 0 of the array', our team members info and enemies info
//Sorting enemies from team members
if (localTeam != EnemyTeam && EnemyHealth > 0)
{
printf("swagged");
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(1);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}
You do realize you only read CrossHairID/CrossHairSwag once, right. And also the other important information taht need to be read all the time.
You can do like this too: It's basically same thing, just to show that you need to be constantly reading players info, and thats why urs ain't working.
Code:
#include "ProcMem.h"
#include <Windows.h>
ProcMem Mem;
// Needs to be updated when counter strike is updated.
const DWORD LocalBase = 0xA6B91C;
const DWORD EntityBase = 0x4A0E034;
const DWORD m_iCrossHairID = 0x23F8;
// Does not change on updated, in other words, no need to update these!
const DWORD teamOffset = 0xF0;
const DWORD healthOffset = 0xFC;
const DWORD EntLoopDist = 0x10;
DWORD ClientDLL;
void killThemAll(int localTeam, int CrossHairSwag);
int main()
{
while (true)
{
Mem.Process("csgo.exe");
ClientDLL = Mem.Module("client.dll");
DWORD localPlayer = Mem.Read<DWORD>(ClientDLL + LocalBase);
int localTeam = Mem.Read<int>(localPlayer + teamOffset);
int CrossHairSwag = Mem.Read<int>(localPlayer + m_iCrossHairID);
killThemAll(localTeam, CrossHairSwag);
}
}
void killThemAll(int localTeam, int CrossHairSwag)
{
Mem.Process("csgo.exe");
ClientDLL = Mem.Module("client.dll");
DWORD EnemyInCH = Mem.Read<DWORD>(ClientDLL + EntityBase + ((CrossHairSwag - 1) * EntLoopDist));
int EnemyHealth = Mem.Read<int>(EnemyInCH + healthOffset);
int EnemyTeam = Mem.Read<int>(EnemyInCH + teamOffset);
if (localTeam != EnemyTeam && EnemyHealth > 0)
{
printf("swagged");
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
Sleep(1);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
}