Advertisement
Guest User

Lolz

a guest
May 6th, 2011
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. //make memory writable function
  2. void MakePageWritable(CONST LPVOID lpvAddress, CONST SIZE_T cbSize)
  3. {
  4. MEMORY_BASIC_INFORMATION mbi;
  5. VirtualQuery(lpvAddress, &mbi, sizeof(MEMORY_BASIC_INFORMATION));
  6. if (mbi.Protect != PAGE_EXECUTE_READWRITE)
  7. {
  8. unsigned long ulProtect;
  9. VirtualProtect(lpvAddress, cbSize, PAGE_EXECUTE_READWRITE, &ulProtect);
  10. }
  11. }
  12.  
  13. int HP, MAXHP, MP, MAXMP, EXP, MAXEXP;
  14.  
  15. DWORD dwStatAddy = 0x009034BC;
  16. DWORD dwStatJump = *(int*)(dwStatAddy + 1) + dwStatAddy + 5;
  17.  
  18. __declspec(naked) void __stdcall StatHook()
  19. {
  20. __asm
  21. {
  22. push eax
  23. mov eax, [esp + 0x08]
  24. mov [HP], eax
  25. mov eax, [esp + 0x0c]
  26. mov [MAXHP], eax
  27. mov eax, [esp + 0x10]
  28. mov [MP], eax
  29. mov eax, [esp + 0x14]
  30. mov [MAXMP], eax
  31. mov eax, [esp + 0x18]
  32. mov [EXP], eax
  33. mov eax, [esp + 0x1c]
  34. mov [MAXEXP], eax
  35. pop eax
  36. jmp dword ptr[dwStatJump]
  37. }
  38. }
  39.  
  40. void CreateStatHook()
  41. {
  42. //virtual protect here
  43. MakePageWritable((LPVOID)dwStatAddy, 5); //you will have to do this for every hack you have.
  44. *(DWORD*)(dwStatAddy + 1) = jmp(dwStatAddy, StatHook);
  45. }
  46.  
  47. //auto potter here
  48.  
  49. int PotHpAt = 0;
  50. int PotMpAt = 0;
  51.  
  52. bool HpLoopEnabled = false;
  53. bool MpLoopEnabled = false;
  54.  
  55. void CheckHPMP()
  56. {
  57. while(true)
  58. {
  59. if(HpLoopEnabled)
  60. {
  61. if(PotHpAt > HP && HP != 0 && MAXHP > PotHpAt)
  62. {
  63. //if pot value is more than current hp
  64. //and if hp isnt 0
  65. //and if max hp is greater than pot value
  66. SendMsKey(VK_NEXT); //your pot key here. Page Up
  67. }
  68. }
  69. if(MpLoopEnabled)
  70. {
  71. if(PotMpAt > MP && MAXMP > PotMpAt && HP != 0)
  72. {
  73. SendMsKey(VK_PRIOR);
  74. }
  75. }
  76. Sleep(50);
  77. }
  78. }
  79.  
  80. void Form1::textBox5_TextChanged(System::Object^ sender, System::EventArgs^ e)
  81. {
  82. if(this->textBox5->Text == "")
  83. HpLoopEnabled = false;
  84. if(this->textBox5->Text != "")
  85. HpLoopEnabled = true;
  86. if(this->textBox5->Text == "VALUE" || this->textBox5->Text == "value")
  87. HpLoopEnabled = false;
  88.  
  89. try
  90. {
  91. PotHpAt = Convert::ToInt32(this->textBox5->Text);
  92. }catch(...)
  93. {
  94. PotHpAt = 0;
  95. };
  96. }
  97.  
  98. void Form1::textBox6_TextChanged(System::Object^ sender, System::EventArgs^ e)
  99. {
  100. if(this->textBox6->Text == "")
  101. HpLoopEnabled = false;
  102. if(this->textBox6->Text != "")
  103. HpLoopEnabled = true;
  104. if(this->textBox6->Text == "VALUE" || this->textBox5->Text == "value")
  105. HpLoopEnabled = false;
  106.  
  107. try
  108. {
  109. PotMpAt = Convert::ToInt32(this->textBox6->Text);
  110. }catch(...)
  111. {
  112. PotMpAt = 0;
  113. };
  114. }
  115.  
  116. void Form1::Form1_Load(System::Object^ sender, System::EventArgs^ e)
  117. {
  118. CreateStatHook(); //as soon as the trainer gets injected it will hook stats
  119. CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&CheckHPMP, NULL, 0, NULL);
  120. }
  121.  
  122. void Form1::timer1_Tick(System::Object^ sender, System::EventArgs^ e)
  123. {
  124. int CurrentHP = 0;
  125. int CurrentMP = 0;
  126. int CurrentEXP = 0;
  127.  
  128. try
  129. {
  130. CurrentHP = (HP / MAXHP) * 100;
  131. CurrentMP = (MP / MAXMP) * 100;
  132. CurrentEXP = (EXP / MAXEXP) * 100;
  133. }catch(...){};
  134.  
  135. this->progressBar1->Value = CurrentHP;
  136. this->progressBar2->Value = CurrentMP;
  137. this->progressBar3->Value = CurrentEXP;
  138.  
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement