Click here to Skip to main content
15,889,867 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have an online game, which players have an ID and a PASSWORD to enter, but there is a hack which can be turned on or off with the following keys (INSERT, DELETE and F1) I want to identify the users who press those keys , and save in a log.txt file the id of those users to know who they are.

What I have tried:

C++
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <fstream>
Using namespace std;
Int main()
{
ofstream archivo("userhack.txt", ios::out);

if(GetAsyncKeyState(VK_END)){

}
if(GetAsyncKeyState(VK_DELETE)){

}
if(GetAsyncKeyState(VK_F1)){

}
}
Posted
Updated 29-Mar-21 7:01am
v2
Comments
OriginalGriff 29-Mar-21 13:18pm    
And?
What have you tried?
Where are you stuck?
What help do you need?
Member 15125356 29-Mar-21 13:24pm    
The code I'm testing is the one I put there, but I need the user id to be saved in the txt file but I can't do it.
Dave Kreskowiak 29-Mar-21 13:25pm    
Insufficient information. Is this some game you've written? What is this code you've posted?

What you've posted isn't going to work as the code is going to run once and then quit.
Member 15125356 29-Mar-21 13:29pm    
I haven't written the game, but I manage the game, but I don't have enough knowledge of C ++ to do what I want to do.
Dave Kreskowiak 29-Mar-21 13:34pm    
Well, that changes things vastly. Your idea isn't going to work at all unless you can get all the users to install your little spyware app. But yeah, "Hey, everyone needs to install this app so I can catch you cheating" isn't going to go over well.

The GetAsyncKeyState only looks at the keyboard on the machine it's running on, namely YOURS. It will NOT examine keyboards of remote machines.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900