Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //make memory writable function
- void MakePageWritable(CONST LPVOID lpvAddress, CONST SIZE_T cbSize)
- {
- MEMORY_BASIC_INFORMATION mbi;
- VirtualQuery(lpvAddress, &mbi, sizeof(MEMORY_BASIC_INFORMATION));
- if (mbi.Protect != PAGE_EXECUTE_READWRITE)
- {
- unsigned long ulProtect;
- VirtualProtect(lpvAddress, cbSize, PAGE_EXECUTE_READWRITE, &ulProtect);
- }
- }
- int HP, MAXHP, MP, MAXMP, EXP, MAXEXP;
- DWORD dwStatAddy = 0x009034BC;
- DWORD dwStatJump = *(int*)(dwStatAddy + 1) + dwStatAddy + 5;
- __declspec(naked) void __stdcall StatHook()
- {
- __asm
- {
- push eax
- mov eax, [esp + 0x08]
- mov [HP], eax
- mov eax, [esp + 0x0c]
- mov [MAXHP], eax
- mov eax, [esp + 0x10]
- mov [MP], eax
- mov eax, [esp + 0x14]
- mov [MAXMP], eax
- mov eax, [esp + 0x18]
- mov [EXP], eax
- mov eax, [esp + 0x1c]
- mov [MAXEXP], eax
- pop eax
- jmp dword ptr[dwStatJump]
- }
- }
- void CreateStatHook()
- {
- //virtual protect here
- MakePageWritable((LPVOID)dwStatAddy, 5); //you will have to do this for every hack you have.
- *(DWORD*)(dwStatAddy + 1) = jmp(dwStatAddy, StatHook);
- }
- //auto potter here
- int PotHpAt = 0;
- int PotMpAt = 0;
- bool HpLoopEnabled = false;
- bool MpLoopEnabled = false;
- void CheckHPMP()
- {
- while(true)
- {
- if(HpLoopEnabled)
- {
- if(PotHpAt > HP && HP != 0 && MAXHP > PotHpAt)
- {
- //if pot value is more than current hp
- //and if hp isnt 0
- //and if max hp is greater than pot value
- SendMsKey(VK_NEXT); //your pot key here. Page Up
- }
- }
- if(MpLoopEnabled)
- {
- if(PotMpAt > MP && MAXMP > PotMpAt && HP != 0)
- {
- SendMsKey(VK_PRIOR);
- }
- }
- Sleep(50);
- }
- }
- void Form1::textBox5_TextChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if(this->textBox5->Text == "")
- HpLoopEnabled = false;
- if(this->textBox5->Text != "")
- HpLoopEnabled = true;
- if(this->textBox5->Text == "VALUE" || this->textBox5->Text == "value")
- HpLoopEnabled = false;
- try
- {
- PotHpAt = Convert::ToInt32(this->textBox5->Text);
- }catch(...)
- {
- PotHpAt = 0;
- };
- }
- void Form1::textBox6_TextChanged(System::Object^ sender, System::EventArgs^ e)
- {
- if(this->textBox6->Text == "")
- HpLoopEnabled = false;
- if(this->textBox6->Text != "")
- HpLoopEnabled = true;
- if(this->textBox6->Text == "VALUE" || this->textBox5->Text == "value")
- HpLoopEnabled = false;
- try
- {
- PotMpAt = Convert::ToInt32(this->textBox6->Text);
- }catch(...)
- {
- PotMpAt = 0;
- };
- }
- void Form1::Form1_Load(System::Object^ sender, System::EventArgs^ e)
- {
- CreateStatHook(); //as soon as the trainer gets injected it will hook stats
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&CheckHPMP, NULL, 0, NULL);
- }
- void Form1::timer1_Tick(System::Object^ sender, System::EventArgs^ e)
- {
- int CurrentHP = 0;
- int CurrentMP = 0;
- int CurrentEXP = 0;
- try
- {
- CurrentHP = (HP / MAXHP) * 100;
- CurrentMP = (MP / MAXMP) * 100;
- CurrentEXP = (EXP / MAXEXP) * 100;
- }catch(...){};
- this->progressBar1->Value = CurrentHP;
- this->progressBar2->Value = CurrentMP;
- this->progressBar3->Value = CurrentEXP;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement