So I've decided with an external cheat for Counter-Strike: Source, as internals are mostly detected. I decided on the programming language C# as well since I found it much easier to work with, but I have been having a bit of a struggle. For some odd reason, the auto-hop isn't working. I've checked my memory addresses numerous times as well, and can't find the issue. Here's my code
Code:
public static bool autohop = true;
public static bool autostrafe = true;
public static bool antiAC = true;
[DllImport("kernel32.dll")]
public static extern int OpenProcess(uint dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool ReadProcessMemory(int hProcess, IntPtr lpBaseAddress, uint buffer, int size, int lpNumberOfBytesRead);
[DllImport("kernel32.dll")]
public static extern bool WriteProcessMemory(int hProcess, IntPtr lpBaseAddress, bool value, int size, int lpNumberOfBytesWritten);
[STAThread]
public static void Main()
{
Process process = Process.GetProcessesByName("hl2")[0];
ProcessModuleCollection modules = process.Modules;
ProcessModule dllBaseAddress = null;
foreach(ProcessModule m in modules)
{
if(m.ModuleName == "client.dll")
{
dllBaseAddress = m;
break;
}
}
int processWriteHandle = OpenProcess(0x001F0FFF, false, proces*****);
int processReadHandle = OpenProcess(0x001F0FFF, false, proces*****);
const int playerbase = 0x53FB04;
const int jumpoffset = 0x34C;
const int jump = 0x56C5CC;
const int localplayer = 0;
const int fflags = 0;
while(true)
{
ReadProcessMemory(processReadHandle, new IntPtr(dllBaseAddress.BaseAddress.ToInt32() + playerbase), localplayer, sizeof(int), 0);
ReadProcessMemory(processReadHandle, new IntPtr(localplayer + jumpoffset), fflags, sizeof(int), 0);
if(Keyboard.IsKeyDown(Key.Space) && autohop && fflags == 257)
{
WriteProcessMemory(processWriteHandle, new IntPtr(dllBaseAddress.BaseAddress.ToInt32() + jump), true, sizeof(bool), 0);
Thread.Sleep(250);
}
else if(!Keyboard.IsKeyDown(Key.Space) || !autohop || fflags == 256)
{
WriteProcessMemory(processWriteHandle, new IntPtr(dllBaseAddress.BaseAddress.ToInt32() + jump), false, sizeof(bool), 0);
if(antiAC)
{
Thread.Sleep(new Random().Next(250, 300));
}
}
if(Keyboard.IsKeyDown(Key.Space) && autostrafe)
{
//Autostrafe code here
}
}
}