Thread: CoD4 SP Trainer

Results 1 to 3 of 3
  1. #1
    mwxplayer's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    hax
    Posts
    584
    Reputation
    10
    Thanks
    2,928
    My Mood
    Doh

    CoD4 SP Trainer



    1)start CoD4 SP
    2)Start the Trainer
    3)Have Fun with Ammo Hack..
    More Features coming soon..



     

    @Jorndel as always for his Memory class,me for finding all offsets and coding..,unknown user for this tutorial


     

    Code:
    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****;
    using System.Runtime.InteropServices;
    using System.Diagnostics;
    using memory_control;
    
    
    /*
     * CoD4 SP Trainer : by MW2Player
     * Credits : Jorndel,Unknown user (I forgot) for Memory_control.dll Class and me for rest (coding everything and finding offsets)
     * don't leech pl0x
     * */
    
    
    namespace CoD4_SP_Trainer
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            #region Basic Stuff
            [DllImport("kernel32.dll")]
            private static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
            [DllImport("kernel32.dll")]
            private static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);
            IntPtr pHandel;
            public bool Process_Handle(string ProcessName)
            {
                try
                {
                    Process[] ProcList = Process.GetProcessesByName(ProcessName);
                    if (ProcList.Length == 0)
                        return false;
                    else
                    {
                        pHandel = ProcList[0].Handle;
                        return true;
                    }
                }
                catch (Exception ex)
                { Console.Beep(); Console.WriteLine("Process_Handle - " + ex.Message); return false; }
            }
            private byte[] Read(int Address, int Length)
            {
                byte[] Buffer = new byte[Length];
                IntPtr Zero = IntPtr.Zero;
                ReadProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
                return Buffer;
            }
            private void Write(int Address, int Value)
            {
                byte[] Buffer = BitConverter.GetBytes(Value);
                IntPtr Zero = IntPtr.Zero;
                WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
            }
            #endregion
    
            //This is the part you want to edit
            #region Write Functions (Integer & String)
            public void WriteInteger(int Address, int Value)
            {
                Write(Address, Value);
            }
            public void WriteString(int Address, string Text)
            {
                byte[] Buffer = new ASCIIEncoding().GetBytes(Text);
                IntPtr Zero = IntPtr.Zero;
                WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
            }
            public void WriteBytes(int Address, byte[] Bytes)
            {
                IntPtr Zero = IntPtr.Zero;
                WriteProcessMemory(pHandel, (IntPtr)Address, Bytes, (uint)Bytes.Length, out Zero);
            }
            public void WriteNOP(int Address)
            {
                byte[] Buffer = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 };
                IntPtr Zero = IntPtr.Zero;
                WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
            }
    
    
            #endregion
            #region Read Functions (Integer & String)
            public int ReadInteger(int Address, int Length = 4)
            {
                return BitConverter.ToInt32(Read(Address, Length), 0);
            }
            public string ReadString(int Address, int Length = 4)
            {
                return new ASCIIEncoding().GetString(Read(Address, Length));
            }
            public byte[] ReadBytes(int Address, int Length)
            {
                return Read(Address, Length);
            }
            #endregion
    
            private void timer1_Tick(object sender, EventArgs e)
            {
                if (Process_Handle("iw3sp"))
                {
                    button1.Enabled = true;
                    button2.Enabled = true;
                    button3.Enabled = true;
                    button4.Enabled = true;
                    button5.Enabled = true;
    
    
                    Memorys mem = new Memorys("iw3sp");
                    uint Equipment = mem.baseaddress("iw3sp.exe") + 0xA0DD4C;
                    uint address0 = (uint)mem.ReadPointer(Equipment);
    
                    uint PrimaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB48;
                    uint address1 = (uint)mem.ReadPointer(PrimaryAmmo);
    
                    uint SecondaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB44;
                    uint address2 = (uint)mem.ReadPointer(SecondaryAmmo);
    
                    uint PrimaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD44;
                    uint address3 = (uint)mem.ReadPointer(PrimaryAmmoBullets);
    
                    uint SecondaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD48;
                    uint address4 = (uint)mem.ReadPointer(SecondaryAmmoBullets);
    
                    label3.Text = address0.ToString();
                    label4.Text = address3.ToString();
                    label5.Text = address4.ToString();
                    label6.Text = address1.ToString();
                    label7.Text = address2.ToString();
    
                    label8.Text = "CoD4 found..";
    
    
    
                }
                else
                {
                    button1.Enabled = false;
                    button2.Enabled = false;
                    button3.Enabled = false; //disable all buttons when game is closed.
                    button4.Enabled = false;
                    button5.Enabled = false;
                    label3.Text = "";
                    label4.Text = "";
                    label5.Text = "";  //flush Labels when game is exited
                    label6.Text = "";
                    label7.Text = "";
    
                    label8.Text = "Waiting for CoD4";
                   
    
                }
    
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                timer1.Start();
            }
           
            private void button1_Click(object sender, EventArgs e)
            {
                Memorys mem = new Memorys("iw3sp");
                uint Equipment = mem.baseaddress("iw3sp.exe") + 0xA0DD4C;
                mem.Write(Equipment, int.Parse(textBox1.Text));
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                Memorys mem = new Memorys("iw3sp");
                uint PrimaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD44;
                mem.Write(PrimaryAmmoBullets, int.Parse(textBox2.Text));
            }
    
            private void button3_Click(object sender, EventArgs e)
            {
                Memorys mem = new Memorys("iw3sp");
                uint SecondaryAmmoBullets = mem.baseaddress("iw3sp.exe") + 0xA0DD48;
                mem.Write(SecondaryAmmoBullets, int.Parse(textBox3.Text));
            }
    
            private void button4_Click(object sender, EventArgs e)
            {
                Memorys mem = new Memorys("iw3sp");
                uint PrimaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB48;
                mem.Write(PrimaryAmmo,int.Parse(textBox4.Text));
            }
    
            private void button5_Click(object sender, EventArgs e)
            {
                Memorys mem = new Memorys("iw3sp");
                uint SecondaryAmmo = mem.baseaddress("iw3sp.exe") + 0xA0DB44;
                mem.Write(SecondaryAmmo, int.Parse(textBox5.Text));
            }
    
           
        }
    }
    <b>Downloadable Files</b> Downloadable Files
    Last edited by mwxplayer; 01-14-2013 at 07:32 AM. Reason: forgot the attachment :<

  2. The Following 30 Users Say Thank You to mwxplayer For This Useful Post:

    alex-denn (01-19-2013),atyd (02-27-2013),Aznboy1993 (05-11-2013),CoreCookie (04-12-2013),crusty78 (03-27-2015),dhall91605 (09-20-2014),evans7 (12-27-2021),fahu455 (01-28-2013),fantaxxx (05-03-2013),Fearlessnoob (08-20-2017),FIzy0968 (05-20-2013),Grindead (03-02-2013),ildiki (01-23-2013),JakeTwinkletoes (07-05-2016),kavehfathi (02-17-2014),KIDCON26 (01-26-2013),locodolo (10-28-2013),MeNtaFuZioN (01-29-2014),MrZaneMan (04-22-2013),mustaqimz (08-24-2013),necommer (04-29-2018),nik12341234 (03-07-2016),paradox21 (01-24-2013),rburnsie94 (01-21-2013),Scoothare (02-09-2018),Serverap (01-13-2013),shokreserhan (03-01-2014),tobixxx (02-23-2013),TrollNinja (01-23-2013),WOLFGOD103 (01-21-2013)

  3. #2
    Jorndel's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    Norway
    Posts
    8,676
    Reputation
    905
    Thanks
    19,113
    My Mood
    Angelic
    /Approved

    Report any problems


    -Jorndel

     
    Contributor 01.27.2012 - N/A
    Donator 07-17-2012 - Current
    Editor/Manager 12-16-12 - N/A
    Minion 01-10-2013 - 07.17.13
    Former Staff 09-20-2012 - 01-10-2013 / 07-17-2013 - Current
    Cocksucker 20-04-2013 - N/A

  4. #3
    mwxplayer's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    hax
    Posts
    584
    Reputation
    10
    Thanks
    2,928
    My Mood
    Doh
    added source.

Similar Threads

  1. [Release] Cod4 SP Trainer
    By Zeraxis in forum Call of Duty 4 - Modern Warfare (MW) Hacks
    Replies: 2
    Last Post: 12-27-2011, 05:56 AM
  2. (SEARCHING)WarRock Trainer
    By User Namem in forum Hack Requests
    Replies: 11
    Last Post: 02-02-2006, 07:48 PM
  3. C++ Trainer Skeleton
    By Dave84311 in forum C++/C Programming
    Replies: 40
    Last Post: 01-27-2006, 09:23 PM
  4. Trainer?
    By outrage20 in forum Gate To Heaven Hacks
    Replies: 1
    Last Post: 01-17-2006, 05:52 AM
  5. MPGH Warrock Trainer v1.010206
    By Dave84311 in forum WarRock - International Hacks
    Replies: 21
    Last Post: 01-10-2006, 06:41 PM