I am relatively new to coding. I wanted to create a trainer for the game Assault Cube. I have already implemented an "unlimited ammo" option which works perfectly fine and now i want to make a god mode (unlimited health) option. It doesn't work, and I dont understand why. I have taken the correct offsets from the game (checked with cheat-engine), did all the stuff I did with the ammo also with the health and added the new health values that should be frozen. Is there a problem in the program? Here is my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Memory;
namespace AssaultHack
{
public partial class Form1 : Form
{
Mem meme = new Mem();
public static string RifleAmmo = "ac_client.exe+0x00109B74,150";
public static string PlayerHealth = "ac_client.exe+0x0010A280,338,34,98,8";
public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
int PID = meme.GetProcIdFromName("ac_client");
if(PID > 0)
{
meme.OpenProcess(PID);
Thread WA = new Thread(writeAmmo) { IsBackground = true };
Thread PH = new Thread(godMode) { IsBackground = true };
PH.Start();
WA.Start();
}
}
private void writeAmmo()
{
while(true)
{
if (checkBox1.Checked)
{
meme.WriteMemory(RifleAmmo, "int", "99999");
Thread.Sleep(2);
}
Thread.Sleep(2);
}
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
}
private void godMode()
{
while(true)
{
if (checkBox2.Checked)
{
meme.WriteMemory(PlayerHealth, "int", "99999");
Thread.Sleep(2);
}
Thread.Sleep(2);
}
}
}
}