Skip to content

Instantly share code, notes, and snippets.

@MikuAuahDark
Last active May 13, 2021 03:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikuAuahDark/3f436b63ad9b272aa989be115193c001 to your computer and use it in GitHub Desktop.
Save MikuAuahDark/3f436b63ad9b272aa989be115193c001 to your computer and use it in GitHub Desktop.
GTASA Cheat Input Disable
/*
* Prevents you from using cheat codes like HESOYAM, DDDDDDDAAAAAADWD, ...
* Only tested on gta-sa.exe US 1.0 HOODLUM and COMPACT.
* Please change address at line 13 if you're not using US v1.0 executable
*
* Compile with
* clang -m32 -shared -o nocheat.asi nocheat.c
*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
int setCheatEnable(int enable)
{
static unsigned char *address = (unsigned char *) 0x438480;
DWORD oldProt, temp;
if (VirtualProtect(address, 1, PAGE_READWRITE, &oldProt))
*address = enable ? 0xC3 : 0xA0;
else
return 0;
VirtualProtect(address, 1, oldProt, &temp);
return 1;
}
int __stdcall DllMain(HINSTANCE _, DWORD reason, LPVOID __)
{
return setCheatEnable(reason == DLL_PROCESS_ATTACH || reason == DLL_THREAD_ATTACH);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment