Need some help with a simple trainer.

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

anton1453

Newbie
Dec 7, 2012
2
152
0
Hi, i have followed fleep's steps of making a trainer. But i have runned in to some problems and i dont understand what it is im doing wrong.

Alright so while converting Hex to dec i think it stops working.. Becouse if i put a messagebox into the first method it will show but if i do it in the 2nd one it wont.
C++:
        public static int HexToDec(string Hex)
        {
            MessageBox.Show("This work");
            return int.Parse(Hex, NumberStyles.HexNumber);
        }
        public static string HexToDec(int DEC)
        {
            MessageBox.Show("This will not work.");
            return DEC.ToString("X");
        }
I also belive the problem could be somewhere around here:
C++:
private void UpdateCheatsTMR_Tick(object sender, EventArgs e)
        {
            

            if (IsGameAvailable)
            {
                #region Unlimited ammo
                if (UnlimtedAmmo)
                {
                    mymemory.ReadProcess = myProcess[0];
                    mymemory.Open();
                    int pointerAdress = HexToDec(AmmoPointer);
                    int [] pointerOffset = AmmoOffset;
                    int bytesWritten;
                    byte[] valueToWrite = BitConverter.GetBytes(AmmoToFill);
                    String writtenAddress = mymemory.PointerWrite((IntPtr)pointerAdress, valueToWrite, pointerOffset, out bytesWritten);
                    mymemory.CloseHandle();
                }

            }
However, while trying to fix this i have not been able to, I want to go ahead and thank all of you in advance and if i have posted in the wrong section im really sorry!



Here is my full code for a better understanding:
C++:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

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

namespace vctrainer
{
    public partial class Form1 : Form
    {
        #region Global variables
        Memory mymemory = new Memory();
        Process[] myProcess;
        bool IsGameAvailable = false;

        bool UnlimtedAmmo = false;
        string AmmoPointer = "004CF1AC";
        int[] AmmoOffset = {0x28};
        int AmmoToFill = 6;

        #endregion

        public Form1()
        {

            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            myProcess = Process.GetProcessesByName("ppj2dd");
            if (myProcess.Length != 0)
            {
                IsGameAvailable = true;
                status.Text = "Status: Yep, i got you!";
                button1.Enabled = true;
                button2.Enabled = true;
            }
            else
            {
                IsGameAvailable = false;
                status.Text = "Status: Wut, i dont understand?";
                button1.Enabled = false;
                button2.Enabled = false;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (IsGameAvailable)
            {
                if (UnlimtedAmmo)
                {
                    UnlimtedAmmo = true;
                    button1.Text = "1.OFF";
                }
                else if (!UnlimtedAmmo)
                {
                    UnlimtedAmmo = true;
                    button1.Text = "1.ON";
                }
                
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
        }

        private void UpdateCheatsTMR_Tick(object sender, EventArgs e)
        {
            

            if (IsGameAvailable)
            {
                #region Unlimited ammo
                if (UnlimtedAmmo)
                {
                    mymemory.ReadProcess = myProcess[0];
                    mymemory.Open();
                    int pointerAdress = HexToDec(AmmoPointer);
                    int [] pointerOffset = AmmoOffset;
                    int bytesWritten;
                    byte[] valueToWrite = BitConverter.GetBytes(AmmoToFill);
                    String writtenAddress = mymemory.PointerWrite((IntPtr)pointerAdress, valueToWrite, pointerOffset, out bytesWritten);
                    mymemory.CloseHandle();
                }

            }

            #endregion
        }

        private void status_Click(object sender, EventArgs e)
        {

        }
        public static int HexToDec(string Hex)
        {
            MessageBox.Show("1");
            return int.Parse(Hex, NumberStyles.HexNumber);
        }
        public static string HexToDec(int DEC)
        {
            return DEC.ToString("X");
        }
    }
}

This trainer is a simple non-working trainer for an old offline game called virtual cop 2. I can find the process and check if it's running but im not able to get the cheats working.
 

TYPEX

Coder
Full Member
Nobleman
Aug 28, 2013
101
573
0
Dude, why haven't you renamed your buttons like fleep did, it's difficult to know which button is supposed to do what.

And if that is the literal Full code of your project, then there are multiple mistakes.

I've successfully done the trainer few months ago, so here's the code from my project: https://pastebin.com/HCF3DVB4 (link will die after 30 days)

Or you can just download fleeps (don't know if he put it as download), but i have commented every part that I haven't understood before.

1) At which part did you stuck?
2) Are you getting multiple errors or is the program not running because of the HexToDec method?
 

anton1453

Newbie
Dec 7, 2012
2
152
0
Dude, why haven't you renamed your buttons like fleep did, it's difficult to know which button is supposed to do what.

And if that is the literal Full code of your project, then there are multiple mistakes.

I've successfully done the trainer few months ago, so here's the code from my project: https://pastebin.com/HCF3DVB4 (link will die after 30 days)

Or you can just download fleeps (don't know if he put it as download), but i have commented every part that I haven't understood before.

1) At which part did you stuck?
2) Are you getting multiple errors or is the program not running because of the HexToDec method?
I get no errors at all, the hack does just not work.
I have ofc not finished the tutorial yet since im stuck on this part of the tutorial and it is pretty obvious what button it should be.

How ever thank you for the pastebin and the answer, ill check it out! :D
 
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