PDA

View Full Version : need hotkey help



desa
02-08-2008, 06:49 PM
i wanna make a scope hotkey and i'm having trubble with that, i figured that i would put the "if (GetKeyState(VK_RBUTTON) &1)" in a timer, and make a function that writes the values, i wanna have both zooms, so i added a counter, here is wut i got, this dont work hehe


void ZFunction(int ZCounter)
{
++ZCounter;
if (ZCounter == 1)
{
Writelong(0xAFB76A, 1);
}
if (ZCounter == 2)
{
Writelong(0xAFB76A, 2);
}
else
{
ZCounter = 0;
Writelong(0xAFB76A, 0);
}
}

void CDesaDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case TimerZoom:
{
if (GetKeyState(VK_RBUTTON) &1)
{
ZFunction;
}
}
break;
}
CDialog::OnTimer(nIDEvent);
}

void CDesaDlg::OnZIOn()
{
SetTimer(TimerZoom, 1, NULL);

}

void CDesaDlg::OnZIOff()
{
KillTimer(TimerZoom);

}

andyone know wuts wrong here? and yes i'm new to c++ and this is my first hack

virus7799
02-08-2008, 07:06 PM
i wanna make a scope hotkey and i'm having trubble with that, i figured that i would put the "if (GetKeyState(VK_RBUTTON) &1)" in a timer, and make a function that writes the values, i wanna have both zooms, so i added a counter, here is wut i got, this dont work hehe


void ZFunction(int ZCounter)
{
++ZCounter;
if (ZCounter == 1)
{
Writelong(0xAFB76A, 1);
}
if (ZCounter == 2)
{
Writelong(0xAFB76A, 2);
}
else
{
ZCounter = 0;
Writelong(0xAFB76A, 0);
}
}

void CDesaDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case TimerZoom:
{
if (GetKeyState(VK_RBUTTON) &1)
{
ZFunction;
}
}
break;
}
CDialog::OnTimer(nIDEvent);
}

void CDesaDlg::OnZIOn()
{
SetTimer(TimerZoom, 1, NULL);

}

void CDesaDlg::OnZIOff()
{
KillTimer(TimerZoom);

}

andyone know wuts wrong here? and yes i'm new to c++ and this is my first hack

First of all you need to enable a timer when using a hotkey.

Search for a paragraph that looks like this:


// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon

Under the SetIcon put:


SetTimer(FIRSTTIMER,1,NULL);

So it looks like this:


// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
SetTimer(FIRSTTIMER,1,NULL);

If you wanted to add more timers you'd add SECONDTIMER, THIRDTIMER etc. but remember to define them in Resource.h.

So now you would add a hotkey. I will use SuperJump as an example


void CDeasDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
if (GetAsyncKeyState(VK_CONTROL)&1)
WritePointerFloat(0x1306A70, 0x178, 2000);

}
break;

}
CDialog::OnTimer(nIDEvent);
}

So when you hold 'Control', it would be like Sky Stormer where you're basically floating in air.

Any more questions post them here.

desa
02-08-2008, 08:13 PM
ok #1 i put "SetTimer(FIRSTTIMER,1,NULL);" on a button, so i can also turn it off, will that not work for this?

#2 i want to press the button and let go, and the zoom stay on, like in game, and then if presses again, it goes to the second stage of zoom "Writelong(0xAFB76A, 2);" , and the third press make zoom go away

#3 i'm not 100% sure i have to use a time, but made sence to me

virus7799
02-08-2008, 09:39 PM
ok #1 i put "SetTimer(FIRSTTIMER,1,NULL);" on a button, so i can also turn it off, will that not work for this?

#2 i want to press the button and let go, and the zoom stay on, like in game, and then if presses again, it goes to the second stage of zoom "Writelong(0xAFB76A, 2);" , and the third press make zoom go away

#3 i'm not 100% sure i have to use a time, but made sence to me

First of all, I've never done double zoom before. All I know that the scope hotkey would look like this.

First enable the timer under the 'SetIcon' like I said before.

Then the code would look like this:

void CDesaDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case FIRSTTIMER:
{
If (GetAsyncKeyState(VK_RBUTTON)&1==1)
WriteLong(0xAFB76A, 1);
Else
WriteLong(0xAFB76A,0);
}
break;
}
CDialog::OnTimer(nIDEvent);
}

Make sure you declare the 'Writelong' function. What this basically does is when you press right click, it stays zoomed in , press it again and it zooms out.

Post any errors or questions you have.

desa
02-09-2008, 09:00 AM
alright, i got it, well i'm as as far as i can go with my hack, w/o a bypass, any chance u could teach how do make one? if not, i understand, and thanks a ton for all ur help

virus7799
02-10-2008, 06:49 PM
alright, i got it, well i'm as as far as i can go with my hack, w/o a bypass, any chance u could teach how do make one? if not, i understand, and thanks a ton for all ur help

I'm learning how to do a bypass in ASM. I'd recommend learning assembly after you know C++.