| View previous topic :: View next topic |
| Author |
Message |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 5:05 am Post subject: [C++]On/Off on one hotkey not work :o (Solved) |
|
|
HAXORZ/0x0000 - dont look at this, my problem is to turn Hack On/Off on one hotkey so i added check if its on/off and bool.
no error when compiling but i can only turn hack ON...
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
if (!HaxStatus)
{
HaxStatus = 0;
*(WORD*)HAXORZ = 0x0000;
}
else
{
HaxStatus = 1;
*(WORD*)HAXORZ = 0x0000;
} |
Last edited by Wiw3K on Mon Dec 22, 2008 10:15 am; edited 1 time in total |
|
| Back to top |
|
 |
HolyBlah Master Cheater
Reputation: 2
Joined: 24 Aug 2007 Posts: 446
|
Posted: Mon Dec 22, 2008 5:31 am Post subject: |
|
|
Change it to:
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
if (!HaxStatus)
{
HaxStatus = 1;
*(WORD*)HAXORZ = 0x0000;
}
else
{
HaxStatus = 0;
*(WORD*)HAXORZ = 0x0000;
} |
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 22, 2008 5:36 am Post subject: |
|
|
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
HaxStatus ^= 1;
*(WORD*)HAXORZ = 0x0000;
}
|
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 5:37 am Post subject: |
|
|
| HolyBlah wrote: | Change it to:
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
if (!HaxStatus)
{
HaxStatus = 1;
*(WORD*)HAXORZ = 0x0000;
}
else
{
HaxStatus = 0;
*(WORD*)HAXORZ = 0x0000;
} |
|
Still i can turn it only On...
---edit---
| Jani wrote: | | Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
HaxStatus ^= 1;
*(WORD*)HAXORZ = 0x0000;
}
|
|
no difference.
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 22, 2008 5:44 am Post subject: |
|
|
| Code: | #include <windows.h>
#include <stdio.h>
DWORD HaxStatus = 0;
void x()
{
if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
HaxStatus ^= 1;
//*(WORD*)HAXORZ = 0x0000;
}
}
int main(int argc, char *argv[])
{
for(;;) {
printf("%d", HaxStatus);
x();
Sleep(100);
}
return 0;
} | Works fine, so your problem is elsewhere: | Code: | test.exe
00000000000011111111111000011001001001001001001001101111111111111 |
EDIT: make sure that all your threads are running, since you're probably using an another thread to check the key statuses.
Last edited by Jani on Mon Dec 22, 2008 5:53 am; edited 1 time in total |
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 5:53 am Post subject: |
|
|
| Jani wrote: | | Code: | #include <windows.h>
#include <stdio.h>
DWORD HaxStatus = 0;
void x()
{
if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
HaxStatus ^= 1;
//*(WORD*)HAXORZ = 0x0000;
}
}
int main(int argc, char *argv[])
{
for(;;) {
printf("%d", HaxStatus);
x();
Sleep(100);
}
return 0;
} | Works fine, so your problem is elsewhere: | Code: | test.exe
00000000000011111111111000011001001001001001001001101111111111111 |
|
i am using Visual C++ 2008 and i am making DLL...
i had bool HaxStatus = 0; maybe this
ill edit this post if it will work.
---edit---
still only can turn ON hack -.-
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 22, 2008 5:57 am Post subject: |
|
|
| Post your code.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 6:00 am Post subject: |
|
|
| Jani wrote: | | Post your code. |
| Code: | #include "stdafx.h"
#include "windows.h"
#define JMP(frm, to) (int)(((int)to - (int)frm) - 5);
DWORD HaxStatus = 0;
// Addresses
DWORD HaxAddy = 0x00000000;
bool JDLL(void) // Main code
{
MessageBoxA(0,"Welcome in TEH TRAINZORZ.\n Press F1 In Game to View TEH TRAINZORZ.", "1337Trainzorz", 0);
for(;;) // Main loop
{
// Add hotkey checks here
if(GetAsyncKeyState(VK_F1)) //F1 = Help
{
MessageBoxA(0, "BLEBLEBLE TRAINZORZ.", "1337TRAINZORZ", 0);
Sleep(200); // So the user doesn't press the key twice
}
if(GetAsyncKeyState(VK_F4)) //F4 = Hax On/Off
{
if (!HaxStatus)
{
HaxStatus ^= 1;
*(WORD*)HaxAddy = 0x0000;
}
else
{
HaxStatus ^= 0;
*(WORD*)HaxAddy = 0x0000;
}
return true;
}
}
}
BOOL APIENTRY DllMain(HMODULE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
{
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)&JDLL, 0, 0, 0); // Main thread
}
return true;
} |
|
|
| Back to top |
|
 |
Heartless I post too much
Reputation: 0
Joined: 03 Dec 2006 Posts: 2436
|
Posted: Mon Dec 22, 2008 6:01 am Post subject: Re: [C++]On/Off on one hotkey not work :o |
|
|
| Wiw3K wrote: | HAXORZ/0x0000 - dont look at this, my problem is to turn Hack On/Off on one hotkey so i added check if its on/off and bool.
no error when compiling but i can only turn hack ON...
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
if (!HaxStatus)
{
HaxStatus = 0;
*(WORD*)HAXORZ = 0x0000;
}
else
{
HaxStatus = 1;
*(WORD*)HAXORZ = 0x0000;
} |
|
| Code: | bool On = false; //Global
if (GetAsyncKeyState(VK_F4))
{
On = !On;
HackStatus ^= 1;
*(WORD*)HAXORZ = 0x0000;
} |
_________________
What dosen't kill you, usually does the second time.
Last edited by Heartless on Mon Dec 22, 2008 6:05 am; edited 1 time in total |
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 22, 2008 6:02 am Post subject: |
|
|
| Code: | if(GetAsyncKeyState(VK_F4)) //F4 = Hax On/Off
{
HaxStatus ^= 1;
if (!HaxStatus)
*(WORD*)HaxAddy = 0x0000;
else
*(WORD*)HaxAddy = 0x0000;
} |
Don't use operators you don't know :P Learn the first and then use 'em. So, do Google how xor works.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 6:04 am Post subject: Re: [C++]On/Off on one hotkey not work :o |
|
|
| HornyAZNBoy wrote: | | Code: | if (GetAsyncKeyState(VK_F4))
{
HaxStatus = !HaxStatus;
*(WORD*)HAXORZ = 0x0000;
} |
|
how about turn it off? it should looks like that ?
| Code: | if(GetAsyncKeyState(VK_F4)) //F4 = Hax On/Off
{
HaxStatus ^= 1;
*(WORD*)HaxAddy = 0x0000;
}
else
{
*(WORD*)HaxAddy = 0x0000;
} |
|
|
| Back to top |
|
 |
Jani Grandmaster Cheater
Reputation: 2
Joined: 29 Dec 2006 Posts: 804
|
Posted: Mon Dec 22, 2008 6:08 am Post subject: Re: [C++]On/Off on one hotkey not work :o |
|
|
| Wiw3K wrote: | | how about turn it off? it should looks like that ? | HornyAZNBoy's idea is totally the same as mine, different way of implementing. The point is that the var is always changed when you execute that piece of code.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 7:26 am Post subject: Re: [C++]On/Off on one hotkey not work :o |
|
|
| Jani wrote: | | Wiw3K wrote: | | how about turn it off? it should looks like that ? | HornyAZNBoy's idea is totally the same as mine, different way of implementing. The point is that the var is always changed when you execute that piece of code. |
none of replies guys work
i know how it works -.-
After you click ex. F4 <-hack then the HaxStatus checks if its 1 or 0, if 0 then ON, if 1 then OFF. but doesnt work
|
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Mon Dec 22, 2008 7:39 am Post subject: Re: [C++]On/Off on one hotkey not work :o |
|
|
| Wiw3K wrote: | | Jani wrote: | | Wiw3K wrote: | | how about turn it off? it should looks like that ? | HornyAZNBoy's idea is totally the same as mine, different way of implementing. The point is that the var is always changed when you execute that piece of code. |
none of replies guys work
i know how it works -.-
After you click ex. F4 <-hack then the HaxStatus checks if its 1 or 0, if 0 then ON, if 1 then OFF. but doesnt work  |
in the else, you are writing the original bytes, right?
In case you do, try to debug your program, and figure out the problem.
|
|
| Back to top |
|
 |
Wiw3K Grandmaster Cheater
Reputation: 0
Joined: 09 Jul 2006 Posts: 762 Location: Poland.
|
Posted: Mon Dec 22, 2008 7:42 am Post subject: |
|
|
yes take a look,
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
if (!HaxStatus)
{
HaxStatus = 0;
*(WORD*)HAXORZ = 0x0000; //here i have modified one.
}
else
{
HaxStatus = 1;
*(WORD*)HAXORZ = 0x0000; //Here Oryginal Bytes.
} |
i can check if this works adding MessageBoxes.
| Code: | if(GetAsyncKeyState(VK_F4)) //Hax On/Off
{
if (!HaxStatus)
{
HaxStatus = 0;
*(WORD*)HAXORZ = 0x0000; //here i have modified one.
MessageBoxA(0, "Hax On", "Hax", 0);
}
else
{
HaxStatus = 1;
*(WORD*)HAXORZ = 0x0000; //Here Oryginal Bytes.
MessageBoxA(0, "Hax Off", "Hax", 0);
} |
---edit---
this is dll how i can debug? xd
|
|
| Back to top |
|
 |
|