C++ Keys

user88

Well-known member
Joined
Jun 29, 2017
Messages
426
Reaction score
165
Location
LINK CLEO DICE HACK HERE!
Hello
Code:
if (menuShown)
		{
			if (GetAsyncKeyState(VK_DOWN) &1 && menupos < hacknames.size())
			{
				menupos++;
			}else if (GetAsyncKeyState(VK_UP) &1 && menupos > 1) {
				menupos--;

			}


			if (GetAsyncKeyState(VK_RETURN) & 1)
			{
			  // do my shit
			}

		}


(yes fucky english iknow)
thx
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
174
Where's the logic? For the UD-LR keys ok.. But putting your menu on RETURN will always result in the player entering the car because you want to lock controls if you open the menu not b4 the menu has been opened because they won't be able to enter any car anymore.

About patching controls, you also can just put a return in the game's PeekMessage loop / WndProc func.
 

user88

Well-known member
Joined
Jun 29, 2017
Messages
426
Reaction score
165
Location
LINK CLEO DICE HACK HERE!
thx 4 reply
 game's PeekMessage loop
maybe im too retarded for this ..
do you have an example 4 meh?

i try to find the controls functions like enter vehicle etc in Cheat engine

i have no point to start. 
do you know where i can start to search da shiet?
 

y0mike

Active member
Joined
May 10, 2014
Messages
97
Reaction score
41
Location
mizus girl's house
user88 said:
thx 4 reply
 game's PeekMessage loop
maybe im too retarded for this ..
do you have an example 4 meh?

i try to find the controls functions like enter vehicle etc in Cheat engine

i have no point to start. 
do you know where i can start to search da shiet?

similar to what 0x688 said

You can use SetWindowsHookEx and install a keyboard hook.. 

then check if KBDLLHOOKSTRUCT->vkCode == ur menu open button & wparam = keydown { menu = !menu; if (menu) return non zero.. should work..


also a quick google search woulda answered this quicker
https://stackoverflow.com/questions/12334082/how-to-disable-a-key-in-another-program
 

user88

Well-known member
Joined
Jun 29, 2017
Messages
426
Reaction score
165
Location
LINK CLEO DICE HACK HERE!
Code:
EXPORT BOOL CALLBACK SetupHook(HWND hParent) {
	hWindow = hParent;
	 
	hhkHook = SetWindowsHookEx(WH_KEYBOARD, KeyboardHookProc, hDllInstance, NULL);
	
	return TRUE;
}

LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
	if (nCode == HC_ACTION)
	{
		if (wParam == WM_KEYDOWN)
		{
			kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
			if (kbdStruct.vkCode == VK_F1)
			{
				
				MessageBox(NULL, "F1 pressed!", "key pressed", MB_ICONINFORMATION);
			}
		}
	}


	return CallNextHookEx(hhkHook, nCode, wParam, lParam);
	
}



bool WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{

		hDllInstance = hMod;
		HWND hWnd = ::FindWindow(NULL, "GTA:SA:MP");
		SetupHook(hWnd); // keyhook
                //.....
im try with this, but no msgbox, if i press F1 :/
 

ini

Well-known member
Joined
Sep 28, 2015
Messages
321
Reaction score
115
HWND hWnd = ::FindWindow(NULL, "GTA:SA:MP"); sure is right?


try  that , this worked for me correcly:

Code:
//Dllmain
CreateThread(0, NULL, (LPTHREAD_START_ROUTINE)&WndProcHook, NULL, NULL, NULL);

LONG OldWndProc;
HWND hWnd = FindWindow(NULL, (LPCSTR)"GTA:SA:MP");
LRESULT CALLBACK NewWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_KEYDOWN:
switch (wParam)
{
case VK_F1:
OutputDebugString("F1 pressed!");
break;
}
break;
}
return CallWindowProc((WNDPROC)OldWndProc, hwnd, msg, wParam, lParam);
}

DWORD WINAPI WndProcHook(LPVOID)
{
OldWndProc = SetWindowLong(hWnd, GWL_WNDPROC, (long)NewWndProc);
return TRUE;
}



btw i suggest you to take a look into s0beit source code where you can find a huge information.
 

y0mike

Active member
Joined
May 10, 2014
Messages
97
Reaction score
41
Location
mizus girl's house
user88 said:
Code:
EXPORT BOOL CALLBACK SetupHook(HWND hParent) {
	hWindow = hParent;
	 
	hhkHook = SetWindowsHookEx(WH_KEYBOARD, KeyboardHookProc, hDllInstance, NULL);
	
	return TRUE;
}

LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
	if (nCode == HC_ACTION)
	{
		if (wParam == WM_KEYDOWN)
		{
			kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
			if (kbdStruct.vkCode == VK_F1)
			{
				
				MessageBox(NULL, "F1 pressed!", "key pressed", MB_ICONINFORMATION);
			}
		}
	}


	return CallNextHookEx(hhkHook, nCode, wParam, lParam);
	
}



bool WINAPI DllMain(HMODULE hMod, DWORD dwReason, LPVOID lpReserved)
{
	if (dwReason == DLL_PROCESS_ATTACH)
	{

		hDllInstance = hMod;
		HWND hWnd = ::FindWindow(NULL, "GTA:SA:MP");
		SetupHook(hWnd); // keyhook
                //.....
im try with this, but no msgbox, if i press F1 :/

Export book callback? Lmao no reason for that. Use CreateThread on setuphook, and u can change it to dword Winapi, I'm on my phone rn but it seems like ur not doing the message loop, copy paste the code in the stackoverflow link
 
Top