[Help] Controllable Hotkeys

Posts 115 of 20 · Page 1 of 2
[Help] Controllable Hotkeys
Hey guys.

Im trying to make a controllable hotkey.
Say with speedhack, Each time the hotkey is pressed/held it will add/subtract a value from the origional PushToConsole.

How would i do this?

I have tried to do it like this, But its not working. Can anyone help me please?


[php]
int XPos = 200;
char PushX[20];

if(GetAsyncKeyState(VK_NUMPAD1)&1)
{
XPos = XPos - 100;
sprintf(PushX,"MyCommad %d", XPos);
Push(PushX);
}
[/php]

Help appreciated.
Quote Originally Posted by ac1d_buRn View Post
Hey guys.

Im trying to make a controllable hotkey.
Say with speedhack, Each time the hotkey is pressed/held it will add/subtract a value from the origional PushToConsole.

How would i do this?

I have tried to do it like this, But its not working. Can anyone help me please?


[php]
int XPos = 200;
char PushX[20];

if(GetAsyncKeyState(VK_NUMPAD1)&1)
{
XPos = XPos - 100;
sprintf(PushX,"MyCommad %d", XPos);
Push(PushX);
}
[/php]

Help appreciated.
Sorry I'm not too C++ savvy, but could you add a

[php]
while(GetAsyncKeyState(VK_NUMPAD1)<0)
{
XPos -= 100;
//yadda yadda
}
[/php]

So while the key is held down, do whatever?
Code:
if(GetAsyncKeyState(VK_F1)&1){
if(SPEED == 100){
   SPEED = 0;
}
else{
   SPEED+= 10;
}
}
if(Speehack){
 PushToConsole("speed "+SPEED);// i know speed isnt the actual command but yeah
}
btw remeber between the console command and the value put a space befor ending quotes
and you can change the value of SPEED to a float so that its the actual value
hope it helps!

Quote Originally Posted by Jason View Post


Sorry I'm not too C++ savvy, but could you add a

[php]
while(GetAsyncKeyState(VK_NUMPAD1)<0)
{
XPos -= 100;
//yadda yadda
}
[/php]

So while the key is held down, do whatever?
dont use < 0 it makes it go fast use that for holding a button down other wise use &1
Quote Originally Posted by TheFallenOwns View Post
dont use < 0 it makes it go fast use that for holding a button down other wise use &1
Yes, I'm aware of that, however:

Quote Originally Posted by ac1d_buRn
Each time the hotkey is pressed/held

My example was for the "held down" part of his request.

If necessary a sleep function can be implemented before the end of the loop.
thank you!
Thanks guys. Ill test this out later.
Quote Originally Posted by ac1d_buRn View Post
Thanks guys. Ill test this out later.
Solved or not?
i have a completly working but different way
add the vars
Code:
int speeda = 70;
int speedb = 285;
int speedc = 285;
int speedd = 285;
and this is the hotkey part
Code:
//speed
//Left{-1}/Right{+1}/end{Default}
char speeder[255];
if(GetAsyncKeyState(VK_END)<0){
	speeda = 70;
	speedb = 285;
	speedc = 285;
	speedd = 285;
}

if(GetAsyncKeyState(VK_LEFT)<0){
	speeda = speeda - 50;
	speedb = speedb - 50;
	speedc = speedc - 50;
	speedd = speedd - 50;
}

if(GetAsyncKeyState(VK_RIGHT)<0){
	speeda = speeda + 50;
	speedb = speedb + 50;
	speedc = speedc + 50;
	speedd = speedd + 50;
}

sprintf(speeder,"WalkVel %d",speeda);
PTC(speeder);

sprintf(speeder,"FRunVel %d",speedb);
PTC(speeder);

sprintf(speeder,"BRunVel %d",speedc);
PTC(speeder);

sprintf(speeder,"SRunVel %d",speedd);
PTC(speeder);

Sleep(50);
works perfect for what ur after i think

im not sure about the held down part tho
i never tried holding down my hotkeys

but its worth a shot


i also have this for virtual jump if you want that
but if i find out u use my code with out credits i will hurt ur computer jk
but for reals give credits if u use
@ zoom
where the do come from...its like r not here one day then like a day later the entire section is clean and modded lol
Quote Originally Posted by tahha View Post
@ zoom
where the do come from...its like r not here one day then like a day later the entire section is clean and modded lol
Sweden.

I was on a 3 days vacation, lol

VM system next time, thank you.
oh kool and sorry i will vm.
i forgot that was there lol
i havent been on mpgh in a while.
Quote Originally Posted by moallem View Post
tnx goods code
Spam less pl0xz
Quote Originally Posted by Crash View Post
Spam less pl0xz
Quote Originally Posted by ~Shadow View Post
tnx good codes
Spam less pl0xz.
tnx goods code
I CAN GO ALL DAY NIG.

tnxs good code
Posts 115 of 20 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?