Код
#include "stdafx.h"
#include <math.h>
#include <stdio.h>
#include <windows.h>
#include <tlhelp32.h>
int edp(bool en)
{
HANDLE hToken;
if (OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken))
{
TOKEN_PRIVILEGES tp;
tp.PrivilegeCount=1;
LookupPrivilegeValue (0,SE_DEBUG_NAME,&tp.Privileges[0].Luid);
tp.Privileges[0].Attributes = en ? SE_PRIVILEGE_ENABLED : 0;
AdjustTokenPrivileges (hToken, false, &tp, sizeof(tp), NULL, NULL);
}
CloseHandle(hToken);
return 0;
}
void main(void)
{
edp(1);
float fcxpos;
float fcypos;
float camxpos;
float fpvectorx;
float fpvectory;
float fxpos1;
float fypos1;
float fxpos2;
float fypos2;
float fxpos2a;
float fypos2a;
float fphp;
float aa;
float ab;
float ac;
float beta;
float alpha;
int t;
int keyt;
t = 0;
DWORD php;
DWORD xpos1;
DWORD ypos1;
DWORD xpos2;
DWORD ypos2;
DWORD pmtrx1;
DWORD pmtrx2;
DWORD pvectorx;
DWORD pvectory;
DWORD gpoint;
DWORD ptarget;
DWORD pped;
DWORD pId;
DWORD dwOldProtect = 0;
HANDLE pHandle;
HWND hWnd = 0;
printf("=======AimBot for MTA=======");
printf("\n program started, run mta:sa for contine or press enter for exit\n");
while(hWnd == 0){
hWnd = FindWindow(0, "MTA: San Andreas");
Sleep(10);
}
printf("mta:sa running\n");
GetWindowThreadProcessId(hWnd, &pId);
pHandle =
OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, TRUE, pId);
if(pHandle != 0){printf("process find, running...\n");}
while(1)
{
ReadProcessMemory(pHandle, (LPCVOID)0xB6F5F0, &gpoint, 4, 0);
if((gpoint > 0)&&(t == 0)){
printf("pointer available\n");
t = 1;}
if(gpoint > 0){
pmtrx1 = gpoint + 0x14;
ReadProcessMemory(pHandle, (LPCVOID)pmtrx1, &pmtrx1, 4, 0);
xpos1 = pmtrx1 + 0x30;
ypos1 = pmtrx1 + 0x34;
ReadProcessMemory(pHandle, (LPCVOID)xpos1, &fxpos1, 4, 0);
ReadProcessMemory(pHandle, (LPCVOID)ypos1, &fypos1, 4, 0);
ReadProcessMemory(pHandle, (LPCVOID)0xB6F9CC, &fcxpos, 4, 0);
ReadProcessMemory(pHandle, (LPCVOID)0xB6F9D0, &fcypos, 4, 0);
ReadProcessMemory(pHandle, (LPCVOID)0xB6F3B8, &ptarget, 4, 0);
pped = ptarget + 0x79C;
ReadProcessMemory(pHandle, (LPCVOID)pped, &pped, 4, 0);
if(pped > 0){
pvectorx = pped + 0x44;
pvectory = pped + 0x48;
ReadProcessMemory(pHandle, (LPCVOID)pvectorx, &fpvectorx, 4, 0);
ReadProcessMemory(pHandle, (LPCVOID)pvectory, &fpvectory, 4, 0);
pmtrx2 = pped + 0x14;
ReadProcessMemory(pHandle, (LPCVOID)pmtrx2, &pmtrx2, 4, 0);
xpos2 = pmtrx2 + 0x30;
ypos2 = pmtrx2 + 0x34;
ReadProcessMemory(pHandle, (LPCVOID)xpos2, &fxpos2, 4, 0);
ReadProcessMemory(pHandle, (LPCVOID)ypos2, &fypos2, 4, 0);
php = pped + 0x540;
ReadProcessMemory(pHandle, (LPCVOID)php, &fphp, 4, 0);
if(fphp > 0){
fxpos2a = fxpos2;
fypos2a = fypos2;
aa = fabs(fcxpos-fxpos2);
ab = fabs(fcypos-fypos2);
ac = sqrt(aa*aa+ab*ab);
alpha = asin(aa/ac);
beta = acos(aa/ac);
if((fxpos1 > fxpos2)&&(fypos1 < fypos2)){beta = -beta;}
if((fxpos1 > fxpos2)&&(fypos1 > fypos2)){beta = beta;}
if((fxpos1 < fxpos2)&&(fypos1 > fypos2)){beta = (alpha + (3.14/2));}
if((fxpos1 < fxpos2)&&(fypos1 < fypos2)){beta = (-alpha - (3.14/2));}
camxpos = beta+0.0389;
ReadProcessMemory(pHandle,(LPCVOID)0xB7347A, &keyt, 4, 0);
if(keyt > 0){WriteProcessMemory(pHandle, (LPVOID)0xB6F258, (LPVOID)&camxpos, 4, NULL);}
}
}
}
Sleep(10);
}
CloseHandle(pHandle);
}