C# - Triggerbot only shoots some people, both teams
First off, credit for the code: marcoly1337 (i can't post links or i would just link the thread)
I'm just learning, so yes, I c+p'd code to try to learn from.
here's the code I'm using (changed offsets and stuff):
Anyway, the triggerbot will shoot teammates and enemies, and only shoots certain people. I can't figure out why. This is against bots btw, if that matters..
Also, since this is external, will this be undetected? If not, how would I get it to be? What makes it undetected?
If anyone can help me out that would be great, thanks in advance.
I'm just learning, so yes, I c+p'd code to try to learn from.
here's the code I'm using (changed offsets and stuff):
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace SimpleTriggerbot
{
class Program
{
[DllImport("kernel32.dll")]
public static extern int OpenProcess(uint dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, int lpBaseAddress, byte[] buffer, int size, int lpNumberOfBytesRead);
[DllImport("user32.dll")]
static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, UIntPtr dwExtraInfo);
[DllImport("user32.dll")]
public static extern short GetAsyncKeyState(int vKey);
static int BaseAdressClientDLL = 0;
static int pHandle = 0;
const int _crosshairID = 0x0000A950;
const int _localPlayer = 0x00A7D4CC;
const int _entityList = 0x04A98154;
const int _teamNum = 0x000000F0;
const int _iHealth = 0x000000FC;
const int _vecOrigin = 0x00000134;
static void Main(string[] args)
{
bool FoundCSGO = false;
while (true)
{
if (FoundCSGO == false)
{
foreach (Process Proc in Process.GetProcesses())
{
if (Proc.ProcessName.Equals("csgo"))
{
Console.WriteLine("found csgo process");
pHandle = OpenProcess(0x001F0FFF, false, Proc.Id);
foreach (ProcessModule Module in Proc.Modules)
{
if (Module.ModuleName.Equals("client.dll"))
{
Console.WriteLine("found base address");
BaseAdressClientDLL = (int)Module.BaseAddress;
FoundCSGO = true;
}
}
}
}
}
else
{
if (GetAsyncKeyState(0x20) != 0)
{
int LocalPlayer = readInt(BaseAdressClientDLL + _localPlayer);
int CrosshairID = readInt(LocalPlayer + _crosshairID);
if (CrosshairID > 0 && CrosshairID <= 64)
{
int Enemy = readInt(BaseAdressClientDLL + _entityList + ((CrosshairID - 1) * _vecOrigin));
int PlayerTeam = readInt(LocalPlayer + _teamNum);
int EnemyTeam = readInt(Enemy + _teamNum);
int EnemyHealth = readInt(Enemy + _iHealth);
if (EnemyHealth > 0 && PlayerTeam != EnemyTeam)
{
mouse_event(0x002, 0, 0, 0, (System.UIntPtr)0);
mouse_event(0x004, 0, 0, 0, (System.UIntPtr)0);
}
}
}
}
System.Threading.Thread.Sleep(5);
}
}
public static int readInt(int address)
{
byte[] buffer = new byte[4];
ReadProcessMemory(pHandle, address, buffer, 4, 0);
return BitConverter.ToInt32(buffer, 0);
}
}
}
Also, since this is external, will this be undetected? If not, how would I get it to be? What makes it undetected?
If anyone can help me out that would be great, thanks in advance.

