Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
namespace MW3Kill
{
class Client_t
{
public int valid;
public string name;
public int team;
public int rank;
public int perk;
public int score;
public int attacking;
public int zooming;
#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
#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
public static Client_t ReadClient(int Address)
{
int A = Address;
Client_t ret = new Client_t();
ret.valid = ReadInteger(A);
ret.name = ReadString(A + 0xC, 15);
ret.team = ReadInteger(A + 0x1C);
ret.rank = ReadInteger(A + 0x24);
ret.perk = ReadInteger(A + 0x38);
ret.score = ReadInteger(A + 0x44);
ret.attacking = ReadInteger(A + 0x4A0);
ret.zooming = ReadInteger(A + 0x4A8);
Client_t[] clients = new Client_t[18];
int a = 0xAD28F8;
for (int i = 0; i < clients.Length; i++)
{
clients[i] = ReadClient(a);
a += 0x564;
}
return ret;
}
}
}
So basicly, i replaced them to get the error of Client_t gone ... New error pops up : Error 1 An object reference is required for the non-static field, method, or property 'MW3Kill.Client_t.ReadInteger(int, int)'. It points at -> ReadString(A + 0xC, 15); And everything with ReadString in it