GetAsyncKeyState

04/27/2013 12:49 winkabean#1
Hello Guys,

Code:
if (GetAsyncKeyState(VK_SHIFT) &1)
only works if you hold down the shift button. But is there anyway to make it so that if you press it once then it stays on. And if you press it again it goes off. Instead of holding down the shift key?

would this work:

Code:
if (GetAsyncKeyState(VK_SHIFT) &1)

		{
			*(float*)(*inGame + ADR_OFS_NORECOIL1) = 1;
			*(float*)(*inGame + ADR_OFS_NORECOIL2) = 1;
			*(float*)(*inGame + ADR_OFS_NORECOIL3) = 1;
		}
		else
		{
			*(float*)(*inGame + ADR_OFS_NORECOIL1) = 0;
			*(float*)(*inGame + ADR_OFS_NORECOIL2) = 0;
			*(float*)(*inGame + ADR_OFS_NORECOIL3) = 0;
		}
04/27/2013 13:34 MadnessFreak#2
Code:
bool temp = false;

if (GetAsyncKeyState(VK_SHIFT) &1)
{
	temp = (temp ? false : true);

	if (temp)
	{
		*(float*)(*inGame + ADR_OFS_NORECOIL1) = 1;
		*(float*)(*inGame + ADR_OFS_NORECOIL2) = 1;
		*(float*)(*inGame + ADR_OFS_NORECOIL3) = 1;
	}
	else
	{
		*(float*)(*inGame + ADR_OFS_NORECOIL1) = 0;
		*(float*)(*inGame + ADR_OFS_NORECOIL2) = 0;
		*(float*)(*inGame + ADR_OFS_NORECOIL3) = 0;
	}
}
04/27/2013 15:01 5ubZer0#3
Warum das Async & 1
einfach rauslassen, dann musste es auch nur einmal drücken ^^
btw. No Recoil = Recoil -> 0
also hast du es immer an, ausser wenn du shift drückst :D