Hey-

I'm looking to start learning how to code hacks for certain games, CA being one of them. I have 2+ years of C++ exp and about a year or so of ASM exp. I've been messing around with CAFlame's hotkey base (https://www.mpgh.net/forum/207-combat...base-ever.html). I understand the most of it, and have been able to edit the things that I need to edit. I really only have two main problems that I am stuck on and could use some help with.


First off, all pushtoconsole methods are not working, but mem calls are. I don't know if it needs to be changed, it's outdated, or if I am doing something wrong. I updated to LTC address to the current one from the dump, so I am assuming that is not the problem. A little help/guidance on how to get PTC commands working would be great.

The code:
Code:
void __cdecl PushToConsole( const char* szCommand )
{
DWORD *LTClient = ( DWORD* )( 0x377E0C88 );
void* CONoff = ( void* )*( DWORD* )( *LTClient + 0x208 );

__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
With a command call such as:
Code:
PushToConsole("drawguns 1");

My second problem, is that after being in game with the hacks on for about 5 minutes, the game will crash. My assumption is that this is because of the base being outdated, and it needs parts of it re-written. My only problem is that I've never done any coding for game hacking, so I wouldn't even know where to start on that. So if anyone can give me help on that as well, it would be great.

Full base code (Havn't edited much, just added recent addies and was planning on testing and fixing each hack until it was working again)
Code:
//#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
//Creditz to CAFlames


void __cdecl PushToConsole( const char* szCommand )
{
DWORD *LTClient = ( DWORD* )( 0x377E0C88 );
void* CONoff = ( void* )*( DWORD* )( *LTClient + 0x208 );

__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}


bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;

return false;
}

bool Memoria( void * pDest, char * szPatch, size_t sSize ){
DWORD dwOrgProtect = NULL;
if ( !VirtualProtect ( pDest, sSize, PAGE_EXECUTE_READWRITE, &dwOrgProtect ))
return FALSE;


memcpy( pDest, szPatch, sSize );
VirtualProtect( pDest, sSize, dwOrgProtect, NULL );
return TRUE;
}


#define ADR_RECOIL1 0x373AB5D0
#define ADR_RECOIL2 0x374D4629
#define ADR_RECOIL3 0x373AB5E4
#define ADR_RECOIL4 0x373AB5E7
#define ADR_RECOIL5 0x373AB5F0
/*
#define ADR_RECOIL1 0x3741B550
#define ADR_RECOIL2 0x3740BAA9
#define ADR_RECOIL3 0x3741B564
#define ADR_RECOIL4 0x3741B570*/
#define ADR_RELOAD1 0x37467294
//Creditz to CAFlames... Don't Leech
void main()
{
MessageBoxA(NULL," Thank you for using Flames Base[Contact me, CAFlames, at mpgh.net]! ","Flames Base",MB_OK);
while (!IsGameReadyForHook()){

}


bool nxchams = false;
bool fog = false;
bool speed = false;
bool spread = false;
bool tracers = false;
bool showfps = false;
bool recoil = false;
bool reload = false;
bool unlockcursor = false;
bool drawgun = false;
bool sjump = false;
bool wireframe = false;
bool glitcher = false;
bool skeleton = false;
bool nosway = false;
bool cross2 = false;
bool cross3 = false;
bool cross4 = false;
bool cross5 = false;
bool glow = false;
bool bright = false;
bool sjump1 = false;
bool flykey = false;
bool camup = false;
bool camdown = false;
bool activation = false;
bool nametags = false;
while(true){

if(GetAsyncKeyState(VK_UP)<0){
if(camup){
PushToConsole("CamMaxPosYOffset 200.000000");
PushToConsole("DuckDownCamOffSet -13.000000");
camup = false;
}else{
PushToConsole("CamMaxPosYOffset 200.000000");
PushToConsole("DuckDownCamOffSet 1000.000000");
camup = true;
}
}
PushToConsole("WeaponSway 0.000000");
PushToConsole("ModelDebug_DrawBreath 0.000000");
if(GetAsyncKeyState(VK_PRIOR)<0){
if(activation){
PushToConsole("ActivationDistance 1000");
activation = false;
}else{
PushToConsole("ActivationDistance 100000");
activation = true;
}
}
if(GetAsyncKeyState(VK_DOWN)<0){
if(camdown){
PushToConsole("CamMaxPosYOffset 200.000000");
PushToConsole("DuckDownCamOffSet -13.000000");
camdown = false;
}else{
PushToConsole("CamMaxPosYOffset -1000.000000");
PushToConsole("DuckDownCamOffSet -13.000000");
camdown = true;
}
}
/*
if(GetAsyncKeyState(VK_NUMPAD0)<0){
if(nxchams){
PushToConsole("SkelModelStencil 0");
Memoria(( void* )( 0x372FF456 ), "\x75\x09", 2 );
Memoria(( void* )( 0x37232B48 ), "\x90\x25\x23\x37", 4 );
nxchams = false;
}else{
PushToConsole("SkelModelStencil 1");
Memoria(( void* )( 0x372FF456 ), "\x90\x90", 2 );
Memoria(( void* )( 0x37232B48 ), "\x90\x90\x90\x90", 4 );
nxchams = true;

}}*/
if(GetAsyncKeyState(VK_NUMPAD0)<0){
if(nametags){
Memoria(( void* )( 0x372FD679 ), "\x75\x05", 2 );
Memoria(( void* )( 0x372FD6FF ), "\x90\x25\x23\x37", 4 );
nametags = false;
}else{
Memoria(( void* )( 0x372FD679 ), "\x90\x90", 2 );
Memoria(( void* )( 0x372FD6FF ), "\x90\x90\x90\x90", 4 );
nametags = true;

}}
if(GetAsyncKeyState(VK_NUMPAD2)<0){
if(fog){
PushToConsole("FogEnable 1");
fog = false;
} else {
PushToConsole("FogEnable 0");
fog = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD3)<0){
if(speed){
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 500.000000");
PushToConsole("MaxAccel 3000.000000");
PushToConsole("AccelInc 6000.000000");
PushToConsole("WalkVel 70.000000");
PushToConsole("FRunVel 285.000000");
PushToConsole("BRunVel 285.000000");
PushToConsole("SRunVel 285.000000");
PushToConsole("DuckVel 50.000000");
speed = false;
} else {
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 3000.000000");
PushToConsole("MaxAccel 3000.000000");
PushToConsole("AccelInc 3000.000000");
PushToConsole("WalkVel 3000.000000");
PushToConsole("FRunVel 3000.000000");
PushToConsole("BRunVel 3000.000000");
PushToConsole("SRunVel 3000.000000");
PushToConsole("DuckVel 3000.000000");
speed = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD4)<0){
if(spread){
PushToConsole("PerturbRotationEffect 3.000000");
PushToConsole("PerturbIncreaseSpeed 3.000000");
PushToConsole("PerturbDecreaseSpeed 9.000000");
PushToConsole("PerturbWalkPercent 0.500000");
PushToConsole("PerturbRecoil 9.000000");
PushToConsole("FireMovePerturb 9.000000");
PushToConsole("ZoomedFireMoveDuckPerturb 9.000000");
PushToConsole("ZoomedFireMovePerturb 9.000000");
PushToConsole("ZoomedFireDuckPerturb 9.000000");
spread = false;
} else {
PushToConsole("PerturbRotationEffect 0.000000");
PushToConsole("PerturbIncreaseSpeed 0.000000");
PushToConsole("PerturbWalkPercent 0.000000");
PushToConsole("PerturbFiringIncreaseSpeed 0.000000");
PushToConsole("PerturbRecoil 0.000000");
PushToConsole("FireMovePerturb 0.000000");
PushToConsole("ZoomedFireMoveDuckPerturb 0.000000");
PushToConsole("ZoomedFireMovePerturb 0.000000");
PushToConsole("ZoomedFireDuckPerturb 0.000000");
spread = true;
}
}
if(GetAsyncKeyState(VK_END)<0){
if(tracers){
PushToConsole("ShowFirePath 0");
tracers = false;
} else {
PushToConsole("ShowFirePath 1");
tracers = true;
}
}
if(GetAsyncKeyState(VK_SUBTRACT)<0){
if(sjump){
PushToConsole("JumpVel 330.000000");
sjump = false;
} else {
PushToConsole("JumpVel 660.000000");
sjump = true;
}
}
if(GetAsyncKeyState(VK_ADD)<0){
if(sjump1){
PushToConsole("JumpVel 330.000000");
sjump1 = false;
} else {
PushToConsole("JumpVel 990.000000");
sjump1 = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD9)<0){
if(showfps){
PushToConsole("ShowFps 0");
showfps = false;
} else {
PushToConsole("ShowFps 1");
showfps = true;
}
}
if(GetAsyncKeyState(VK_INSERT)<0){
if(unlockcursor){
PushToConsole("CursorCenter 1");
unlockcursor = false;
} else {
PushToConsole("CursorCenter 0");
unlockcursor = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD5)<0){
if(recoil){
Memoria(( void* )( ADR_RECOIL1 ), "\xD8\x66\x58", 3 );
Memoria(( void* )( ADR_RECOIL2 ), "\xD9\x46\x54", 3 );
Memoria(( void* )( ADR_RECOIL3 ), "\xD9\x5E\x58", 3 );
Memoria(( void* )( ADR_RECOIL4 ), "\xD9\x46\x4C", 3 );
Memoria(( void* )( ADR_RECOIL5 ), "\xD9\x5E\x4C", 3 );
recoil = false;
}else{
Memoria(( void* )( ADR_RECOIL1 ), "\x90\x90\x90", 3 );
Memoria(( void* )( ADR_RECOIL2 ), "\x90\x90\x90", 3 );
Memoria(( void* )( ADR_RECOIL3 ), "\x90\x90\x90", 3 );
Memoria(( void* )( ADR_RECOIL4 ), "\x90\x90\x90", 3 );
Memoria(( void* )( ADR_RECOIL5 ), "\x90\x90\x90", 3 );
recoil = true;
}
}
/*
if(GetAsyncKeyState(VK_NUMPAD6)<0){
if(reload){
Memoria(( void* )( ADR_RELOAD1 ), "\x0F\x84\xB1\x01\x00\x00", 6 );
reload = false;
}else{
Memoria(( void* )( ADR_RELOAD1 ), "\x90\x90\x90\x90\x90\x90", 6 );
reload = true;
}
}*/
if(GetAsyncKeyState(VK_NUMPAD7)<0){
if(drawgun){
PushToConsole("drawguns 1");
drawgun = false;
} else {
PushToConsole("drawguns 0");
drawgun = true;
}
}



if(GetAsyncKeyState(VK_NEXT)<0){
if(glitcher){
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 500.000000");
PushToConsole("MaxAccel 3000.000000");
PushToConsole("AccelInc 6000.000000");
PushToConsole("WalkVel 70.000000");
PushToConsole("FRunVel 285.000000");
PushToConsole("BRunVel 285.000000");
PushToConsole("SRunVel 285.000000");
PushToConsole("DuckVel 50.000000");
glitcher = false;
} else {
PushToConsole("BaseMoveAccel 90000.000000");
PushToConsole("StartAccel 90000.000000");
PushToConsole("MaxAccel 90000.000000");
PushToConsole("AccelInc 90000.000000");
PushToConsole("WalkVel 90000.000000");
PushToConsole("FRunVel 90000.000000");
PushToConsole("BRunVel 90000.000000");
PushToConsole("SRunVel 90000.000000");
glitcher = true;
}
}
if(GetAsyncKeyState(VK_HOME)<0){
if(wireframe){
PushToConsole("WireFrame 0");
wireframe = false;
} else {
PushToConsole("WireFrame 1");
wireframe = true;
}
}
if(GetAsyncKeyState(VK_DELETE)<0){
if(skeleton){
PushToConsole("ModelDebug_DrawSkeleton 0");
skeleton = false;
} else {
PushToConsole("ModelDebug_DrawSkeleton 1");
skeleton = true;
}
}

if(GetAsyncKeyState(VK_F7)<0){
if(cross2){
PushToConsole("CrossHair_DefaultLength 10");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 2");
PushToConsole("CrosshairBarMin 10");
PushToConsole("CrosshairBarMax 10");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross2 = false;
}else{
PushToConsole("CrossHair_DefaultLength 5");
PushToConsole("CrossHair_DefaultGapLength 2");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 1");
PushToConsole("CrosshairBarMin 5");
PushToConsole("CrosshairBarMax 5");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross2 = true;

}
}
if(GetAsyncKeyState(VK_F8)<0){
if(cross3){
PushToConsole("CrossHair_DefaultLength 10");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 2");
PushToConsole("CrosshairBarMin 10");
PushToConsole("CrosshairBarMax 10");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross3 = false;
}else{
PushToConsole("CrossHair_DefaultLength 20");
PushToConsole("CrossHair_DefaultGapLength 3");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 1");
PushToConsole("CrosshairBarMin 10");
PushToConsole("CrosshairBarMax 10");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross3 = true;
}
}
if(GetAsyncKeyState(VK_F9)<0){
if(cross4){
PushToConsole("CrossHair_DefaultLength 10");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 2");
PushToConsole("CrosshairBarMin 10");
PushToConsole("CrosshairBarMax 10");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross4 = false;
}else{
PushToConsole("CrossHair_DefaultLength 40");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 1");
PushToConsole("CrosshairBarMin 30");
PushToConsole("CrosshairBarMax 30");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross4 = true;
}
}
if(GetAsyncKeyState(VK_F10)<0){
if(cross5){
PushToConsole("CrossHair_DefaultLength 10");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 2");
PushToConsole("CrosshairBarMin 10");
PushToConsole("CrosshairBarMax 10");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross5 = false;
}else{
PushToConsole("CrossHair_DefaultLength 75");
PushToConsole("CrossHair_DefaultGapLength 1");
PushToConsole("CrosshairGapMin 0");
PushToConsole("CrosshairGapMax 1");
PushToConsole("CrosshairBarMin 10");
PushToConsole("CrosshairBarMax 10");
PushToConsole("HitCrossHairMAXPerturb 0");
PushToConsole("HitCrossHairMINPerturb 0");
PushToConsole("HitCrossHairSize 0");
PushToConsole("CrossHair_FiringDuration 0");
PushToConsole("ScopeUDRadius 0");
PushToConsole("ScopeLRRadius 0");
PushToConsole("ScopeUPGap 0");
PushToConsole("ScopeLRGap 0");
PushToConsole("ShowBreath 0");
cross5 = true;
}
}
if(GetAsyncKeyState(VK_F11)<0){
if(glow){
PushToConsole("ScreenGlowEnable 0");
glow = false;
}else{
PushToConsole("ScreenGlowEnable 1");
glow = true;
}
}
if(GetAsyncKeyState(VK_F12)<0){
if(bright){
PushToConsole("FullBright 0");
bright = false;
}else{
PushToConsole("FullBright 1");
bright = true;
}
}



if(GetAsyncKeyState(VK_NUMPAD8)<0){
if(flykey){
PushToConsole( "PlayerGravity 800" );
flykey = false;
}else{

PushToConsole( "PlayerGravity -800" );
flykey = true;

} }

Sleep(25);
}
}

BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&main, NULL, 0,NULL);
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}



Any help ASAP would be great. With regards,
Mike