Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  BFHL auto
Language: C/C++
Code:
    #include <iostream>
    #include <Windows.h>
     
    class Mem
    {
    private:
         DWORD pid;
         HANDLE Handle;
         DWORD64 value;
    public:
         inline bool OpenTargetProcess(char * windowName)
         {
              HWND Hwnd = FindWindowA(NULL, windowName);
              if (!Hwnd) return false;
              GetWindowThreadProcessId(Hwnd, &pid);
              Handle = OpenProcess(PROCESS_ALL_ACCESS, false, pid);
              return Handle;
         }
         inline Mem *Read(DWORD64 address)
         {
              this->value = address;
              return (this->r(0));
         }
         inline Mem *r(DWORD64 ofs)
         {
              if (!this || !value)
                   return 0;
     
              if (!ReadProcessMemory(Handle, (void*)(value + ofs), &value, sizeof(DWORD64), 0))
                   return 0;
     
              return this;
         }
         template <typename T>
         inline bool Get(DWORD64 ofs, LPVOID buffer)
         {
              if (Handle == 0 || !value)
                   return false;
     
              if (!ReadProcessMemory(Handle, (void*)(value + ofs), (LPVOID)(buffer), sizeof(T), 0))
                   return false;
     
              return true;
         }
         template <typename T>
         inline bool Write(DWORD64 ofs, T buffer)
         {
              if (Handle == 0 || !value)
                   return false;
     
              if (!WriteProcessMemory(Handle, (void*)(value + ofs), &buffer, sizeof(T), 0))
                   return false;
     
              return true;
         }
    };
     
    int main()
    {
         Mem m;
         if (!m.OpenTargetProcess("Battlefield Hardline"))
         {
              printf("Fail to open the process");
              return 0;
         }
         else{
              printf("OK BFH...n");
         }
         if (m.Read(0x14252BE60)->r(0x49C8)->r(0x78)->r(0x8)) // OFFSET_ANGLES
         {
             m.Write<float>(0x0360, 0.0f);  // NoSpread
              m.Write<float>(0x0364, 0.0f);  // NoSpread
              m.Write<float>(0x0368, 0.0f);  // NoSpread
              m.Write<float>(0x036C, 0.0f);  // NoSpread
              m.Write<float>(0x0374, 0.0f);  // NoRecoil
              m.Write<float>(0x0370, 100.0f);// NoRecoil
         }
         if (m.Read(0x142812B00)->r(0x68)->r(0x540)->r(0x0DF8)->r(0x05B8)) // OFFSET_GAMECONTEXT 
         {
              m.Write<float>(0x58, 0.0f); // No Breath  
         }
         else
         {
              printf("Fail...");
         }
         Sleep(100);
         return 0;
    }
          
Comments: