Solved C# Trainer Not Writing Memory

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

IMBredCrumbz

Newbie
Full Member
Nov 17, 2015
7
87
1
I was following fleeps hack any game with C# and I was just after a simple godmode hack.
It detects the program and and changes to on/off when I click it but for some reason it doesnt change the memory in game.
C++:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Globalization;
using System.Threading;

namespace AssaultCubeCSharpTrainer
{
    public partial class Form1 : Form
    {

        #region Global variables
        Memory myMemory = new Memory();
        Process[] myProcess;
        bool isGameAvailable = false;

        bool GodMode = false;
        string HealthPointer = "011DA128";
        int[] HealthOffset = {0x14};
        int HealthToFill = 9999;

        #endregion


        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(isGameAvailable)
            {
                if(GodMode)
                {

                    GodMode = false;
                    button1.Text = "OFF";

                }
                else
                {

                    GodMode = true;
                    button1.Text = "On";

                } 


            }
        }

        private void GameStatusTimer_Tick(object sender, EventArgs e)
        {
            myProcess = Process.GetProcessesByName("ac_client");
            if (myProcess.Length !=1)
            {

                isGameAvailable = false;
                statuslabel.Text = "Status: Not Found";

            }
            else
            {

                isGameAvailable = true;
                statuslabel.Text = "Status: Attached";

            }
              
        }

        private void UpdateCheats_Tick(object sender, EventArgs e)
        {
            if(isGameAvailable)
            {

                #region ShotGun Ammo
                if(GodMode)
                {

                    myMemory.ReadProcess = myProcess[0];
                    myMemory.Open();
                    int pointerAddress = HexToDec(HealthPointer);
                    int[] pointerOffset = HealthOffset;
                    int bytesWritten;
                    byte[] valueToWrite = BitConverter.GetBytes(HealthToFill);
                    string writtenAddress = myMemory.PointerWrite((IntPtr)pointerAddress, valueToWrite, pointerOffset, out bytesWritten);
                    myMemory.CloseHandle();

                }
                #endregion

            }
        }
        
        public static string HexToDec(int DEC)
        {

            return DEC.ToString("X");

        }

        public static int HexToDec(string Hex)
        {

            return int.Parse(Hex, NumberStyles.HexNumber);

        }
    }
}
Thanks for any help you may give, I can provide other info if you need it.
 

mambda

headass
Escobar Tier VIP
Trump Tier Donator
Jun 25, 2014
2,298
37,938
269
"string HealthPointer = "011DA128";"
" int pointerAddress = HexToDec(HealthPointer);"

Does C# let you do that? I have a feeling this just becomes 0
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods