Code:
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include "detours.h"
#include <ios>
#include <cmath>
#include <iostream>
#include <fstream>
#include <cctype>
#include <Mmsystem.h>
#pragma comment(lib, "winmm.lib")
#include "DirectX.h"
#include "stdafx.h"
using namespace std;
BOOL bCompare (const BYTE* pData, const BYTE* bMask, const char* szMask)
{
for(;*szMask;++szMask,++pData,++bMask)
{
if(*szMask == 'x' && *pData != *bMask)
return 0;
}
return (*szMask) == NULL;
}
DWORD FindPattern(BYTE *bMask, char * szMask, int codeOffset, BOOL extract)
{
for(DWORD i = 0; i < dwSize; i++)
{
if(bCompare((BYTE*)(dwStartAddress + i),bMask,szMask))
{
if(extract)
{
return *(DWORD*)(dwStartAddress + i + codeOffset);
}
else
{
return (DWORD)(dwStartAddress + i + codeOffset);
}
}
}
return NULL;
}
void HackShield ()
{
if (GetModuleHandle( "EhSvc.dll" ) != NULL)
{
Sleep (1000);
dwStartAddress = 0;
do{
dwStartAddress = (DWORD)GetModuleHandle("EhSvc.dll");
Sleep(10L);
}while
(!dwStartAddress);
DWORD HS1 = FindPattern((PBYTE)"\x89\x4D\xFC\xE9\x00\x00\x00\x 00\x07","xxxx????x",3, false);
DWORD HS2 = FindPattern((PBYTE)"\xE8\x00\x00\x00\x00\x83\xF8\x 01\x0F\x84\x00\x00\x00\x00\xC6\x85\x00\x00\x00\x00 \x00","x????xxxxx????xx?????",0,false);
DWORD HS3 = FindPattern((PBYTE)"\x75\x00\x8B\x74\x24\x00\x53\x B9\x00\x00\x00\x00","x?xxx?xx????",0, false);
memcpy((LPBYTE)HS1,(PBYTE)"\x90\x90\x90\x90\x90",5 );
memcpy((LPBYTE)HS2,(PBYTE)"\xB8\x01\x00\x00\x00",5 );
memcpy((LPBYTE)HS3,(PBYTE)"\x90\x90",2);
}
}
void __cdecl PushToConsole( const char* szCommand )
{
DWORD *L***ient = ( DWORD* )( 0xFFFFFFFF ); //Addy removed
void* CONoff = ( void* )*( DWORD* )( *L***ient + 0x208 );//*L T Client
__asm
{
push szCommand;
call CONoff;
add esp, 4;
}
}
bool IsGameReadyForHook()
{
if( GetModuleHandle( "d3d9.dll" ) != NULL
&& GetModuleHandle( "ClientFX.fxd" ) != NULL
//&& GetModuleHandle( "EhSvc.dll") != NULL
&& GetModuleHandle( "CShell.dll" ) != NULL )
return true;
return false;
}
void main()
{
while (!IsGameReadyForHook()){
Sleep(20);
}
int speedcount=0;
bool chams = false;
bool iammo = false;
bool boxes = false;
bool fog = false;
bool speed = false;
bool spread = false;
bool tracers = false;
bool showfps = false;
bool unlockcursor = false;
bool drawgun = false;
bool sjump = false;
PushToConsole("FallDamageMinHeight 0.000000");
PushToConsole("FallDamageMaxHeight 0.000000");
PushToConsole("FallDamageMax 0.000000");
while(true){
/*if (GetAsyncKeyState(VK_NUMPAD5)<0)
{
if (chams)
{
SetLightChams(255,255,0,0, pDevice);
chams=false;
}
else
{
SetLightChams(0,0,0,0, pDevice);
chams=true;
}
}*/
if (GetAsyncKeyState(VK_NUMPAD9)<0) //recoil
{
PlaySound ("c://CMhx//norecoilon.wav", NULL, SND_FILENAME | SND_ASYNC);
PushToConsole("ZoomedPerturbRecoil 0");
PushToConsole("PerturbRecoil 0");
PushToConsole("BaseCamRecoilWagR 0");
PushToConsole("BaseCamRecoilWagL 0");
PushToConsole("MaxCamRecoilWag 0");
PushToConsole("BaseCamRecoilYaw 0");
PushToConsole("MaxCamRecoilYaw 0");
PushToConsole("Recoil 0");
PushToConsole("BaseCamRecoilAccelPitch 0");
PushToConsole("BaseCamRecoilPitch 0");
PushToConsole("BaseCamRecoilPitchPer 0");
PushToConsole("MaxCamRecoilPitchPer 0");
PushToConsole("TripleShotBaseCamRecoilPitch 0");
PushToConsole("TripleShotMaxCamRecoilPitch 0");
PushToConsole("MaxCamRecoilPitch 0");
PushToConsole("CamRecoilRecover 0");
PushToConsole("RecoilDec 0");
PushToConsole("RecoilPitchGrade 0");
PushToConsole("RecoilPitch 0");
}
if(GetAsyncKeyState(VK_NUMPAD1)<0){
if(boxes){
//PushToConsole("ModelDebug_DrawBoxes 0");
PlaySound ("c://CMhx//chamsoff.wav", NULL, SND_FILENAME | SND_ASYNC);
PushToConsole("SkelModelStencil 0");
boxes = false;
} else {
PlaySound ("c://CMhx//chamson.wav", NULL, SND_FILENAME | SND_ASYNC);
//PushToConsole("ModelDebug_DrawBoxes 1");
PushToConsole("SkelModelStencil 1");
boxes = true;
}
}
/* if(GetAsyncKeyState(VK_NUMPAD2)<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 1000.000000");
PushToConsole("MaxAccel 1000.000000");
PushToConsole("AccelInc 3000.000000");
PushToConsole("WalkVel 500.000000");
PushToConsole("FRunVel 1000.000000");
PushToConsole("BRunVel 1000.000000");
PushToConsole("SRunVel 1000.000000");
PushToConsole("DuckVel 3000.000000");
speed = true;
}
}*/
if (GetAsyncKeyState(VK_SUBTRACT)<0)//decrese speed
{
speedcount--;
if (speedcount<0)
{
PlaySound ("c://CMhx//limitreach.wav", NULL, SND_FILENAME | SND_ASYNC);
speedcount=0;
}
else
{
PlaySound ("c://CMhx//speeddown.wav", NULL, SND_FILENAME | SND_ASYNC);
}
if (speedcount==0)
{
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");
}
if (speedcount==1)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 600.000000");
PushToConsole("MaxAccel 2500.000000");
PushToConsole("AccelInc 5500.000000");
PushToConsole("WalkVel 200.000000");
PushToConsole("FRunVel 485.000000");
PushToConsole("BRunVel 485.000000");
PushToConsole("SRunVel 485.000000");
PushToConsole("DuckVel 500.000000");
}
if (speedcount==2)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 700.000000");
PushToConsole("MaxAccel 2000.000000");
PushToConsole("AccelInc 5000.000000");
PushToConsole("WalkVel 300.000000");
PushToConsole("FRunVel 685.000000");
PushToConsole("BRunVel 685.000000");
PushToConsole("SRunVel 685.000000");
PushToConsole("DuckVel 1000.000000");
}
if (speedcount==3)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 800.000000");
PushToConsole("MaxAccel 2500.000000");
PushToConsole("AccelInc 4000.000000");
PushToConsole("WalkVel 400.000000");
PushToConsole("FRunVel 805.000000");
PushToConsole("BRunVel 805.000000");
PushToConsole("SRunVel 805.000000");
PushToConsole("DuckVel 2000.000000");
}
if (speedcount==4)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 1000.000000");
PushToConsole("MaxAccel 1000.000000");
PushToConsole("AccelInc 3000.000000");
PushToConsole("WalkVel 500.000000");
PushToConsole("FRunVel 1000.000000");
PushToConsole("BRunVel 1000.000000");
PushToConsole("SRunVel 1000.000000");
PushToConsole("DuckVel 3000.000000");
}
}
if (GetAsyncKeyState(VK_ADD)<0)//increse speed
{
speedcount++;
if (speedcount>4)
{
PlaySound ("c://CMhx//limitreach.wav", NULL, SND_FILENAME | SND_ASYNC);
speedcount=4;
}
else
{
PlaySound ("c://CMhx//speedup.wav", NULL, SND_FILENAME | SND_ASYNC);
}
if (speedcount==0)
{
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");
}
if (speedcount==1)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 600.000000");
PushToConsole("MaxAccel 2500.000000");
PushToConsole("AccelInc 5500.000000");
PushToConsole("WalkVel 200.000000");
PushToConsole("FRunVel 485.000000");
PushToConsole("BRunVel 485.000000");
PushToConsole("SRunVel 485.000000");
PushToConsole("DuckVel 500.000000");
}
if (speedcount==2)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 700.000000");
PushToConsole("MaxAccel 2000.000000");
PushToConsole("AccelInc 5000.000000");
PushToConsole("WalkVel 300.000000");
PushToConsole("FRunVel 685.000000");
PushToConsole("BRunVel 685.000000");
PushToConsole("SRunVel 685.000000");
PushToConsole("DuckVel 1000.000000");
}
if (speedcount==3)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 800.000000");
PushToConsole("MaxAccel 2500.000000");
PushToConsole("AccelInc 4000.000000");
PushToConsole("WalkVel 400.000000");
PushToConsole("FRunVel 805.000000");
PushToConsole("BRunVel 805.000000");
PushToConsole("SRunVel 805.000000");
PushToConsole("DuckVel 2000.000000");
}
if (speedcount==4)
{
PushToConsole("BaseMoveAccel 3000.000000");
PushToConsole("StartAccel 1000.000000");
PushToConsole("MaxAccel 1000.000000");
PushToConsole("AccelInc 3000.000000");
PushToConsole("WalkVel 500.000000");
PushToConsole("FRunVel 1000.000000");
PushToConsole("BRunVel 1000.000000");
PushToConsole("SRunVel 1000.000000");
PushToConsole("DuckVel 3000.000000");
}
}
if(GetAsyncKeyState(VK_F10)<0){PlaySound ("c://CMhx//info.wav", NULL, SND_FILENAME | SND_ASYNC);}
if(GetAsyncKeyState(VK_NUMPAD8)<0){
if(spread){
PushToConsole("PerturbRotationEffect 3.000000");
PushToConsole("PerturbIncreaseSpeed 3.000000");
PushToConsole("PerturbDecreaseSpeed 9.000000");
PushToConsole("PerturbWalkPercent 0.500000");
PlaySound ("c://CMhx//nospreadoff.wav", NULL, SND_FILENAME | SND_ASYNC);
spread = false;
} else {
PushToConsole("PerturbRotationEffect 0.000000");
PushToConsole("PerturbIncreaseSpeed 0.000000");
PushToConsole("PerturbWalkPercent 0.000000");
PushToConsole("PerturbFiringIncreaseSpeed 0.000000");
PlaySound ("c://CMhx//nospreadon.wav", NULL, SND_FILENAME | SND_ASYNC);
spread = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD3)<0){
if(showfps){
PushToConsole("ShowFps 0");
PlaySound ("c://CMhx//showfpsoff.wav", NULL, SND_FILENAME | SND_ASYNC);
showfps = false;
} else {
PushToConsole("ShowFps 1");
PlaySound ("c://CMhx//showfpson.wav", NULL, SND_FILENAME | SND_ASYNC);
showfps = true;
}
}
if(GetAsyncKeyState(VK_NUMPAD0)<0)
{
PushToConsole("ReloadWeapons 1");
PushToConsole("ReloadPerBullet 1");
PushToConsole("PdaScaning 1");
}
if(GetAsyncKeyState(VK_NUMPAD7)<0){
if(iammo){
PushToConsole("InfiniteAmmo 0");
PushToConsole("IsAmmo 0");
PushToConsole("ShotsPerClip 0");
iammo = false;
} else {
PushToConsole("InfiniteAmmo 1");
PushToConsole("IsAmmo 1");
PushToConsole("ShotsPerClip 1");
iammo = true;
}
}
Sleep(200);
}
}
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)&HackShield, NULL, 0,NULL);
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;
}