int wID;
DWORD pActor, pPed, pMtrx1, pMtrx2;
float playerHP;
ReadProcessMemory(hProcess, (LPVOID)0xBAA410, &wID, sizeof(wID), nullptr);
ReadProcessMemory(hProcess, (LPVOID)0xB6F5F0, &pActor, sizeof(pActor), nullptr);
LPVOID pPedM = (LPVOID)(pActor + 0x79C);
LPVOID Mtrx1 = (LPVOID)(pActor + 0x14);
LPVOID Mtrx2 = (LPVOID)(pPed + 0x14);
LPVOID playerHP1 = (LPVOID)(pPed + 0x540);
if (wID == 24)
{
if (pPed > 0)
{
if (playerHP > 0.0f)
{
float x, y, z, x1, y1, z1, RotAngle, Xwiping, Ywiping, Zwiping;
LPVOID xx = (LPVOID)(pMtrx1 + 0x30);
LPVOID yy = (LPVOID)(pMtrx1 + 0x34);
LPVOID zz = (LPVOID)(pMtrx1 + 0x38);
LPVOID x11 = (LPVOID)(pMtrx2 + 0x30);
LPVOID y11 = (LPVOID)(pMtrx2 + 0x34);
LPVOID z11 = (LPVOID)(pMtrx2 + 0x38);
LPVOID RotAngle1 = (LPVOID)(pActor + 0x558);
x1 = (float)x + 2 * (float)cos(RotAngle + 1.48353F);
y1 = (float)y + 2 * (float)sin(RotAngle + 1.48353F);
z1 = (float)z + 0.5F;
x1 = (float)Xwiping;
y1 = (float)Ywiping;
z1 = (float)Zwiping;
DWORD oldProt;
VirtualProtectEx(hProcess, pPedM, sizeof(pPedM), PAGE_EXECUTE_READWRITE, &oldProt); // pPed
WriteProcessMemory(hProcess, pPedM, &pPed, sizeof(pPedM), 0);
VirtualProtectEx(hProcess, pPedM, sizeof(pPedM), oldProt, NULL);
VirtualProtectEx(hProcess, Mtrx1, sizeof(Mtrx1), PAGE_EXECUTE_READWRITE, &oldProt); // pMtrx1
WriteProcessMemory(hProcess, Mtrx1, &Mtrx1, sizeof(Mtrx1), 0);
VirtualProtectEx(hProcess, Mtrx1, sizeof(Mtrx1), oldProt, NULL);
VirtualProtectEx(hProcess, Mtrx2, sizeof(Mtrx2), PAGE_EXECUTE_READWRITE, &oldProt); // pMtrx2
WriteProcessMemory(hProcess, Mtrx2, &Mtrx2, sizeof(Mtrx2), 0);
VirtualProtectEx(hProcess, Mtrx2, sizeof(Mtrx2), oldProt, NULL);
VirtualProtectEx(hProcess, playerHP1, sizeof(playerHP1), PAGE_EXECUTE_READWRITE, &oldProt); // playerHP
WriteProcessMemory(hProcess, playerHP1, &playerHP1, sizeof(playerHP1), 0);
VirtualProtectEx(hProcess, playerHP1, sizeof(playerHP1), oldProt, NULL);
VirtualProtectEx(hProcess, xx, sizeof(xx), PAGE_EXECUTE_READWRITE, &oldProt); // x
WriteProcessMemory(hProcess, xx, &xx, sizeof(xx), 0);
VirtualProtectEx(hProcess, xx, sizeof(xx), oldProt, NULL);
VirtualProtectEx(hProcess, yy, sizeof(yy), PAGE_EXECUTE_READWRITE, &oldProt); // y
WriteProcessMemory(hProcess, yy, &yy, sizeof(yy), 0);
VirtualProtectEx(hProcess, yy, sizeof(yy), oldProt, NULL);
VirtualProtectEx(hProcess, zz, sizeof(zz), PAGE_EXECUTE_READWRITE, &oldProt); // z
WriteProcessMemory(hProcess, zz, &zz, sizeof(zz), 0);
VirtualProtectEx(hProcess, zz, sizeof(zz), oldProt, NULL);
VirtualProtectEx(hProcess, x11, sizeof(x11), PAGE_EXECUTE_READWRITE, &oldProt); // x1
WriteProcessMemory(hProcess, x11, &x11, sizeof(x11), 0);
VirtualProtectEx(hProcess, x11, sizeof(x11), oldProt, NULL);
VirtualProtectEx(hProcess, y11, sizeof(y11), PAGE_EXECUTE_READWRITE, &oldProt); // y1
WriteProcessMemory(hProcess, y11, &y11, sizeof(y11), 0);
VirtualProtectEx(hProcess, y11, sizeof(y11), oldProt, NULL);
VirtualProtectEx(hProcess, z11, sizeof(z11), PAGE_EXECUTE_READWRITE, &oldProt); // z1
WriteProcessMemory(hProcess, z11, &z11, sizeof(z11), 0);
VirtualProtectEx(hProcess, z11, sizeof(z11), oldProt, NULL);
VirtualProtectEx(hProcess, RotAngle1, sizeof(RotAngle1), PAGE_EXECUTE_READWRITE, &oldProt); // RotAngle
WriteProcessMemory(hProcess, RotAngle1, &RotAngle1, sizeof(RotAngle1), 0);
VirtualProtectEx(hProcess, RotAngle1, sizeof(RotAngle1), oldProt, NULL);
}
}
}
}
}