title: Using Pointers Found in Cheat Engine in C#
body: <h1>About the Program</h1>
  <p>I have a program which writes to the memory of the game I'm experimenting with. the code works for me just fine when I use a regular static address, but for some reason I can't seem to do it once I find a working pointer. For example, I find this in Cheat Engine after pointer scanning a few times:</p>
  <p><a href="https://i.stack.imgur.com/UoxPC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UoxPC.png" alt="enter image description here" /></a></p>
  <p>This address works every time I load the game and edit the value. The problem is I don't understand how to use it in my program. Here's my declared variables which I attempted to plug in the values:</p>
  <pre><code>bool UnlimitedAmmo = false;
  string AmmoPointer = &quot;031B7324&quot;; // &lt;--- The address
  int[] AmmoOffset = { 0x2c, 0x1e8, 0x3c8, 0x6d4, 0x508 }; // &lt;--- It's pointers
  int AmmoToFill = 1337; // &lt;--- The Amount of ammo to give
  </code></pre>
  <p>I'm passing in these variables as follows:</p>
  <pre><code>MyMemory.ReadProcess = MyProcess[0];
  MyMemory.Open();
  
  int PointerAddress = HexToDec(AmmoPointer);
  int[] PointerOffest = AmmoOffset;
  int BytesWritten;
  byte[] ValueToWrite = BitConverter.GetBytes(AmmoToFill);
  string WrittenAddress = MyMemory.PointerWrite((IntPtr)PointerAddress, ValueToWrite, 
    PointerOffest, out BytesWritten);
  MyMemory.CloseHandle();
  </code></pre>
  <p>I once used a static address (for a different game) and my code worked fine once I plugged the address and offset. I'm stumped this time. Any help and explanations would be deeply appreciated. Thanks in advance.</p>