Advertisement
Guest User

little offset readclass

a guest
Nov 27th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.47 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Text.RegularExpressions;
  4.  
  5.  
  6. class COffsets
  7. {
  8.     GamePointers Offsets = new GamePointers();
  9.  
  10.     string[] allLines = new string[101];
  11.  
  12.     void Init()
  13.     {
  14.         allLines = System.IO.File.ReadAllLines(@"C:\Users\__fastcall\Desktop\Offsets.txt");
  15.     }
  16.  
  17.     public double readDouble(int LineToRead)
  18.     {
  19.         string temp = "";
  20.  
  21.         temp = allLines[LineToRead];
  22.  
  23.         string _new = Regex.Replace(temp, @"([a-z])", "");
  24.         _new = Regex.Replace(_new, @"=", "");
  25.         _new = Regex.Replace(_new, @" ", "");
  26.  
  27.         //Console.WriteLine(_new);
  28.  
  29.         double dbReturn = double.Parse(_new, System.Globalization.CultureInfo.InvariantCulture);
  30.  
  31.         return dbReturn;
  32.     }
  33.  
  34.     public ulong readULong(int LineToRead)
  35.     {
  36.         string temp = "";
  37.  
  38.         temp = allLines[LineToRead];
  39.  
  40.         string _new = Regex.Replace(temp, @"([a-z])", "");
  41.         _new = Regex.Replace(_new, @"=", "");
  42.         _new = Regex.Replace(_new, @" ", "");
  43.  
  44.         //Console.WriteLine(_new);
  45.  
  46.         ulong dbReturn = ulong.Parse(_new, System.Globalization.CultureInfo.InvariantCulture);
  47.  
  48.         return dbReturn;
  49.     }
  50.  
  51.     void GetOffsets()
  52.     {
  53.         for (int i = 0; i < 101; i++)
  54.         {
  55.             allLines[i] = "";
  56.         }
  57.  
  58.         Init();
  59.  
  60.         for (int i = 0; i < 101; i++)
  61.         {
  62.             switch (allLines[i])
  63.             {
  64.                 case "pLocalPlayerBase":
  65.                     Offsets.pLocalPlayerBase = readULong(i);
  66.                     break;
  67.                 case "pPlayerBase":
  68.                     Offsets.pPlayerBase = readULong(i);
  69.                     break;
  70.                 case "pBoneBase":
  71.                     Offsets.pBoneBase = readULong(i);
  72.                     break;
  73.                 case "m_iHealth":
  74.                     Offsets.m_iHealth = readULong(i);
  75.                     break;
  76.                 case "m_iTeamNum":
  77.                     Offsets.m_iTeamNum = readULong(i);
  78.                     break;
  79.                 case "m_blifestate":
  80.                     Offsets.m_blifestate = readULong(i);
  81.                     break;
  82.                 case "EnginePointer":
  83.                     Offsets.EnginePointer = readULong(i);
  84.                     break;
  85.                 case "pEngineVAngs":
  86.                     Offsets.pEngineVAngs = readULong(i);
  87.                     break;
  88.  
  89.                 // Add more cases for other offsets
  90.  
  91.             }
  92.         }
  93.     }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement