Ganze 111 Zeilen! Da einige Leute von den Tiggersounds genervt waren.
A full 111 lines of code! As some people were pissed off by the sounds from the tiggerbot.
READ THIS:
Credits: Microsoft, WinApi.
Edit: Offsets are now automatically updating, make sure to download the new .rar. "trigger.ini" shall now only contain TriggerKey & TriggerDelay!
A full 111 lines of code! As some people were pissed off by the sounds from the tiggerbot.
Code:
#include <windows.h>
#include <tlhelp32.h>
#include <fstream>
DWORD dwEntityList, dwLocalPlayer, dwClient, dwTeam, dwCrosshairId, TriggerDelay, TriggerKey;
HANDLE hProcess;
DWORD GetModuleHandleByName(char* ModuleName, DWORD ProcID) {
MODULEENTRY32 Entry;
Entry.dwSize = sizeof(MODULEENTRY32);
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ProcID);
if (Module32First(hSnap, &Entry) == TRUE) {
if (!_stricmp(Entry.szModule, ModuleName)) {
DWORD hModule = (DWORD)Entry.modBaseAddr;
return hModule;
}
else {
while (Module32Next(hSnap, &Entry) == TRUE) {
if (!_stricmp(Entry.szModule, ModuleName)) {
DWORD hModule = (DWORD)Entry.modBaseAddr;
return hModule;
}
}
return 0;
}
}
CloseHandle(hSnap);
}
HANDLE GetProcessHandleByName(char* ProcessName) {
PROCESSENTRY32 Entry;
Entry.dwSize = sizeof(PROCESSENTRY32);
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if (Process32First(hSnap, &Entry) == TRUE) {
if (!_stricmp(Entry.szExeFile, ProcessName)) {
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Entry.th32ProcessID);
return hProc;
}
else {
while (Process32Next(hSnap, &Entry) == TRUE) {
if (!_stricmp(Entry.szExeFile, ProcessName)) {
HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, FALSE, Entry.th32ProcessID);
return hProc;
}
}
return 0;
}
}
CloseHandle(hSnap);
}
template <typename ReadType> ReadType Read(DWORD Address) {
ReadType Data;
ReadProcessMemory(hProcess, (LPVOID)(Address), &Data, sizeof(ReadType), 0);
return Data;
}
int eGetTeam(int PlayerNumber) {
return Read<int>((Read<DWORD>(dwClient + dwEntityList + (0x10 * PlayerNumber))) + 0xF0);
}
int eGetHealth(int PlayerNumber) {
return Read<int>((Read<DWORD>(dwClient + dwEntityList + (0x10 * PlayerNumber))) + 0xFC);
}
void Click() {
mouse_event(MOUSEEVENTF_LEFTDOWN, NULL, NULL, NULL, NULL);
Sleep(5);
mouse_event(MOUSEEVENTF_LEFTUP, NULL, NULL, NULL, NULL);
}
void ReadFile() {
std::ifstream f("trigger.ini");
std::string buf;
int cur = 0;
for (; std::getline(f, buf); cur++) {
if (cur == 0) {
std::istringstream ss(&buf[15]);
ss >> TriggerDelay;
}
if (cur == 1) {
std::istringstream ss(&buf[15]);
ss >> std::hex >> TriggerKey;
}
}
f.close();
}
void UpdateOffsets() {//replace with the current offsets.
dwEntityList = 0x00000000;
dwLocalPlayer = 0x00000000;
dwCrosshairId = 0x0000;
dwTeam = 0xF0;
}
int main() {
#ifdef NDEBUG
HWND hWnd = GetConsoleWindow();
ShowWindow(hWnd, SW_HIDE);
#endif
hProcess = GetProcessHandleByName("csgo.exe");
dwClient = GetModuleHandleByName("Client.dll", GetProcessId(hProcess));
ReadFile();
UpdateOffsets();
while (!((GetKeyState(VK_F12) & 0x100) != 0)) {
if ((GetKeyState(TriggerKey) & 0x100) != 0) {
int cId = Read<int>((Read<DWORD>(dwClient + dwLocalPlayer)) + dwCrosshairId);
int myTeam = Read<int>((Read<DWORD>(dwClient + dwLocalPlayer)) + dwTeam);
if (cId > 0 && cId <= 64) {
int eTeam = eGetTeam(cId - 1);
int eHealth = eGetHealth(cId - 1);
if (eTeam != 0 && eTeam != myTeam && (eHealth > 0)) {
Sleep(TriggerDelay);
Click();
}
}
}
}
}
Credits: Microsoft, WinApi.
Edit: Offsets are now automatically updating, make sure to download the new .rar. "trigger.ini" shall now only contain TriggerKey & TriggerDelay!