I need help making a working timer in c++ for stamina, and all the things that need to be freezed, here is what I got, see if you can help me out.
Code:
void memory()
{
HWND hWnd = FindWindow(0, "WarRock");
GetWindowThreadProcessId(hWnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS|PROCESS_VM_OPERATION|PROCESS_VM_READ|PROCESS_VM_WRITE|PROCESS_QUERY_INFORMATION, FALSE, proc_id);
}
void CMyTrainer1Dlg::OnTimer(UINT nIDEvent)
{
if (stamina == true)
{
long staddy = 0x12F06C0;
short stoffset = 288;
float stvalue = 1120403456;
long stmaddy;
long stsaddy;
memory();
ReadProcessMemory(hProcess, (LPVOID*)(DWORD) staddy, &stmaddy, sizeof(stmaddy), NULL);
stsaddy = stmaddy + stoffset;
WriteProcessMemory(hProcess, (LPVOID*)(DWORD) stsaddy, &stvalue, sizeof(stvalue), NULL);
}
CDialog::OnTimer(nIDEvent);
}
void CMyTrainer1Dlg::OnStamOn()
{
stamina = true;
}
void CMyTrainer1Dlg::OnStamOff()
{
stamina = false;
}