Code:
void Trigger()
{
DWORD LocalPlayer = Read<DWORD>(ChromeClient + 0x00A8C53C);
int LocalTeam = Read<int>(LocalPlayer + 0xF0);
int CrossHairID = Read<int>(LocalPlayer + 0xAA58);
DWORD EnemyInCH = Read<DWORD>(ChromeClient + 0x04ADDC04 + ((CrossHairID - 1) * 0x10)); // CH = Crosshair.
int EnemyHealth = Read<int>(EnemyInCH + 0xFC); // Enemy in crosshair's
int EnemyTeam = Read<int>(EnemyInCH + 0xF0); // Enemy in crosshair's team, we need this to compare it to our own player's team)
if (LocalTeam != EnemyTeam && EnemyHealth > 0)
{
cout << "Trigger2" << endl;
// Here you can add a delay before shooting, to make it look legit. This is done using Sleep()
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
// use Sleep() here for shooting several shots with an ak for example. Not usable with pisto
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
// use Sleep() here for a 'cooldown' between shots.
}
}