Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C++/C Programming › [help]key trigger

[help]key trigger

Posts 1–12 of 12 · Page 1 of 1
woodz
woodz
[help]key trigger
hi, i'm almost done with my first c++ project, a glitch-tool
i just haven't found a way to trigger my program with a keyboard
can you help me?
#1 · 16y ago
Hell_Demon
Hell_Demon
Code:
if(GetAsyncKeyState(VK_NUMPAD0)&1)
{
    //code goes here
}
#2 · 16y ago
kronus980
kronus980
Yeah that's just about it
#3 · 16y ago
woodz
woodz
is this good (correct my errors plz)
Code:
#include <windows.h>

int main()
if(GetAsyncKeyState(VK_NUMPAD1)&1)
	bool Project = true
else 
	if (GetAsyncKeyState (VK_NUMPAD0)&1)
		bool Project = false
if Project = true
	{
		for(;;){
			Sleep(100);
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('s'),0,0,0);
		}
		return 0;
	}
if Project = false
	{	
		for(;;){
			Sleep(100);
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('s'),0,0,0);
		}
	}
#4 · 16y ago
why06
why06
Quote Originally Posted by woodz View Post
is this good (correct my errors plz)
The Problem isn't so much ur logic as it just seems you don't know how to write code. This will not even compile. You should be able to fix the compile errors u get for yourself. It's going to say something along the lines of:
"in function main int val is not returned."
That is because you did not put all of the lines of execution in brackets. Therefore only the first line will be executed o_O... and that line does not return an int. Also its incorrect. You did not put a semicolon on the line after ur if statement. The problem is you don't know how to program, and ur failure at these points reveals a weak grasp on the elementary concepts such as control, flow, and structure. However ur logic is there. I recommend reading the first chapter of any programming book and completing the first program, usually called: "hello world". It's a shame your going get stuck on little details when ur logic is very sound for someone just starting out. You have potential...
#5 · 16y ago
woodz
woodz
Quote Originally Posted by why06 View Post
The Problem isn't so much ur logic as it just seems you don't know how to write code. This will not even compile. You should be able to fix the compile errors u get for yourself. It's going to say something along the lines of:
"in function main int val is not returned."
That is because you did not put all of the lines of execution in brackets. Therefore only the first line will be executed o_O... and that line does not return an int. Also its incorrect. You did not put a semicolon on the line after ur if statement. The problem is you don't know how to program, and ur failure at these points reveals a weak grasp on the elementary concepts such as control, flow, and structure. However ur logic is there. I recommend reading the first chapter of any programming book and completing the first program, usually called: "hello world". It's a shame your going get stuck on little details when ur logic is very sound for someone just starting out. You have potential...
i did the hello world, i just need to reread my code next time to look for those errors.
thanx for the compliments btw
#6 · 16y ago
woodz
woodz
i fixed it,
now there is this:

what do i do? (my first dll)
#7 · 16y ago
why06
why06
hit f7 instead of f5.... there's no need to debug it. Well there is but I would just test it by injecting it into ur game manually.
#8 · 16y ago
Hell_Demon
Hell_Demon
Oh god, that looks like a mix of C++, VB and brainphuck >.>
Do as why says(no idea what he says, but im sure it contains valuable information)
#9 · 16y ago
DA
danng4280
Quote Originally Posted by woodz View Post
is this good (correct my errors plz)
Code:
#include <windows.h>

int main()
if(GetAsyncKeyState(VK_NUMPAD1)&1)
	bool Project = true
else 
	if (GetAsyncKeyState (VK_NUMPAD0)&1)
		bool Project = false
if Project = true
	{
		for(;;){
			Sleep(100);
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('s'),0,0,0);
		}
		return 0;
	}
if Project = false
	{	
		for(;;){
			Sleep(100);
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('s'),0,0,0);
		}
	}
Fixed and added comments for you
Code:
#include <windows.h>

bool Running;

int main(){
	while (true){ //infinite loop
		if(GetAsyncKeyState(VK_NUMPAD1)&1)//if numpad1 is pressed start pressing keys
			Running = true;
		while (Running) { //as long as Running == true, will continue to press buttons
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('z'),0,KEYEVENTF_KEYUP,0);//lifts up z key
			keybd_event(VkKeyScan('s'),0,0,0);
			keybd_event(VkKeyScan('s'),0,KEYEVENTF_KEYUP,0); //lifts up s key
			Sleep(100);
			if (GetAsyncKeyState(VK_NUMPAD0)&1)
				Running = false; // if you press numpad0 it will stop pressing buttons
		}
	}
	return 1; //although this will never be reached because of the infinite loop, it is necessary...
}
#10 · 16y ago
zhaoyun333
zhaoyun333
Quote Originally Posted by danng4280 View Post
Fixed and added comments for you
Code:
#include <windows.h>

bool Running;

int main(){
	while (true){ //infinite loop
		if(GetAsyncKeyState(VK_NUMPAD1)&1)//if numpad1 is pressed start pressing keys
			Running = true;
		while (Running) { //as long as Running == true, will continue to press buttons
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('z'),0,KEYEVENTF_KEYUP,0);//lifts up z key
			keybd_event(VkKeyScan('s'),0,0,0);
			keybd_event(VkKeyScan('s'),0,KEYEVENTF_KEYUP,0); //lifts up s key
			Sleep(100);
			if (GetAsyncKeyState(VK_NUMPAD0)&1)
				Running = false; // if you press numpad0 it will stop pressing buttons
		}
	}
	return 1; //although this will never be reached because of the infinite loop, it is necessary...
}

intialize running as false o.O?
#11 · 16y ago
DA
danng4280
Quote Originally Posted by zhaoyun333 View Post
intialize running as false o.O?
Lol oops, I'm used to java where it is initialized as false nice catch
Code:
#include <windows.h>

bool Running;

int main(){
	Running = false;
	while (true){ //infinite loop
		if(GetAsyncKeyState(VK_NUMPAD1)&1)//if numpad1 is pressed start pressing keys
			Running = true;
		while (Running) { //as long as Running == true, will continue to press buttons
			keybd_event(VkKeyScan('z'),0,0,0);
			keybd_event(VkKeyScan('z'),0,KEYEVENTF_KEYUP,0);//lifts up z key
			keybd_event(VkKeyScan('s'),0,0,0);
			keybd_event(VkKeyScan('s'),0,KEYEVENTF_KEYUP,0); //lifts up s key
			Sleep(100);
			if (GetAsyncKeyState(VK_NUMPAD0)&1)
				Running = false; // if you press numpad0 it will stop pressing buttons
		}
	}
	return 1; //although this will never be reached because of the infinite loop, it is necessary...
}
#12 · 16y ago
Posts 1–12 of 12 · Page 1 of 1

Post a Reply

Similar Threads

  • [Help]Key File[Solved]By MJLover in Visual Basic Programming
    7Last post 16y ago
  • [need Help] Key EventsBy ryski123 in Programming Tutorial Requests
    0Last post 15y ago
  • Kingz Of Key's V2.0 Need Help With Release!By Redbull in WarRock - International Hacks
    13Last post 19y ago
  • I get error key code already in use some one can help???By aprill27 in Call of Duty 4 - Modern Warfare (MW) Hacks
    6Last post 18y ago
  • Key Gen HelpBy SethKrieg24 in Call of Duty 4 - Modern Warfare (MW) Hacks
    6Last post 18y ago

Tags for this Thread

None