Solved Function On And Off

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

lukaluka

Coder
Meme Tier VIP
Jul 6, 2015
285
1,213
3
Hi All,

I'm Have A Problem About Returning Value, I Can Enable The Hack, but I Can't Disable.
I'm Confusing About Returning Value To The Original.

This Is My Function :

if ( airbreather == 1 )
{
ReadMemory((void*)airbreather_addy,0x90,3);
}
if ( airbreather == 0 )
{
WriteMemory((void*)airbreather_addy,(void*)"\xD9\x41\x44",3);
}

This Function Is Crashing Target Game,
But If I'm Remove The " Else Function / airbreather == 0 " Or Returning Value, This Game Will Be Running Normally Without Crash.

But, If Returning Function Is Removed, I'm Can't Disable The Hack Function.

Please Help. Give Me Solution About Enable And Disable In One Function Hack.

My Project Is D3D Menu, Tested Work On GTA 4 Without Returning Value.

Help Me Returning Value Function To The Original, So I Can Disable The Hack Feature.

This Is Logically Source Function :
Source It's So Much,
I'm Will Show Using The Logically.

//=========== Address ============
DWORD AC_CLIENT = (DWORD)GetModuleHandleA("gta_sa.exe");

#define health_addy 0x4B331F//\x89\x96\x00\x00\x00\x00//
#define ammo_addy 0x7428B0//\x89\x46\x08\x8B\x46\x0C//
#define airbreather_addy 0x60A8F4//\xD9\x41\x44\xD8\x1D\x00//
//===========Gamemaster===========
int Qmo1 = 0;
int health = 0;
int ammo = 0;
int airbreather = 0;
int Smoke = 0;
int Fog = 0;
int Menuz = 0;
int exitforce = 0;
bool hooked=false;
bool CekHook=false;
bool Gamemaster=true;

//I'm Will Skip The Source, Because it's so much

//-----------------------------MENU---------------------------------------------------------------------------------------------------
char Mtitle [] = "";
char *Moptfolder [] = {"OPEN" , "CLOSE"};
char *Moptonoff [] = {"OFF" , "ON"};
char *Mopexit [] = {"\nShow" , "\nF12"};
char *optColor1 [11] = {"OFF" , "ON"};
char *optColor2 [11] = {"OFF" , "ON"};

void RebuildMenu(void)
{
MenuAddItem ("Menu" ,Moptfolder , &Menuz , 2, MENUFOLDER);
if (Menuz)
{
MenuAddItem ("Wallhack" ,Moptonoff , &Qmo1 , 2, MENUITEM);
MenuAddItem ("No Smoke" ,Moptonoff , &Smoke , 2, MENUITEM);
MenuAddItem ("No Fog" ,Moptonoff , &Fog , 2, MENUITEM);
MenuAddItem ("Unlimited Ammo" ,Moptonoff , &ammo , 2, MENUITEM);
MenuAddItem ("Unlimited Health" ,Moptonoff , &health , 2, MENUITEM);
MenuAddItem ("Unlimited Air Breather" ,Moptonoff , &airbreather , 2, MENUITEM);
MenuAddItem ("\nForce Exit" ,Mopexit , &exitforce , 2, MENUITEM);
}
}

Look Menu Unlimited Airbreather?
This Function Will Changed The "int airbreather value to 1"

And Then The Continued To The This Function.

//============== Air Breather =====================
if ( airbreather == 1 ) //if D3D Select On
{
ReadMemory((void*)airbreather_addy,0x90,3);
}
if ( airbreather == 0 ) if d3d select off
{
WriteMemory((void*)airbreather_addy,(void*)"\xD9\x41\x44",3);
}

Help.
 
Last edited:

GAFO666

Hacker
Meme Tier VIP
Aug 19, 2012
520
3,188
23
lel you set a static boolean which is responseable for the toggle and one for executing the wanted function once(if not, leave the second out ) ...

C++:
void buttonpressed()
{
  static bool toggle = false;
  if(!toggle)
  {
   //do this   
   }
   else
  {
  //do that  
  }

toggle = !toggle;
}
 

Obsta

Jr.Hacker
Meme Tier VIP
Jan 27, 2014
394
4,338
17
Need more source,

Only thing i can determine from what you posted is that either you're writing to bad address or (assumption) your not using threading and that the comparison statement is encapsulated in a never ending loop.

But if its the game crashing and not your app, its more likely the former.
 

lukaluka

Coder
Meme Tier VIP
Jul 6, 2015
285
1,213
3
Need more source,

Only thing i can determine from what you posted is that either you're writing to bad address or (assumption) your not using threading and that the comparison statement is encapsulated in a never ending loop.

But if its the game crashing and not your app, its more likely the former.
Source It's So Much,
I'm Will Show Using The Logically.

//=========== Address ============
DWORD AC_CLIENT = (DWORD)GetModuleHandleA("gta_sa.exe");

#define health_addy 0x4B331F//\x89\x96\x00\x00\x00\x00//
#define ammo_addy 0x7428B0//\x89\x46\x08\x8B\x46\x0C//
#define airbreather_addy 0x60A8F4//\xD9\x41\x44\xD8\x1D\x00//
//===========Gamemaster===========
int Qmo1 = 0;
int health = 0;
int ammo = 0;
int airbreather = 0;
int Smoke = 0;
int Fog = 0;
int Menuz = 0;
int exitforce = 0;
bool hooked=false;
bool CekHook=false;
bool Gamemaster=true;

//I'm Will Skip The Source, Because it's so much

//-----------------------------MENU---------------------------------------------------------------------------------------------------
char Mtitle [] = "";
char *Moptfolder [] = {"OPEN" , "CLOSE"};
char *Moptonoff [] = {"OFF" , "ON"};
char *Mopexit [] = {"\nShow" , "\nF12"};
char *optColor1 [11] = {"OFF" , "ON"};
char *optColor2 [11] = {"OFF" , "ON"};

void RebuildMenu(void)
{
MenuAddItem ("Menu" ,Moptfolder , &Menuz , 2, MENUFOLDER);
if (Menuz)
{
MenuAddItem ("Wallhack" ,Moptonoff , &Qmo1 , 2, MENUITEM);
MenuAddItem ("No Smoke" ,Moptonoff , &Smoke , 2, MENUITEM);
MenuAddItem ("No Fog" ,Moptonoff , &Fog , 2, MENUITEM);
MenuAddItem ("Unlimited Ammo" ,Moptonoff , &ammo , 2, MENUITEM);
MenuAddItem ("Unlimited Health" ,Moptonoff , &health , 2, MENUITEM);
MenuAddItem ("Unlimited Air Breather" ,Moptonoff , &airbreather , 2, MENUITEM);
MenuAddItem ("\nForce Exit" ,Mopexit , &exitforce , 2, MENUITEM);
}
}

Look Menu Unlimited Airbreather?
This Function Will Changed The "int airbreather value to 1"

And Then The Continued To The This Function.

//============== Air Breather =====================
if ( airbreather == 1 ) //if D3D Select On
{
ReadMemory((void*)airbreather_addy,0x90,3);
}
if ( airbreather == 0 ) if d3d select off
{
WriteMemory((void*)airbreather_addy,(void*)"\xD9\x41\x44",3);
}

Help.
 
Last edited:

lukaluka

Coder
Meme Tier VIP
Jul 6, 2015
285
1,213
3
lel you set a static boolean which is responseable for the toggle and one for executing the wanted function once(if not, leave the second out ) ...

C++:
void buttonpressed()
{
  static bool toggle = false;
  if(!toggle)
  {
   //do this   
   }
   else
  {
  //do that  
  }

toggle = !toggle;
}
Thanks For Suggestions,
I Will Try Tomorrow,
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods