SolvedHow do I make a hotkey in C++ (GetAsyncKeyState) Thing

Posts 1–13 of 13 · Page 1 of 1
How do I make a hotkey in C++ (GetAsyncKeyState) Thing
Title says it all. How to make the hotkey I searched through the internet the results I get is the GetAsyncKeyState method. The full thing is

bool hackname = 0;

if (GetAsyncKeyState(VK_F3) & 1) {
Beep(1000, 500);
crosshair = !crosshair
}

I do not know what is the beep for but anyways I stole it from the web since I kept getting errors. Why is it the syntax error down there?
Oh yes, this: error C2143: syntax error : missing ';' before '{'. (Someone explain this)

This to :error C2447: '{' : missing function header (old-style formal list?)

And IntelliSense expected a declaration ??? (EXPLAIN Please)
here
void Hacks(){
while(1)
{


if(GetAsyncKeyState(VK_Insert)&1)
{
Quote Originally Posted by COD3RIN View Post
here
void Hacks(){
while(1)
{


if(GetAsyncKeyState(VK_Insert)&1)
{
Thanks going to try it out .
the "beep" function for the sound when u press F3 i think.
Quote Originally Posted by MasterBed View Post
the "beep" function for the sound when u press F3 i think.
I see beep function is for the sound.
if (Supercross)AeroMan->SuperCrosshair(pDevice, Supercross, GREEN, 15);
void Crosshair(IDirect3DDevice9 *pDevice, DWORD defenition, DWORD Collor, DWORD Size);

int draw = 0;
void Hacks(){
while (1)
{
if (GetAsyncKeyState(VK_INSERT) & 1)
{
if (draw){ draw = 1; }
else { draw = 0; }
}
}
}

There is a syntax error in the "if" on the top help @COD3RIN
And the IntelliSense thingy idk what happened -.-
Quote Originally Posted by HaruShots View Post

Title says it all. How to make the hotkey I searched through the internet the results I get is the GetAsyncKeyState method. The full thing is

bool hackname = 0;

if (GetAsyncKeyState(VK_F3) & 1) {
Beep(1000, 500);
crosshair = !crosshair
}

I do not know what is the beep for but anyways I stole it from the web since I kept getting errors. Why is it the syntax error down there?
Oh yes, this: error C2143: syntax error : missing ';' before '{'. (Someone explain this)

This to :error C2447: '{' : missing function header (old-style formal list?)

And IntelliSense expected a declaration ??? (EXPLAIN Please)
You are missing a semi-column ( ; ) after ( crosshair = !crosshair ):

Code:
if (GetAsyncKeyState(VK_F3) & 1)
{
    Beep(1000, 500);
    crosshair = !crosshair; // semi-column added
}
Quote Originally Posted by rullof View Post
You are missing a semi-column ( ; ) after ( crosshair = !crosshair ):

Code:
if (GetAsyncKeyState(VK_F3) & 1)
{
    Beep(1000, 500);
    crosshair = !crosshair; // semi-column added
}
Ouh thanks!
So I solved the problem except the if I mention to get a look at the codes here they are: @COD3RIN @rullof

Quote Originally Posted by HaruShots View Post
So I solved the problem except the if I mention to get a look at the codes here they are: @COD3RIN @rullof

The ( if ) statment ( The whole block ) is in the global scope, while the global scope only accepts declarations. You must put the ( if ) inside a function.

Also an advice from me: "Stay away from programming"
Quote Originally Posted by rullof View Post
The ( if ) statment ( The whole block ) is in the global scope, while the global scope only accepts declarations. You must put the ( if ) inside a function.

Also an advice from me: "Stay away from programming"
Thanks for the advice and the explanation
lol study the very basic first...
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?