#include <Windows.h>
#include <tchar.h>
#include <psapi.h>
#include <iostream>
#include <queue>
#include <string>
using namespace std;
BOOL GetProcessID(const wchar_t* processName, DWORD& processID) {
DWORD aProcesses[1024], cbNeeded, cProcesses;
if (!EnumProcesses(aProcesses, sizeof(aProcesses), &cbNeeded)) {
return FALSE;
}
cProcesses = cbNeeded / sizeof(DWORD);
for (DWORD i = 0; i < cProcesses; i++) {
HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, aProcesses[i]);
if (hProcess) {
wchar_t szProcessName[MAX_PATH];
GetModuleBaseNameW(hProcess, NULL, szProcessName, sizeof(szProcessName)/sizeof(wchar_t));
if (_wcsicmp(processName, szProcessName) == 0) {
processID = aProcesses[i];
CloseHandle(hProcess);
return TRUE;
}
CloseHandle(hProcess);
}
}
return FALSE;
}
int main()
{
DWORD ProcessID = 0;
if (!GetProcessID(L"gta_sa.exe", ProcessID)) {
cout << "Process not found!" << endl;
return 1;
}
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, ProcessID);
if (hProcess == NULL)
{
cout << "Failed to open process!" << endl;
return 1;
}
DWORD MakaneNoSpread = 0x8D610F;
bool Cheragh = false;
char NoSpreadFaalShavad[] = "\xBE\x00\x00\x00\x00";
char NoSpreadGheyreFaalShavad[] = "\xBE\x00\x00\x40\x3F";
queue<char> cheatCode;
string targetCheat = "HESOYAM";
cout << "Tire saaf (legit version) for SA:MP/AG:SAL started." << endl;
cout << "Type HESOYAM to toggle the No Spread feature." << endl;
while (true)
{
for (char c = 'A'; c <= 'Z'; c++) {
if (GetAsyncKeyState(c) & 1) {
cheatCode.push(c);
if (cheatCode.size() > targetCheat.length()) {
cheatCode.pop();
}
string currentCode;
queue<char> temp = cheatCode;
while (!temp.empty()) {
currentCode += temp.front();
temp.pop();
}
if (currentCode == targetCheat) {
if (!Cheragh) {
WriteProcessMemory(hProcess, (LPVOID)MakaneNoSpread, &NoSpreadFaalShavad, 5, NULL);
cout << "Tire saaf (legit) has been enabled." << endl;
Cheragh = true;
}
else {
WriteProcessMemory(hProcess, (LPVOID)MakaneNoSpread, &NoSpreadGheyreFaalShavad, 5, NULL);
cout << "Tire saaf (legit) has been disabled." << endl;
Cheragh = false;
}
while (!cheatCode.empty()) {
cheatCode.pop();
}
}
}
}
Sleep(85);
}
CloseHandle(hProcess);
return 0;
}