0

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);
            }
        }
    }
}

V3NOM
  • 1
  • What do you mean when say "It doesn't work"? The value is not saved to PlayerHealth? Or do you have other issues? Try to log the values of your variables inside godMode method – Grigory Zhadko Mar 28 '21 at 03:26
  • How can I do that? Thanks :) – V3NOM Mar 28 '21 at 16:18
  • For online games, some values (such as player health) may be server sided. That means that the server sends the current health value to the client, and that any changes you do to your client will not affect the value stored at the server and that is being sent to the other players. – Irad Ohayon Apr 08 '21 at 23:03

1 Answers1

0

In all the games there are 2 types of vars:
1.netvars: this type of vars is managed by the host of the server and you cant change them only if you was the host of the server (in this case you can change all the players vars) or if you exploited the send socket in the server
2.localvars: this type of vars is stored and managed in your game data locally and you can change this vars anytime like: field of view/viewMatrix/angles.
In your case Assault Cube the health/shield/xyz/score/ammo is netvars and you cant change them only if you was the host. but you can reverse enginner the game to find things that can help you to create exploit like flying/etc...

coderx64
  • 185
  • 1
  • 11