Triggerbot help

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
13
Hey guys  :urtheman:

So recently I installed Microsoft Visual Studio 2015. Needed it for making a triggerbot for CS:GO. I installed it, but I can't find that damn .exe to open visual c++ 2015. Here's the code for the triggerbot:
Code:
#include <windows.h>
#include <tlhelp32.h>
#include <fstream>
#include "PatternScanner/PatternScannerMain.h"

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() {
    PatternScanner* ps = PatternScanner::Singleton();
    DWORD* offs = ps->getOffsets();
    dwEntityList = offs[POS_ENTITYLIST];
    dwLocalPlayer = offs[POS_LOCALPLAYER];
    dwCrosshairId = offs[POS_CROSSHAIRID];
    dwTeam = offs[POS_TEAMNUM];
}
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();
				}
			}
		}
	}
}
I installed Visual studio c++ 2015, restarted computer as required, but still can't find how to open the the c++. Anyone got any idea ? I might seem so noob asking this, but I really need some help.

P.S: Also, idk if the code is quite good, so if someone can find some mistakes there, please tell them here, so I might be able to fix it.

Paging doctors [member=5679]T3K[/member] [member=111]springfield[/member] [member=60]Opcode.eXe[/member] [member=21092]monday[/member]
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
hi, the code includes a header file (#include "PatternScanner/PatternScannerMain.h") and ("trigger.ini"), it looks like the second one is there to get 2 values (key + delay time) but the header file probably contains some useful stuff.

Btw I'm not sure if I understood your problem properly, but as far as I know there's no separate exe per each language you'd like to use. In my case what I do is:
-open "VS Express for Desktop 2012" (newer version I tried didn't give the user an option to change from Unicode to Multi-Byte Character Set in project settings)
-File->New Project->choose template (here is the place where you can choose between "Visual Basic", "Visual C#", "Visual C++")

Or is your problem about inability to open "Microsoft Visual Studio 2015" because somehow it's not where you installed it?
 

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
13
monday link said:
hi, the code includes a header file (#include "PatternScanner/PatternScannerMain.h") and ("trigger.ini"), it looks like the second one is there to get 2 values (key + delay time) but the header file probably contains some useful stuff.

Btw I'm not sure if I understood your problem properly, but as far as I know there's no separate exe per each language you'd like to use. In my case what I do is:
-open "VS Express for Desktop 2012" (newer version I tried didn't give the user an option to change from Unicode to Multi-Byte Character Set in project settings)
-File->New Project->choose template (here is the place where you can choose between "Visual Basic", "Visual C#", "Visual C++")

Or is your problem about inability to open "Microsoft Visual Studio 2015" because somehow it's not where you installed it?
My problem is the inability to open "Microsoft Visual Studio 2015"  :bawww: I can't find it, even though I have it installed :|
[member=21092]monday[/member]
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
here's my location:
D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WDExpress.exe
 

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
13
monday link said:
here's my location:
D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\WDExpress.exe
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE but no WDExpress.exe or anything else. Any suggestion ? [member=21092]monday[/member]
 

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
13
springfield link said:
It should be devenv.exe if you don't use the express one.
[member=111]springfield[/member] Thanks, found it  :somuchwin:
Btw, is the code correct ?

Edit: Alright, so I created a c++ file, added the code and I'm getting these http://imgur.com/xfRVoAp
Can someone help me with that ? I really need that triggerbot :bawww:
[member=21092]monday[/member] [member=111]springfield[/member] [member=60]Opcode.eXe[/member] [member=2]0x688[/member]
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
Resolve them one by one.
"cannot open source file PatternScanner/PatternScannerMain.h"

> either add the file(s) to the project, or make sure in your project folder there's a 'PatternScanner' folder that contains those files.

"argument of type wchat bla bla bla.. const char"

> go in the project properties, general > Character Set, change it to 'Use Multi-Byte Character Set'.
 

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
13
Still errors, won't let me compile :sadpepe:
Can someone compile the code for me in .exe  :yesyes: ?
[member=21092]monday[/member] [member=5679]T3K[/member]  :yesyes:
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
but the code you posted includes some other code from a file called "PatternScannerMain.h". Without this file the following part of this code won't work/be compiled:

Code:
void UpdateOffsets() {
    PatternScanner* ps = PatternScanner::Singleton();
    DWORD* offs = ps->getOffsets();
    dwEntityList = offs[POS_ENTITYLIST];
    dwLocalPlayer = offs[POS_LOCALPLAYER];
    dwCrosshairId = offs[POS_CROSSHAIRID];
    dwTeam = offs[POS_TEAMNUM];
}
 

Fu$10N

Expert
Joined
Mar 5, 2014
Messages
1,101
Reaction score
13
monday link said:
but the code you posted includes some other code from a file called "PatternScannerMain.h". Without this file the following part of this code won't work/be compiled:

Code:
void UpdateOffsets() {
    PatternScanner* ps = PatternScanner::Singleton();
    DWORD* offs = ps->getOffsets();
    dwEntityList = offs[POS_ENTITYLIST];
    dwLocalPlayer = offs[POS_LOCALPLAYER];
    dwCrosshairId = offs[POS_CROSSHAIRID];
    dwTeam = offs[POS_TEAMNUM];
}
I know that, but for some reason I don't have that file  :sadpepe: Let me have another look though :urtheman:

Edit: Alright, this is the code now, I removed paternscannermain.h cuz that fille won't create, so I did this:
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() 
	dwEntityList = 0x4A0F014;
	dwLocalPlayer = 0xA6C90C;
	dwCrosshairId = 0x23F8;
	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();
				}
			}
		}
	}
}
I think the code it's good now, shouldn't give me trouble anymore. All i have to do is to update offsets. Mind having a look though ? [member=111]springfield[/member] [member=21092]monday[/member]

Edit2: Alright, got the offsets, but now http://imgur.com/m8NL60h this is what I get :bawww: Can u guys help me ? [member=5679]T3K[/member] [member=21092]monday[/member] [member=111]springfield[/member] [member=60]Opcode.eXe[/member]
 
Top