Thread: CODMW4

Results 1 to 7 of 7
  1. #1
    saunak123's Avatar
    Join Date
    Jun 2009
    Gender
    female
    Posts
    37
    Reputation
    12
    Thanks
    5
    My Mood
    Asleep

    Cool CODMW4

    Code:
    Headers files
    "Base.h"
    Code:
    
    
    #ifndef _BASE_H
    #define _BASE_H
    
    #define WIN32_LEAN_AND_MEAN
    #define _CRT_SECURE_NO_WARNINGS
    
    #pragma comment (lib, "d3d9.lib")
    #pragma comment (lib, "d3dx9.lib")
    #pragma message("Base.h : Building for D3D9")
    
    #include <windows.h>
    #include <time.h>
    #include <Winuser.h>
    #include <stdio.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    #include <fstream>
    #include <stdio.h>
    
    #include "detours.h"
    #pragma comment (lib, "detours.lib")
    
    #define PDEVICE	LPDIRECT3DDEVICE9
    #define FONT	LPD3DXFONT
    
    typedef HRESULT (WINAPI* oEndScene)             (PDEVICE pDev);
    typedef HRESULT (WINAPI* oReset)                (PDEVICE pDevi,D3DPRESENT_PARAMETERS* pPresentationParameters);
    typedef HRESULT (WINAPI* oDrawIndexedPrimitive) (PDEVICE, D3DPRIMITIVETYPE, INT, UINT, UINT, UINT, UINT);
    
    
    
    bool WaitForGame(void);
    void PostReset(PDEVICE);
    bool bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask);
    DWORD FindPattern(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask);
    void *DetourCreate(BYTE *src, const BYTE *dst, const int len);
    
    
    
    cod4_structs.h"
    Code:
    
    #include "Header_Files.h"
    
    
    #ifndef cod4_structs_h
    #define cod4_structs_h
    
    using namespace std;
    
    typedef float vec_t;
    typedef vec_t vec3_t[3];
    typedef vec_t vec2_t[2];
    
    /*
    -------------------------
    PATCH 1.6 CLASS OFFSETS:
    //0074A888 cgs   
    //0074E2B8 cg
    0043FB17   68 88A87400      PUSH iw3mp.0074A888 <<--CGS_t
    0043FB1C   E8 2FC92300      CALL iw3mp.0067C450
    0043FB21   83C4 0C          ADD ESP,0C
    0043FB24   68 F0E70F00      PUSH 0FE7F0
    0043FB29   57               PUSH EDI
    0043FB2A   68 B8E27400      PUSH iw3mp.0074E2B8 <<--CG_t
    
    //0084F258 cent  
    0043FB65   81C1 58F28400    ADD ECX,iw3mp.0084F258 <<--Centity
    
    //008391F0 clientinfo
    //797580 refdef
    //0CC19898 stats
    -------------------------
    
    refdef = (refdef_t*)0x00797380;
    CInfo = (clientInfo_t*)0x00838FF0;
    CEntity = (centity_t*)0x0084F058;
    CG = (cg_t*)0x0074E0B8;
    	 (IsInGame)0x0074E0D8
    */
    class CClientInfo
    {
    public:
    	DWORD infoValid; //0x0000  
    	__int32 ClientNum; //0x0004  
    	char ID0268BD00[4]; //0x0008  
    	char PlayerName[16]; //0x000C  
    	__int32 iTeam; //0x001C  
    	__int32 iTeam2; //0x0020  
    	__int32 ID02683D10; //0x0024  
    	__int32 ID02683D90; //0x0028  
    	__int32 ID02683D80; //0x002C  
    	__int32 ID026D5248; //0x0030  
    		char unknown52[16]; //0x0034
    	char bodyModel[30]; //0x0044  
    	char headModel[64]; //0x0062  
    	char weapModel[64]; //0x00A2  
    	char weaponModel[26]; //0x00E2  
    		char unknown252[320]; //0x00FC
    	char model[64]; //0x023C  
    		char unknown636[284]; //0x027C
    	float X; //0x0398  
    	float Y; //0x039C  
    	float Z; //0x03A0  
    		char unknown932[8]; //0x03A4
    	float yaw; //0x03AC  
    	float roll; //0x03B0  
    	float pitch; //0x03B4  
    		char unknown952[208]; //0x03B8
    	int shooting; //0x0488  
    		char unknown1164[4]; //0x048C
    	int zoomed; //0x0490  
    		char unknown1172[56]; //0x0494
    }; //0x4CC( size=1228 )									  
    CClientInfo * cClientInfo = ( CClientInfo* )0x8391F0;
    
    class centity_t
    {
    public:
    		char unknown0[28]; //0x0000
    	float X; //0x001C  
    	float Y; //0x0020  
    	float Z; //0x0024  
    	float pitch; //0x0028  
    	float yaw; //0x002C  
    		char unknown48[52]; //0x0030
    	DWORD PlayerPose; //0x0064  
    		char unknown104[100]; //0x0068
    	DWORD clientNum; //0x00CC  
    	DWORD type; //0x00D0  
    		char unknown212[188]; //0x00D4
    	DWORD weapon; //0x0190  
    		char unknown404[44]; //0x0194
    	__int32 isAlive; //0x01C0  
    		char unknown452[24]; //0x01C4
    };
    centity_t * Centity = (centity_t*)(0x0084F258);
    
    class sPlayerState
    {
    public:
        int _p00[16];
        int Health;
        int _p01[13];
        int PrimaryClip;
        int SecondaryClip;
    };
    
    class Snapshot_t
    {
    public:
        int SnapFlags;
        int Ping;
        int ServerTime;
        int ServerTime2;
        char _p00[0x104];
    	sPlayerState   Ps;
    };
    
    class Refdef_t
    {
    public:
    	int	x;
    	int	y;
    	int	width;
    	int	height;
    	float fov_x;
    	float fov_y;
    	vec3_t viewOrg;
    	vec3_t viewAxis[3];
    	char Fill[0x4050];
    	vec3_t refdefViewAngles;
    };
    Refdef_t * refdef = ( Refdef_t* )0x00797580;
    
    class CG_t
    {
    public:
    	int             clientNum;
        int            _p00[0x1C];
        Snapshot_t     *pSnap;
        Snapshot_t     *pNextSnap;
        char            _p01[0x46100];
        int             Time;
        char            _p02[0x307C];
        vec3_t			RefdefViewAngles;
        char            _p03[0x114];
        Refdef_t		Refdef;
        char            _p04[0x2F8C];
        int             CrosshairClientNum;
        int             CrosshairClientTime;
    };//Size=0x2674(9844)
    CG_t * cg = ( CG_t* )0x0074E2B8; 
    		
    class CGS_t
    {
    public:
    char unknown0[8]; //0x0000
    DWORD screenX; //0x0008 screenX 
    DWORD screenY; //0x000C screenY 
    float screenXBias; //0x0010 screenXBias 
    DWORD serverCommandSequence; //0x0014 serverCommandSequence 
    DWORD processedSnapshotNum; //0x0018 processedSnapshotNum 
    DWORD boolLocalServer; //0x001C 
    char GameType[4]; //0x0020 Dom, sd, sab, war, koth=HQ, dm = free for all 
    char unknown36[28]; //0x0024
    char ServerName[256]; //0x0040 
    __int32 MaxClients; //0x0140 
    char MapName[64]; //0x0144 
    DWORD timeStartRound; //0x0184 
    char unknown392[38]; //0x0188
    DWORD TimeLimit; //0x01AE 
    DWORD VoteTime; //0x01B2 
    DWORD YesVote; //0x01B6 
    DWORD NoVote; //0x01BA 
    char voteString[256]; //0x01BE 
    DWORD levelStartTime; //0x02BE 
    char unknown706[2436]; //0x02C2
    char model1[20]; //0x0C46 
    char unknown3162[44]; //0x0C5A
    char model2[28]; //0x0C86 
    char unknown3234[36]; //0x0CA2
    char model3[20]; //0x0CC6 
    char unknown3290[44]; //0x0CDA
    char model4[24]; //0x0D06 
    char unknown3358[36]; //0x0D1E
    char ShellShock[16]; //0x0D42 
    char unknown3410[11476]; //0x0D52
    };//Size=0x3A26(14886)
    CGS_t * cgs = ( CGS_t* )0x0074A888; 
    
    class CStats 
    {
    public:
    	__int32 Current_Xp; //0000
    	__int32 Current_Score; //0004
    	__int32 TotalKills; //0008
    	__int32 Best_KillStreak; //000C
    	__int32 TotalDeaths; //0010
    	__int32 Unknown5; //0014
    	__int32 Assists; //0018
    	__int32 HeadShots; //001C
    	__int32 Unknown8; //0020
    	__int32 GrenadeDeaths; //0024
    	__int32 Server_Time; //0028 (+4)
    	__int32 Unknown11; //002C
    	__int32 Unknown12; //0030
    	__int32 Snapshot_Num; //0034 (+4)
    	__int32 KilledBySmth; //0038
    	__int32 Unknown15; //003C
    	__int32 Total_Games; //0040
    	char unknown17[16];
    	__int32 Total_Hits; //0054
    	__int32 Total_Bullets_Shot; //0058
    	__int32 Total_Bullets_Shot2; //005C
    	__int32 Unknown21; //0060
    	char unknown22[96];
    	__int32 Rank; //00C4
    	__int32 Unknown24; //00C8
    	__int32 Unknown25; //00CC
    	__int32 Unknown26; //00D0
    	char unknown27[192];
    	__int32 Unknown28; //0194
    	char unknown2[852];
    	__int32 Knife_Kills; //04EC
    
    };
    CStats* stats = (CStats*)0xCC19898;//this offset holds the XP value
    #endif
    
    "Colors.h"
    Code:
    
    #include "Header_Files.h"
    
    //____________________COLORS________________________________________________________
    D3DCOLOR dBlack		= D3DCOLOR_ARGB( 255, 000, 000, 000 );//black
    D3DCOLOR dWhite		= D3DCOLOR_ARGB( 255, 255, 255, 255 );//white
    D3DCOLOR dRed		= D3DCOLOR_ARGB( 255, 255, 000, 000 );//red
    D3DCOLOR dGreen		= D3DCOLOR_ARGB( 255, 000, 255, 0 );//green
    D3DCOLOR dBlue		= D3DCOLOR_ARGB( 255, 000, 000, 255 );//blue
    D3DCOLOR dPurple	= D3DCOLOR_ARGB( 255, 255, 000, 255 );//purple
    D3DCOLOR dYellow	= D3DCOLOR_ARGB( 255, 255, 255, 0 );//yellow
    D3DCOLOR dSkyBlue	= D3DCOLOR_ARGB( 255, 000, 255, 255 );//skyblue
    D3DCOLOR dGolden	= D3DCOLOR_ARGB( 255, 255, 165, 0 );//golden
    D3DCOLOR dPink		= D3DCOLOR_ARGB( 255, 255, 2, 200 );//pink
    D3DCOLOR dBrown		= D3DCOLOR_ARGB( 255, 166, 42, 42 );//brown
    D3DCOLOR dOrange	= D3DCOLOR_ARGB( 255, 255, 165, 0 );//orange
    
    "D3D_Hack_Features.h"
    Code:
    
    //________________D3D HACK FEATURES_________________________________________________
    int Aimbot;
    int NameESP;
    int DistanceESP;
    int ClassESP;
    int Radar2D;
    int PlayerWarning;
    int StealName ;
    int PlayerChams;
    int Asuswallhack;
    int PlayerStats;
    int ServerStats;
    int Resolution;
    int NoSky;
    int NoScope;
    int NoSmoke;
    int NoRain;
    
    "D3D_Hacks.h"
    Code:
    
    #include "Header_Files.h"
    
    #define PI 3.14159265
    
    //sky color
    int SkyColor = 8;
    char SKYCOL[1000] = "Normal";
    
    //Time Viewer
    char Timestruct[16] = "hh':'mm':'ss tt";      
    char TimeString[25];  
    char cResolution[101];
    
    //screenshot
    char FileName[256];
    char CurrentTime[256];
    
    //framerate display
    float fFps = 0.0f;
    float fLastTickCount = 0.0f;
    float fCurrentTickCount;
    float fCurrentTime;
    float fLastTick = 0.0;
    char cFrameRate[50] = {0};
    
    BOOL IsInsideCircle( double CenterX, double CenterY, double Radius, double PointX, double PointY )
    {
    	return ( sqrt( pow((CenterX - PointX),2) + pow((CenterY - PointY),2)) < Radius );
    } 
    
    void TakeScreenShot(IDirect3DDevice9* pDevice, char* file_name)
    {
    	LPDIRECT3DSURFACE9 surf;
    	pDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO,&surf);
        D3DXSaveSurfaceToFile(file_name,D3DXIFF_JPG,surf,NULL,NULL);	
    }
    
    //pixel shader
    HRESULT GenerateShader(IDirect3DDevice9 *pD3Ddev, IDirect3DPixelShader9 **pShader, float r, float g, float b )
    {
        char szShader[ 256 ];
        ID3DXBuffer *pShaderBuf = NULL;
        sprintf( szShader, "ps_3_0\ndef c0, %f, %f, %f, %f\nmov oC0,c0", r, g, b, 1.0f );
        D3DXAssembleShader( szShader, sizeof( szShader ), NULL, NULL, 0, &pShaderBuf, NULL );
        if( FAILED( pD3Ddev->CreatePixelShader((const DWORD*)pShaderBuf->GetBufferPointer(), pShader)) )return E_FAIL;
        return S_OK;
    }
    struct shaders
    {
        IDirect3DPixelShader9 *sTeam1, *sTeam2, *sTeam1_Behind, *sTeam2_Behind, *PixelShader[8];
    };shaders sa;
    
    //_____________________FONTS_________________________________________________________
    ID3DXFont * Font[13];
    
    "detours.h"
    Code:
    
    //////////////////////////////////////////////////////////////////////////////
    //
    //  File:       detours.h
    //  Module:     detours.lib
    //
    //  Detours for binary functions.  Version 1.5 (Build 46)
    //
    //  Copyright 1995-2001, Microsoft Corporation
    //
    
    #pragma once
    #ifndef _DETOURS_H_
    #define _DETOURS_H_
    
    #pragma comment(lib, "detours")
    
    //////////////////////////////////////////////////////////////////////////////
    //
    #ifndef GUID_DEFINED
    #define GUID_DEFINED
    typedef struct  _GUID
    {
        DWORD Data1;
        WORD Data2;
        WORD Data3;
        BYTE Data4[ 8 ];
    } GUID;
    #endif // !GUID_DEFINED
    
    #if defined(__cplusplus)
    #ifndef _REFGUID_DEFINED
    #define _REFGUID_DEFINED
    #define REFGUID             const GUID &
    #endif // !_REFGUID_DEFINED
    #else // !__cplusplus
    #ifndef _REFGUID_DEFINED
    #define _REFGUID_DEFINED
    #define REFGUID             const GUID * const
    #endif // !_REFGUID_DEFINED
    #endif // !__cplusplus
    //
    //////////////////////////////////////////////////////////////////////////////
    
    #ifdef __cplusplus
    extern "C" {
    #endif // __cplusplus
    
    /////////////////////////////////////////////////// Instruction Target Macros.
    //
    #define DETOUR_INSTRUCTION_TARGET_NONE          ((PBYTE)0)
    #define DETOUR_INSTRUCTION_TARGET_DYNAMIC       ((PBYTE)~0ul)
    
    /////////////////////////////////////////////////////////// Trampoline Macros.
    //
    // DETOUR_TRAMPOLINE(trampoline_prototype, target_name)
    //
    // The naked trampoline must be at least DETOUR_TRAMPOLINE_SIZE bytes.
    //
    #define DETOUR_TRAMPOLINE_SIZE          32
    #define DETOUR_SECTION_HEADER_SIGNATURE 0x00727444   // "Dtr\0"
    
    #define DETOUR_TRAMPOLINE(trampoline,target) \
    static PVOID __fastcall _Detours_GetVA_##target(VOID) \
    { \
        return &target; \
    } \
    \
    __declspec(naked) trampoline \
    { \
        __asm { nop };\
        __asm { nop };\
        __asm { call _Detours_GetVA_##target };\
        __asm { jmp eax };\
        __asm { ret };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
    }
    
    #define DETOUR_TRAMPOLINE_EMPTY(trampoline) \
    __declspec(naked) trampoline \
    { \
        __asm { nop };\
        __asm { nop };\
        __asm { xor eax, eax };\
        __asm { mov eax, [eax] };\
        __asm { ret };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
        __asm { nop };\
    }
    
    /////////////////////////////////////////////////////////// Binary Structures.
    //
    #pragma pack(push, 8)
    typedef struct _DETOUR_SECTION_HEADER
    {
        DWORD       cbHeaderSize;
        DWORD       nSignature;
        DWORD       nDataOffset;
        DWORD       cbDataSize;
        
        DWORD       nOriginalImportVirtualAddress;
        DWORD       nOriginalImportSize;
        DWORD       nOriginalBoundImportVirtualAddress;
        DWORD       nOriginalBoundImportSize;
        
        DWORD       nOriginalIatVirtualAddress;
        DWORD       nOriginalIatSize;
        DWORD       nOriginalSizeOfImage;
        DWORD       nReserve;
    } DETOUR_SECTION_HEADER, *PDETOUR_SECTION_HEADER;
    
    typedef struct _DETOUR_SECTION_RECORD
    {
        DWORD       cbBytes;
        DWORD       nReserved;
        GUID        guid;
    } DETOUR_SECTION_RECORD, *PDETOUR_SECTION_RECORD;
    #pragma pack(pop)
    
    #define DETOUR_SECTION_HEADER_DECLARE(cbSectionSize) \
    { \
          sizeof(DETOUR_SECTION_HEADER),\
          DETOUR_SECTION_HEADER_SIGNATURE,\
          sizeof(DETOUR_SECTION_HEADER),\
          (cbSectionSize),\
          \
          0,\
          0,\
          0,\
          0,\
          \
          0,\
          0,\
          0,\
          0,\
    }
    
    ///////////////////////////////////////////////////////////// Binary Typedefs.
    //
    typedef BOOL (CALLBACK *PF_DETOUR_BINARY_BYWAY_CALLBACK)(PVOID pContext,
                                                             PCHAR pszFile,
                                                             PCHAR *ppszOutFile);
    typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FILE_CALLBACK)(PVOID pContext,
                                                            PCHAR pszOrigFile,
                                                            PCHAR pszFile,
                                                            PCHAR *ppszOutFile);
    typedef BOOL (CALLBACK *PF_DETOUR_BINARY_SYMBOL_CALLBACK)(PVOID pContext,
                                                              DWORD nOrdinal,
                                                              PCHAR pszOrigSymbol,
                                                              PCHAR pszSymbol,
                                                              PCHAR *ppszOutSymbol);
    typedef BOOL (CALLBACK *PF_DETOUR_BINARY_FINAL_CALLBACK)(PVOID pContext);
    typedef BOOL (CALLBACK *PF_DETOUR_BINARY_EXPORT_CALLBACK)(PVOID pContext,
                                                              DWORD nOrdinal,
                                                              PCHAR pszName,
                                                              PBYTE pbCode);
    
    typedef VOID * PDETOUR_BINARY;
    typedef VOID * PDETOUR_LOADED_BINARY;
    
    //////////////////////////////////////////////////////// Trampoline Functions.
    //
    PBYTE WINAPI DetourFunction(PBYTE pbTargetFunction,
                                PBYTE pbDetourFunction);
    
    BOOL WINAPI DetourFunctionWithEmptyTrampoline(PBYTE pbTrampoline,
                                                  PBYTE pbTarget,
                                                  PBYTE pbDetour);
    
    BOOL WINAPI DetourFunctionWithEmptyTrampolineEx(PBYTE pbTrampoline,
                                                    PBYTE pbTarget,
                                                    PBYTE pbDetour,
                                                    PBYTE *ppbRealTrampoline,
                                                    PBYTE *ppbRealTarget,
                                                    PBYTE *ppbRealDetour);
    
    BOOL  WINAPI DetourFunctionWithTrampoline(PBYTE pbTrampoline,
                                              PBYTE pbDetour);
    
    BOOL  WINAPI DetourFunctionWithTrampolineEx(PBYTE pbTrampoline,
                                                PBYTE pbDetour,
                                                PBYTE *ppbRealTrampoline,
                                                PBYTE *ppbRealTarget);
    
    BOOL  WINAPI DetourRemove(PBYTE pbTrampoline, PBYTE pbDetour);
    
    ////////////////////////////////////////////////////////////// Code Functions.
    //
    PBYTE WINAPI DetourFindFunction(PCHAR pszModule, PCHAR pszFunction);
    PBYTE WINAPI DetourGetFinalCode(PBYTE pbCode, BOOL fSkipJmp);
    
    PBYTE WINAPI DetourCopyInstruction(PBYTE pbDst, PBYTE pbSrc, PBYTE *ppbTarget);
    PBYTE WINAPI DetourCopyInstructionEx(PBYTE pbDst,
                                         PBYTE pbSrc,
                                         PBYTE *ppbTarget,
                                         LONG *plExtra);
    
    ///////////////////////////////////////////////////// Loaded Binary Functions.
    //
    HMODULE WINAPI DetourEnumerateModules(HMODULE hModuleLast);
    PBYTE WINAPI DetourGetEntryPoint(HMODULE hModule);
    BOOL WINAPI DetourEnumerateExports(HMODULE hModule,
                                       PVOID pContext,
                                       PF_DETOUR_BINARY_EXPORT_CALLBACK pfExport);
    
    PBYTE WINAPI DetourFindPayload(HMODULE hModule, REFGUID rguid, DWORD *pcbData);
    DWORD WINAPI DetourGetSizeOfPayloads(HMODULE hModule);
    
    ///////////////////////////////////////////////// Persistent Binary Functions.
    //
    BOOL WINAPI DetourBinaryBindA(PCHAR pszFile, PCHAR pszDll, PCHAR pszPath);
    BOOL WINAPI DetourBinaryBindW(PWCHAR pwzFile, PWCHAR pwzDll, PWCHAR pwzPath);
    #ifdef UNICODE
    #define DetourBinaryBind  DetourBinaryBindW
    #else
    #define DetourBinaryBind  DetourBinaryBindA
    #endif // !UNICODE
    
    PDETOUR_BINARY WINAPI DetourBinaryOpen(HANDLE hFile);
    PBYTE WINAPI DetourBinaryEnumeratePayloads(PDETOUR_BINARY pBinary,
                                               GUID *pGuid,
                                               DWORD *pcbData,
                                               DWORD *pnIterator);
    PBYTE WINAPI DetourBinaryFindPayload(PDETOUR_BINARY pBinary,
                                         REFGUID rguid,
                                         DWORD *pcbData);
    PBYTE WINAPI DetourBinarySetPayload(PDETOUR_BINARY pBinary,
                                        REFGUID rguid,
                                        PBYTE pbData,
                                        DWORD cbData);
    BOOL WINAPI DetourBinaryDeletePayload(PDETOUR_BINARY pBinary, REFGUID rguid);
    BOOL WINAPI DetourBinaryPurgePayloads(PDETOUR_BINARY pBinary);
    BOOL WINAPI DetourBinaryResetImports(PDETOUR_BINARY pBinary);
    BOOL WINAPI DetourBinaryEditImports(PDETOUR_BINARY pBinary,
                                        PVOID pContext,
                                        PF_DETOUR_BINARY_BYWAY_CALLBACK pfByway,
                                        PF_DETOUR_BINARY_FILE_CALLBACK pfFile,
                                        PF_DETOUR_BINARY_SYMBOL_CALLBACK pfSymbol,
                                        PF_DETOUR_BINARY_FINAL_CALLBACK pfFinal);
    BOOL WINAPI DetourBinaryWrite(PDETOUR_BINARY pBinary, HANDLE hFile);
    BOOL WINAPI DetourBinaryClose(PDETOUR_BINARY pBinary);
    
    /////////////////////////////////////////////// First Chance Exception Filter.
    //
    LPTOP_LEVEL_EXCEPTION_FILTER WINAPI
    DetourFirstChanceExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelFilter);
    
    ///////////////////////////////////////////////// Create Process & Inject Dll.
    //
    typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEA)
        (LPCSTR lpApplicationName,
         LPSTR lpCommandLine,
         LPSECURITY_ATTRIBUTES lpProcessAttributes,
         LPSECURITY_ATTRIBUTES lpThreadAttributes,
         BOOL bInheritHandles,
         DWORD dwCreationFlags,
         LPVOID lpEnvironment,
         LPCSTR lpCurrentDirectory,
         LPSTARTUPINFOA lpStartupInfo,
         LPPROCESS_INFORMATION lpProcessInformation);
    
    typedef BOOL (WINAPI *PDETOUR_CREATE_PROCESS_ROUTINEW)
        (LPCWSTR lpApplicationName,
         LPWSTR lpCommandLine,
         LPSECURITY_ATTRIBUTES lpProcessAttributes,
         LPSECURITY_ATTRIBUTES lpThreadAttributes,
         BOOL bInheritHandles,
         DWORD dwCreationFlags,
         LPVOID lpEnvironment,
         LPCWSTR lpCurrentDirectory,
         LPSTARTUPINFOW lpStartupInfo,
         LPPROCESS_INFORMATION lpProcessInformation);
                                      
    BOOL WINAPI DetourCreateProcessWithDllA(LPCSTR lpApplicationName,
                                            LPSTR lpCommandLine,
                                            LPSECURITY_ATTRIBUTES lpProcessAttributes,
                                            LPSECURITY_ATTRIBUTES lpThreadAttributes,
                                            BOOL bInheritHandles,
                                            DWORD dwCreationFlags,
                                            LPVOID lpEnvironment,
                                            LPCSTR lpCurrentDirectory,
                                            LPSTARTUPINFOA lpStartupInfo,
                                            LPPROCESS_INFORMATION lpProcessInformation,
                                            LPCSTR lpDllName,
                                            PDETOUR_CREATE_PROCESS_ROUTINEA
                                            pfCreateProcessA);
    
    BOOL WINAPI DetourCreateProcessWithDllW(LPCWSTR lpApplicationName,
                                            LPWSTR lpCommandLine,
                                            LPSECURITY_ATTRIBUTES lpProcessAttributes,
                                            LPSECURITY_ATTRIBUTES lpThreadAttributes,
                                            BOOL bInheritHandles,
                                            DWORD dwCreationFlags,
                                            LPVOID lpEnvironment,
                                            LPCWSTR lpCurrentDirectory,
                                            LPSTARTUPINFOW lpStartupInfo,
                                            LPPROCESS_INFORMATION lpProcessInformation,
                                            LPCWSTR lpDllName,
                                            PDETOUR_CREATE_PROCESS_ROUTINEW
                                            pfCreateProcessW);
                      
    #ifdef UNICODE
    #define DetourCreateProcessWithDll  DetourCreateProcessWithDllW
    #define PDETOUR_CREATE_PROCESS_ROUTINE     PDETOUR_CREATE_PROCESS_ROUTINEW
    #else
    #define DetourCreateProcessWithDll  DetourCreateProcessWithDllA
    #define PDETOUR_CREATE_PROCESS_ROUTINE     PDETOUR_CREATE_PROCESS_ROUTINEA
    #endif // !UNICODE
    
    BOOL WINAPI DetourContinueProcessWithDllA(HANDLE hProcess, LPCSTR lpDllName);
    BOOL WINAPI DetourContinueProcessWithDllW(HANDLE hProcess, LPCWSTR lpDllName);
    
    #ifdef UNICODE
    #define DetourContinueProcessWithDll    DetourContinueProcessWithDllW
    #else
    #define DetourContinueProcessWithDll    DetourContinueProcessWithDllA
    #endif // !UNICODE
    //
    //////////////////////////////////////////////////////////////////////////////
    #ifdef __cplusplus
    }
    #endif // __cplusplus
    
    /////////////////////////////////////////////////////////////////// Old Names.
    //
    #define ContinueProcessWithDll            DetourContinueProcessWithDll 
    #define ContinueProcessWithDllA           DetourContinueProcessWithDllA
    #define ContinueProcessWithDllW           DetourContinueProcessWithDllW
    #define CreateProcessWithDll              DetourCreateProcessWithDll 
    #define CreateProcessWithDllA             DetourCreateProcessWithDllA
    #define CreateProcessWithDllW             DetourCreateProcessWithDllW
    #define DETOUR_TRAMPOLINE_WO_TARGET       DETOUR_TRAMPOLINE_EMPTY
    #define DetourBinaryPurgePayload          DetourBinaryPurgePayloads
    #define DetourEnumerateExportsForInstance DetourEnumerateExports
    #define DetourEnumerateInstances          DetourEnumerateModules
    #define DetourFindEntryPointForInstance   DetourGetEntryPoint
    #define DetourFindFinalCode               DetourGetFinalCode
    #define DetourFindPayloadInBinary         DetourFindPayload
    #define DetourGetSizeOfBinary             DetourGetSizeOfPayloads
    #define DetourRemoveWithTrampoline        DetourRemove
    #define PCREATE_PROCESS_ROUTINE           PDETOUR_CREATE_PROCESS_ROUTINE
    #define PCREATE_PROCESS_ROUTINEA          PDETOUR_CREATE_PROCESS_ROUTINEA
    #define PCREATE_PROCESS_ROUTINEW          PDETOUR_CREATE_PROCESS_ROUTINEW
    //
    
    //////////////////////////////////////////////// Detours Internal Definitions.
    //
    #ifdef __cplusplus
    #ifdef DETOURS_INTERNAL
    
    //////////////////////////////////////////////////////////////////////////////
    //
    #ifdef IMAGEAPI // defined by IMAGEHLP.H
    typedef LPAPI_VERSION (NTAPI *PF_ImagehlpApiVersionEx)(LPAPI_VERSION AppVersion);
    
    typedef BOOL (NTAPI *PF_SymInitialize)(IN HANDLE hProcess,
                                           IN LPSTR UserSearchPath,
                                           IN BOOL fInvadeProcess);
    typedef DWORD (NTAPI *PF_SymSetOptions)(IN DWORD SymOptions);
    typedef DWORD (NTAPI *PF_SymGetOptions)(VOID);
    typedef BOOL (NTAPI *PF_SymLoadModule)(IN HANDLE hProcess,
                                           IN HANDLE hFile,
                                           IN PSTR ImageName,
                                           IN PSTR ModuleName,
                                           IN DWORD BaseOfDll,
                                           IN DWORD SizeOfDll);
    typedef BOOL (NTAPI *PF_SymGetModuleInfo)(IN HANDLE hProcess,
                                              IN DWORD dwAddr,
                                              OUT PIMAGEHLP_MODULE ModuleInfo);
    typedef BOOL (NTAPI *PF_SymGetSymFromName)(IN HANDLE hProcess,
                                               IN LPSTR Name,
                                               OUT PIMAGEHLP_SYMBOL Symbol);
    typedef BOOL (NTAPI *PF_BindImage)(IN LPSTR pszImageName,
                                       IN LPSTR pszDllPath,
                                       IN LPSTR pszSymbolPath);
    
    typedef struct _DETOUR_SYM_INFO
    {
        HANDLE                   hProcess;
        HMODULE                  hImageHlp;
        PF_ImagehlpApiVersionEx  pfImagehlpApiVersionEx;
        PF_SymInitialize         pfSymInitialize;
        PF_SymSetOptions         pfSymSetOptions;
        PF_SymGetOptions         pfSymGetOptions;
        PF_SymLoadModule         pfSymLoadModule;
        PF_SymGetModuleInfo      pfSymGetModuleInfo;
        PF_SymGetSymFromName     pfSymGetSymFromName;
        PF_BindImage             pfBindImage;
    } DETOUR_SYM_INFO, *PDETOUR_SYM_INFO;
    
    PDETOUR_SYM_INFO DetourLoadImageHlp(VOID);
    
    #endif // IMAGEAPI
    
    //////////////////////////////////////////////////////////////////////////////
    //
    class CDetourEnableWriteOnCodePage
    {
    public:
        CDetourEnableWriteOnCodePage(PBYTE pbCode, LONG cbCode = DETOUR_TRAMPOLINE_SIZE)
        {
            m_pbCode = pbCode;
            m_cbCode = cbCode;
            m_dwOldPerm = 0;
            m_hProcess = GetCurrentProcess();
    
            if (m_pbCode && m_cbCode) {
                if (!FlushInstructionCache(m_hProcess, pbCode, cbCode)) {
                    return;
                }
                if (!VirtualProtect(pbCode,
                                    cbCode,
                                    PAGE_EXECUTE_READWRITE,
                                    &m_dwOldPerm)) {
                    return;
                }
            }
        }
    
        ~CDetourEnableWriteOnCodePage()
        {
            if (m_dwOldPerm && m_pbCode && m_cbCode) {
                DWORD dwTemp = 0;
                if (!FlushInstructionCache(m_hProcess, m_pbCode, m_cbCode)) {
                    return;
                }
                if (!VirtualProtect(m_pbCode, m_cbCode, m_dwOldPerm, &dwTemp)) {
                    return;
                }
            }
        }
    
        BOOL SetPermission(DWORD dwPerms)
        {
            if (m_dwOldPerm && m_pbCode && m_cbCode) {
                m_dwOldPerm = dwPerms;
                return TRUE;
            }
            return FALSE;
        }
    
        BOOL IsValid(VOID)
        {
            return m_pbCode && m_cbCode && m_dwOldPerm;
        }
    
    private:
        HANDLE  m_hProcess;
        PBYTE   m_pbCode;
        LONG    m_cbCode;
        DWORD   m_dwOldPerm;
    };
    
    //////////////////////////////////////////////////////////////////////////////
    //
    inline PBYTE DetourGenMovEax(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xB8;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEbx(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xBB;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEcx(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xB9;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEdx(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xBA;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEsi(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xBE;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEdi(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xBF;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEbp(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xBD;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenMovEsp(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0xBC;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenPush(PBYTE pbCode, UINT32 nValue)
    {
        *pbCode++ = 0x68;
        *((UINT32*&)pbCode)++ = nValue;
        return pbCode;
    }
    
    inline PBYTE DetourGenPushad(PBYTE pbCode)
    {
        *pbCode++ = 0x60;
        return pbCode;
    }
    
    inline PBYTE DetourGenPopad(PBYTE pbCode)
    {
        *pbCode++ = 0x61;
        return pbCode;
    }
    
    inline PBYTE DetourGenJmp(PBYTE pbCode, PBYTE pbJmpDst, PBYTE pbJmpSrc = 0)
    {
        if (pbJmpSrc == 0) {
            pbJmpSrc = pbCode;
        }
        *pbCode++ = 0xE9;
        *((INT32*&)pbCode)++ = pbJmpDst - (pbJmpSrc + 5);
        return pbCode;
    }
    
    inline PBYTE DetourGenCall(PBYTE pbCode, PBYTE pbJmpDst, PBYTE pbJmpSrc = 0)
    {
        if (pbJmpSrc == 0) {
            pbJmpSrc = pbCode;
        }
        *pbCode++ = 0xE8;
        *((INT32*&)pbCode)++ = pbJmpDst - (pbJmpSrc + 5);
        return pbCode;
    }
    
    inline PBYTE DetourGenBreak(PBYTE pbCode)
    {
        *pbCode++ = 0xcc;
        return pbCode;
    }
    
    inline PBYTE DetourGenRet(PBYTE pbCode)
    {
        *pbCode++ = 0xc3;
        return pbCode;
    }
    
    inline PBYTE DetourGenNop(PBYTE pbCode)
    {
        *pbCode++ = 0x90;
        return pbCode;
    }
    #endif DETOURS_INTERAL
    #endif // __cplusplus
    
    #endif // _DETOURS_H_
    //
    ////////////////////////////////////////////////////////////////  End of File.
    
    
    "Header_Files.h"
    Code:
    
    #include <windows.h>
    #include <Winuser.h>
    #include <time.h>
    #include <tlhelp32.h>
    #include <stdio.h>
    #include <iostream>
    #include <ctime>
    #include <time.h>
    
    #include "main.h"
    #include "d3d9.h"
    #include "d3d9dev.h"
    
    #pragma comment(lib, "Winmm.lib")
    #pragma comment(lib,"d3d9.lib")
    #pragma comment(lib,"d3dx9.lib")
    
    // disable annoying warnings
    #pragma warning (disable: 4312) 
    #pragma warning (disable: 4311) 
    #pragma warning (disable: 4099) 
    #pragma warning (disable: 4244)
    #pragma warning (disable: 4996)
    
    
    "Memory_Hacks.h"
    Code:
    
    #include "Header_Files.h"
    //__________________________________________________________________________________
    int n;
    
    
    
    DWORD bytes; 
    HANDLE hand = NULL;
    DWORD GameBase = 0x400000;
    //__________________________________________________________________________________
    DWORD UNLOCK_CONSOLE			=			GameBase + 0x56B386;
    DWORD WRITEPROTECTED			=			GameBase + 0x16B3C8;
    DWORD NAMETAGS1					=			GameBase + 0x42E1AC;
    DWORD NAMETAGS2					=			GameBase + 0x42E1CE;	
    DWORD NAMETAGS3					=			GameBase + 0x42E18F;
    DWORD WALLHACK					=			GameBase + 0x454C0;
    DWORD NORECOIL					=			GameBase + 0x00457CCF;
    DWORD NOFOG						=			GameBase + 0x63DB0D;
    DWORD NOFLASH					=			GameBase + 0x52009;
    DWORD THIRDPERSON				=			GameBase + 0x51E2E;
    DWORD LASER						=			GameBase + 0x0456E78;
    DWORD BOXESP1					=			GameBase + 0x328E;
    DWORD BOXESP2					=			GameBase + 0x1247;
    DWORD MINIMAP					=			GameBase + 0x42A0B4;
    
    //__________________________________________________________________________________
    	
    	//no operations
    	BYTE NopSix[6]				= {0x90,0x90,0x90,0x90,0x90,0x90};
    	BYTE NopFive[5]				= {0x90,0x90,0x90,0x90,0x90};
    	BYTE NopFour[4]				= {0x90,0x90,0x90,0x90};
    	BYTE NopThree[3]			= {0x90,0x90,0x90};
    	BYTE NopTwo[2]				= {0x90,0x90};
    
    	//nametags
    	BYTE Tags1[6]				= {0x0F,0x85,0xCE,0x00,0x00,0x00};//nametags
    	BYTE Tags2[6]				= {0x0F,0x84,0xEB,0x00,0x00,0x00};//draw nametags in free-for-all mode
    	BYTE Tags3[2]				= {0x74,0x25};//draw nametags thru walls
    
    	//Minimap
    	BYTE MinimapOrig[5]			= {0xE8,0x07,0x12,0x14,0x00};
    
    	//unlock console commands
    	BYTE ConsoleOn[2]			= {0xEB,0x29};
    	BYTE ConsoleOff[2]			= {0x75,0x29};
    
    	//unlock write protected commands
    	BYTE WriteProtectedOn[2]	= {0xEB,0x19};
    	BYTE WriteProtectedOrig[2]	= {0x74,0x19};
    
    	//wallhack
    	BYTE WallhackOn[2]			= {0x6A,0x12};
    	BYTE WallhackOff[2]			= {0x6A,0x04};
    
    	//boxes
    	BYTE Box1On[2]				= {0x75,0x2C};
    	BYTE Box1Orig[2]			= {0x74,0x2C};
    
    	BYTE Box2On[3]				= {0xD8,0x62,0x0C};
    	BYTE Box2Orig[3]			= {0xD8,0x4A,0x0C};
    	
    	//no recoil
    	BYTE RecoilOn[2]			= {0x75, 0x12};
    	BYTE RecoilOrig[2]			= {0x74,0x12};
    
    	//no fog
    	BYTE NoFogOn[2]				= {0x74,0x20};
    	BYTE NoFogOrig[2]			= {0x75,0x20};
    
    	//no flash
    	BYTE NoFlashOn[2]			= {0x75,0x20};
    	BYTE NoFlashOrig[2]			= {0x74,0x29};
    
    	////I DONT USE THESE ANYMORE
    	//thirdperson mode
    	BYTE ThirdPersonOn[2]		= {0x74,0x10};
    	BYTE ThirdPersonOrig[2]		= {0x75,0x10};
    	
    	//no sniper scope overlay
    	BYTE NoScopeOn[2]			= {0x74,0x42};
    	BYTE NoScopeOrig[2]			= {0x75,0x42};
    
    	//no gun
    	BYTE NoGunOn[2]				= {0x75,0x19};
    	BYTE NoGunOrig[2]			= {0x74,0x19};
    
    	//no camera bob
    	BYTE NoBobOn[2]				= {0x74,0x26};
    	BYTE NoBobOrig[2]			= {0x75,0x26};
    
    	//laser
    	BYTE LaserOn[2]				= {0x74,0x04};
    	BYTE LaserOrig[2]			= {0x75,0x04};
    
    //__________________________________________________________________________________
    
    //strifes send commands to console function
    	void SendCommandToConsole(char* command)
    	{
    		__asm
    		{
    			push	command
    			push	0
    			push	0
    			mov	esi, 0x004F9B20//<--replace this offset(current version 1.6)
    			call	esi
    			add	esp, 0x0C
    		}
    	}
    
    //_______________Save_______________________________________________________________
    BOOL WritePrivateProfileInt(LPCTSTR lpAppName, LPCTSTR lpKeyName, int nInteger, LPCTSTR lpFileName)
    {
    	TCHAR lpString[ 1024 ];
    	wsprintf( lpString, "%d", nInteger );
    
    	return WritePrivateProfileString( lpAppName, lpKeyName, lpString, lpFileName );
    }
    //__________________________________________________________________________________
    
    
    
    
    
    "MenuFormat.h"
    Code:
    
    //	Project : Basic D3D Menu v1.0
    //	Author	: Topblast
    //	Date	: July 22, 2010
    
    #ifndef _MENUFORMAT_H
    #define _MENUFORMAT_H
    
    #include "Base.h"
    
    
    #define MENUGROUP		1
    #define MENUTEXT		2
    #define MENUITEM		3
    
    #define MCOLOR_TITLE	0xffff1111
    #define MCOLOR_CURRENT	D3DCOLOR_ARGB (255,255,0 ,0 )
    #define MCOLOR_GROUP	D3DCOLOR_ARGB (255,102,0 ,153)
    #define MCOLOR_TEXT		0xffe0e0e0
    #define MCOLOR_OFF		0xffa0a0a0
    #define MCOLOR_ON		0xffffffff
    
    
    
    
    
    
    
    typedef struct {
      int  typ;		  // type of menuline, folder, item
      char *txt;	  // text to show
      char **opt;	  // array of options
      int  *var;	  // variable containing current status
      int  maxval;    // maximumvalue,  normally 1  gives  0=off  1=on
    } tMENU;
    
    class D3DMenu
    {
    public:
    	D3DMenu(char *Name=0, int maxentries=99, int maxwidth=160, int LX=30,int LY=15, bool Background=true)
    	{
    		title=Name;
    		maxitems=maxentries;
    		cur=noitems=visible=0;
    		x=LX;
    		y=LY;
    		totwidth=maxwidth + 30;
    		ofs=(maxwidth-110);
    		height=20;
    		titleheight=totheight=height+4;
    		col_title  =MCOLOR_TITLE;
    		col_group  =MCOLOR_GROUP;
    		col_text   =MCOLOR_TEXT;
    		col_off    =MCOLOR_OFF;
    		col_on     =MCOLOR_ON;
    		col_current=MCOLOR_CURRENT;
    		// allocate menu array
    		MENU=(tMENU **)malloc(4*maxitems);
    		for (int i=0; i<maxitems; i++) MENU[i]=(tMENU *)malloc(sizeof(tMENU));
    	}
    	~D3DMenu() {
    		for (int i=0; i<maxitems; i++) free(MENU[i]);
    		free(MENU);
    	}
    	// colors
    	DWORD		col_title;
    	DWORD		col_group;
    	DWORD		col_text;
    	DWORD		col_off;
    	DWORD		col_on;
    	DWORD		col_current;
    	// position and sizes
    	int			x,y;				// current position of the menu
    	bool		back;				// If backgound GUI needed
    	int			totwidth,totheight;	// total width and height of menu
    	int			height;				// height of 1 menuline
    	int			titleheight;		// some extra height for a title
    	int			ofs;				// offset for option text
    	// menu vars
    	char		*title;				// some menu title
    	int 		cur;				// current highlighted menuitem	
    	int 		noitems;			// number of menu items
    	int			visible;			// 1 = menu is visible
    
    	tMENU		**MENU;
    	
    	void AddItem (char *txt, int *var, char **opt, int maxvalue=2, int typ=MENUITEM);
    	void AddGroup(char *txt, int *var, char **opt, int maxvalue=2);
    	void AddText (char *txt, char *opt="");
    
    	void D3DMenu::ShowFTP(LPD3DXFONT pFont, char* wabe);
    	void Show(LPD3DXFONT pFont, PDEVICE pDev);
    	void Nav(void);
    
    private:
    	int			maxitems;
    };
    #endif
    
    
    Now we Moving to cpp Files.
    //
    Base.cpp
    Code:
    
    #include <windows.h>
    #include <Winuser.h>
    #include <time.h>
    #include <tlhelp32.h>
    #include <stdio.h>
    #include <iostream>
    #include <ctime>
    #include "main.h"
    #include "MenuFormat.h"
    #include "Base.h"
    #include "detours.h"
    
    #include "Memory_Hacks.h"
    #include "cod4_structs.h"
    
    #include "D3D_Hacks.h"
    #include "Header_Files.h"
    #include "colors.h"
    #include "D3D_Hack_Features.h"
    
    
    
    
    
    
    
    using namespace std;
    
    #pragma comment(lib, "Winmm.lib")
    #pragma comment(lib,"d3d9.lib")
    #pragma comment(lib,"d3dx9.lib")
    
    // disable annoying warnings
    #pragma warning (disable: 4312) 
    #pragma warning (disable: 4311) 
    #pragma warning (disable: 4099) 
    #pragma warning (disable: 4244)
    #pragma warning (disable: 4996)
    
    
    
    
    int fullbright;
    int chams;
    int wallhack;
    int wireframe;
    int unknownhack;
    int xhair2;
    int xhair3;
    int xhair4;
    int BoxESP;
    int boxESP;
    int Nametags;
    bool Console = true;
    int Laser;
    int Minimap;
    int KillSpam;
    
    
    
    
    
    
    
    
    
    
    int sair;	
    
    
    
    
    
    
    
    float ScreenCenterX = 0.0f;
    float ScreenCenterY = 0.0f;
    
    
    
    
    
    FONT		pFont = NULL;
    PDEVICE		pDevice1;
    
    int texnum;
    int NumVertices;
    
    int m_Stride;
    
    #define Addy1 0x5240F6
    #define Addy2 0x528CCA
    
    
    
    //op7 stats
    D3DCOLOR colRed = D3DCOLOR_XRGB(255, 0, 0);
    D3DVIEWPORT9 Viewport;
    
    
    
    
    #define Player (( m_Stride == 20) || (m_Stride == 28) ||(m_Stride == 36))
    #define Player2 (( m_Stride == 20) || (m_Stride == 28) ||(m_Stride == 36))
    #define Hands (m_Stride == 20 && NumVertices == 1766)
    #define Flash (m_Stride == 142)
    #define ADR_God (0x00C22E28)
    #define ADR_Jump (0x00C0D11C)
    #define ADR_SPREAD1 (0x00C0CE28)
    #define ADR_SPREAD2 (0x00C0CE2C)
    #define ADR_SPREAD3 (0x00C0CE30) 
    #define NoFall      (0x00C163C4)
    #define FullAutoAddy    (0x00C0BC10)
    #define Shoot_Addie (0x00C163C5 - 0x30)
    #define Sky (( m_Stride == 20) || (m_Stride == 28) ||(m_Stride == 36))
    
    //cod4 info
    
    //Players
    #define Opfor		((NumVertices == 3124 && primCount == 4132) || (NumVertices == 1970 && primCount == 2186) || (NumVertices == 1252 && primCount == 1160) || (NumVertices == 470 && primCount == 352) || (NumVertices == 3531 && primCount == 4526) || (NumVertices == 2188 && primCount == 2386) || (NumVertices == 1325 && primCount == 1194) || (NumVertices == 499 && primCount == 352) || (NumVertices == 2715 && primCount == 3588) || (NumVertices == 1620 && primCount == 1886) || (NumVertices == 943 && primCount == 908) || (NumVertices == 441 && primCount == 308) || (NumVertices == 2816 && primCount == 3642) || (NumVertices == 1773 && primCount == 2022) || (NumVertices == 1150 && primCount == 1086) || (NumVertices == 435 && primCount == 320) || (NumVertices == 250 && primCount == 304) || (NumVertices == 2818 && primCount == 3672) || (NumVertices == 150 && primCount == 142) || (NumVertices == 1715 && primCount == 1950) || (NumVertices == 1101 && primCount == 1066) || (NumVertices == 481 && primCount == 350) )
    #define Marines		((NumVertices == 681  && primCount == 588 ) || (NumVertices == 2613 && primCount == 3248) || (NumVertices == 1842 && primCount == 1978) || (NumVertices == 1144 && primCount == 814) || (NumVertices == 1034 && primCount == 904) || (NumVertices == 447 && primCount == 312) || (NumVertices == 3790 && primCount == 4078) || (NumVertices == 2784 && primCount == 2384) || (NumVertices == 1572 && primCount == 1166) || (NumVertices == 634 && primCount == 372) || (NumVertices == 233 && primCount == 330) || (NumVertices == 3597 && primCount == 4280) || (NumVertices == 2301 && primCount == 2364) || (NumVertices == 1341 && primCount == 1132) || (NumVertices == 580 && primCount == 380) || (NumVertices == 689 && primCount == 1172) || (NumVertices == 367 && primCount == 298)  || (NumVertices == 4050 && primCount == 4486) || (NumVertices == 308 && primCount == 212) || (NumVertices == 2540 && primCount == 2444) || (NumVertices == 628 && primCount == 670) || (NumVertices == 1488 && primCount == 1114) || (NumVertices == 105 && primCount == 74) || (NumVertices == 592 && primCount == 374) || (NumVertices == 2516 && primCount == 2940) || (NumVertices == 106 && primCount == 114) || (NumVertices == 1726 && primCount == 1760) || (NumVertices == 1020 && primCount == 872) || (NumVertices == 587 && primCount == 370) || (NumVertices==204 && primCount==172) || (NumVertices== 681  && primCount==588) || (NumVertices== 63   && primCount== 62)  ||(NumVertices== 822  && primCount== 1084)||(NumVertices== 2516 && primCount== 2940)||(NumVertices== 394  && primCount== 274) ||(NumVertices== 275  && primCount== 322) ||(NumVertices== 1409 && primCount== 868) ||(NumVertices== 716  && primCount== 962) ||(NumVertices== 394  && primCount== 274) ||(NumVertices== 178  && primCount== 166) ||(NumVertices== 1344 && primCount== 944) ||(NumVertices== 599  && primCount== 418) ||(NumVertices== 49   && primCount== 50)  ||(NumVertices== 855  && primCount== 1100)||(NumVertices== 56   && primCount== 44)  ||(NumVertices== 183  && primCount== 112) ||(NumVertices== 3790 && primCount== 4078)||(NumVertices== 56   && primCount== 44)  ||(NumVertices== 34   && primCount== 30)  ||(NumVertices== 874  && primCount== 1228) || (NumVertices== 213 && primCount== 282) ||(NumVertices== 367  && primCount== 298) ||(NumVertices== 306  && primCount== 274) ||(NumVertices== 1495 && primCount== 982) ||(NumVertices== 1198 && primCount== 842) ||(NumVertices== 306  && primCount== 274) ||(NumVertices== 4050 && primCount== 4486)|| (NumVertices== 686  && primCount== 952 )||(NumVertices== 828  && primCount== 1300)||(NumVertices== 3597 && primCount== 4280)||(NumVertices== 356 &&  primCount== 262 )||(NumVertices== 110  && primCount== 122 )||(NumVertices== 2613 && primCount== 3248)||(NumVertices== 1001 && primCount== 964) )
    #define Spetz		((NumVertices == 4358 && primCount == 4864) || (NumVertices == 3278 && primCount == 3188) || (NumVertices == 503 && primCount == 704) || (NumVertices == 1633 && primCount == 1332) || (NumVertices == 840 && primCount == 618) || (NumVertices == 783 && primCount == 1168) || (NumVertices == 4242 && primCount == 5028) || (NumVertices == 2391 && primCount == 2488) || (NumVertices == 1689 && primCount == 1422) || (NumVertices == 384 && primCount == 250) || (NumVertices == 969 && primCount == 708) || (NumVertices == 4270 && primCount == 4804) || (NumVertices == 2755 && primCount == 2494) || (NumVertices == 1317 && primCount == 1054) || (NumVertices == 809 && primCount == 590) || (NumVertices == 793 && primCount == 834) || (NumVertices == 3891 && primCount == 4598) || (NumVertices == 592 && primCount == 532) || (NumVertices == 2510 && primCount == 2470) || (NumVertices == 171 && primCount == 114) || (NumVertices == 1398 && primCount == 1176) || (NumVertices == 384 && primCount == 250) || (NumVertices == 384 && primCount == 250) || (NumVertices == 994 && primCount == 714) || (NumVertices == 529 && primCount == 540) || (NumVertices == 353 && primCount == 346) || (NumVertices == 726 && primCount == 556) || (NumVertices == 1315 && primCount == 1170) || (NumVertices == 2140 && primCount == 2310) || (NumVertices == 3326 && primCount == 4336) || (NumVertices == 3254 && primCount == 4122) || (NumVertices == 1730 && primCount == 1938) || (NumVertices == 398 && primCount == 410) || (NumVertices == 327 && primCount == 500) || (NumVertices == 2388 && primCount == 2040) || (NumVertices == 222 && primCount == 298) || (NumVertices == 1111 && primCount == 986) || (NumVertices == 1186 && primCount == 1184) || (NumVertices == 339 && primCount == 248) || (NumVertices == 994 && primCount == 714) )
    #define SAS			((NumVertices == 2334 && primCount == 2826) || (NumVertices == 438 && primCount == 376) || (NumVertices == 447 && primCount == 312) || (NumVertices == 1034 && primCount == 904) || (NumVertices == 1842 && primCount == 1978) || (NumVertices == 2613 && primCount == 3248) || (NumVertices == 1001 && primCount == 964) || (NumVertices == 3935 && primCount == 5226) || (NumVertices == 960 && primCount == 1072) || (NumVertices == 2640 && primCount == 3070) || (NumVertices == 212 && primCount == 288) || (NumVertices == 214 && primCount == 202) || (NumVertices == 1373 && primCount == 1256) || (NumVertices == 585 && primCount == 440) || (NumVertices == 634 && primCount == 372) || (NumVertices == 1572 && primCount == 1166) || (NumVertices == 2784 && primCount == 2384) || (NumVertices == 3790 && primCount == 4078) || (NumVertices == 3585 && primCount == 4858) || (NumVertices == 1498 && primCount == 1304) || (NumVertices == 2525 && primCount == 3022) || (NumVertices == 695 && primCount == 478) ||  (NumVertices == 193 && primCount == 140) || (NumVertices == 580 && primCount == 380) || (NumVertices == 1341 && primCount == 1132) || (NumVertices == 802 && primCount == 800) || (NumVertices == 2301 && primCount == 2364) || (NumVertices == 275 && primCount == 322) || (NumVertices == 3597 && primCount == 4280) || (NumVertices == 3716 && primCount == 5064) || (NumVertices == 2578 && primCount == 2994) || (NumVertices == 1412 && primCount == 1330) || (NumVertices == 568 && primCount == 470) || (NumVertices == 689 && primCount == 1172) || (NumVertices == 367 && primCount == 298) || (NumVertices == 4050 && primCount == 4486) || (NumVertices == 308 && primCount == 212) || (NumVertices == 2540 && primCount == 2444) || (NumVertices == 628 && primCount == 670) || (NumVertices == 1488 && primCount == 1114) || (NumVertices == 105 && primCount == 74) || (NumVertices == 592 && primCount == 374) || (NumVertices == 3562 && primCount == 4784) || (NumVertices == 2509 && primCount == 2954) || (NumVertices == 1402 && primCount == 1164) || (NumVertices == 628 && primCount == 450) || (NumVertices == 1615 && primCount == 1706) || (NumVertices == 541 && primCount == 366) || (NumVertices == 3667 && primCount == 4952) || (NumVertices == 2460 && primCount == 2882) || (NumVertices == 1479 && primCount == 1402) || (NumVertices == 552 && primCount == 452) )
    
    #define OpforHands ( NumVertices == 156 && primCount == 240 )
    #define MarinesHands ( NumVertices == 718 && primCount == 1236 )
    #define SpetzHands ( NumVertices == 1926 && primCount == 3128)
    #define SASHands (NumVertices == 2138)
    
    //i didnt logg all weapons
    #define Weapons ( (m_Stride == 32 && NumVertices == 1204) || (m_Stride == 32 && NumVertices == 1055) || (m_Stride == 32 && NumVertices == 105) || (m_Stride == 32 && NumVertices == 1024) || (m_Stride == 32 && NumVertices == 190) || (m_Stride == 32 && NumVertices == 1471) || (m_Stride == 32 && NumVertices == 1680) || (m_Stride == 32 && NumVertices == 1054) || (m_Stride == 32 && NumVertices == 780) || (m_Stride == 32 && NumVertices == 2122) || (m_Stride == 32 && NumVertices == 693))
    
    #define GoodPlayers		((Marines) || (SAS) || (MarinesHands) || (SASHands))
    #define BadPlayers		((Opfor) || (Spetz) || (OpforHands) || (SpetzHands))
    #define RAIN		(m_Stride == 20 && (NumVertices == 4096 && primCount == 2048))
    #define FULLBRIGHT	((NumVertices == 4))
    #define SMOKE		((NumVertices == 16384))
    #define WALLS		((m_Stride == 44))
    #define Scope1		((NumVertices == 374 && primCount == 286) || (NumVertices == 841 && primCount == 648) || (NumVertices == 743 && primCount == 620) )
    #define Scope2		((NumVertices == 785 && primCount == 606) || (NumVertices == 48 && primCount == 30) || (NumVertices == 202 && primCount == 126) )
    #define Scope3		((NumVertices == 640 && primCount == 492) || (NumVertices == 374 && primCount == 286) || (NumVertices == 174 && primCount == 106) || (NumVertices == 55 && primCount == 36) || (NumVertices == 232 && primCount == 146) )
    #define Scope4		((NumVertices == 299 && primCount == 242) || (NumVertices == 739 && primCount == 576) || (NumVertices == 59 && primCount == 38) || (NumVertices == 497 && primCount == 368) || (NumVertices == 315 && primCount == 250))
    #define SniperScope (m_Stride == 32 && (NumVertices == 16 && primCount == 6))
    
    
    
    
    
    
    //=========================================================================================
    
    
    
    void Write_D3Dmem( void* pxAddress, void* pxBuffer, int size ) 
    {                  
        unsigned long Protection;        
        VirtualProtect((void*)pxAddress, size, PAGE_READWRITE, &Protection);
        memcpy((void*)pxAddress, (const void*)pxBuffer, size);
        VirtualProtect((void*)pxAddress, size, Protection, 0);
    }
    
    extern "C" void *_ReturnAddress(void);//made by Geeko...cretids to him...
    #pragma intrinsic(_ReturnAddress)
    void *_ReturnAddress(void);
    
    
    #define D3DHOOK_TEXTURES //comment this to disable texture hooking
    
    LPDIRECT3DTEXTURE9 texWhite;
    LPDIRECT3DTEXTURE9 texPink;
    LPDIRECT3DTEXTURE9 texBlack;
    LPDIRECT3DTEXTURE9 texBlue;
    LPDIRECT3DTEXTURE9 texRed;
    LPDIRECT3DTEXTURE9 texYellow;
    LPDIRECT3DTEXTURE9 texGreen;
    LPDIRECT3DTEXTURE9 texTur;
    LPDIRECT3DTEXTURE9 texOrange;
    LPDIRECT3DTEXTURE9 texCustom;
    LPDIRECT3DTEXTURE9 texPurple;
    
    
    
    
    
    
    
    
    	
    
    
    
    
    
    
    
    oEndScene	pEndScene; 
    oReset		pReset;
    oDrawIndexedPrimitive    pDrawIndexedPrimitive;
    
    
    
    
    //=============================================================================================================================
    
    //================================================================================================================
    
    
    HRESULT GenerateTexture(IDirect3DDevice9 *pD3Ddev, IDirect3DTexture9 **ppD3Dtex, DWORD colour32)
    {
    if( FAILED(pD3Ddev->CreateTexture(8, 8, 1, 0, D3DFMT_A4R4G4B4, D3DPOOL_MANAGED, ppD3Dtex, NULL)) )
    return E_FAIL;
     
    WORD colour16 = ((WORD)((colour32>>28)&0xF)<<12)
    |(WORD)(((colour32>>20)&0xF)<<8)
    |(WORD)(((colour32>>12)&0xF)<<4)
    |(WORD)(((colour32>>4)&0xF)<<0);
    D3DLOCKED_RECT d3dlr; 
    (*ppD3Dtex)->LockRect(0, &d3dlr, 0, 0);
    WORD *pDst16 = (WORD*)d3dlr.pBits;
    for(int xy=0; xy < 8*8; xy++)
    *pDst16++ = colour16;
    (*ppD3Dtex)->UnlockRect(0);
    return S_OK;
    }
    
    
    
    
    
    
    
    bool WaitForGame(void){
    	if(GetModuleHandleA("d3d9.dll") != NULL && GetModuleHandleA("ClientFX.fxd") != NULL && GetModuleHandleA("CShell.dll") != NULL)
    		return true;
    
    	return false;
    }
    
    void PostReset(PDEVICE pde){
    	if (pDevice1 != pde)
    	{
    		pDevice1 = pde;
    		try
    		{
    			if (pFont != NULL){
    				pFont->Release();
    			}
    
    		} catch (...) {}
    		pFont = NULL;
    		D3DXCreateFontA(pde, 15, 5, FW_BOLD, 1, 0, DEFAULT_CHARSET,  OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Times New Roman", &pFont);		
    	}
    	
    	if( pFont == NULL)
    		D3DXCreateFontA(pde, 15, 5, FW_BOLD, 1, 0, DEFAULT_CHARSET,  OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_MODERN, "Times New Roman", &pFont);		
    }
    
    
    
    
    //==================================================
    
    bool Main_Info;
    bool Main_Settings;
    bool Main_Render;
    bool Main_Hack;
    bool Main_ESP;
    
    bool bMenu_Front;
    bool bMenu_Back;
    bool bFont_Color;
    
    bool Load = true;
    bool Save;
    
    bool Wallhack_Team;
    bool Wallhack_Enemy;
    bool Wallhack_Front;
    bool Wallhack_Back;
    
    
    //_______MOUSE_________________________
    POINT Mouse;
    
    LPDIRECT3DTEXTURE9 Mouse_Pointer;
    LPDIRECT3DTEXTURE9 Logo_Texture;
    LPD3DXSPRITE oSprite = NULL;
    D3DXVECTOR3 Mouse_Pos;
    D3DXVECTOR3 Logo_Pos;
    bool Logo = true;
    int MenuX;
    int MenuY;
    //------------------menu size-----------------------
    //back
    int Menu_Back_W = 510;
    int Menu_Back_H = 340;
    			
    //front
    int Menu_Width = 490;
    int Menu_Height = 270;
    
    //------------------menu color-----------------------
    //back menu color
    int Menu_Alpha = 120;
    int Menu_Red = 70;
    int Menu_Green = 80;
    int Menu_Blue = 71;
    
    
    //------------------menu font type---------------------
    int Menu_Font = 5;
    char sFont_Type[20];
    
    
    
    //------------------menu font color--------------------
    int Text_Color_R = 255;
    int Text_Color_G = 255;
    int Text_Color_B = 255;
    
    //position of player statbox
    int StatX = 10;
    int StatY = 400;
    
    //position of server statbox
    int Stat2X;
    int Stat2Y = 1;
    
    //stabox size
    int Stat_W = 200;
    int Stat_H = 200;
    
    //alpha color of the stat Box
    int Stat_A = 150;
    
    //2d radar 
    float Radar_Width = 200.0;
    float Radar_Height = 200.0;
    
    struct menu{
    	int BaseX;
    	int BaseY;
    	int BaseW;
    	int BaseH;
    } Janela;
    
    //draw text
    //draw text
    void DrawMyText(char pString[], int x, int y, D3DCOLOR col, ID3DXFont *font)    
    {																			    
    	RECT FontRect = { x, y, x+500, y+50 };									   
    	font->DrawText( NULL, pString, -1, &FontRect, DT_LEFT | DT_WORDBREAK, col);	
    }
    
    void DrawRect(IDirect3DDevice9* Unidade, int baseX, int baseY, int baseW, int baseH, D3DCOLOR Cor)
    {
    D3DRECT BarRect = { baseX, baseY, baseX + baseW, baseY + baseH }; 
    Unidade->Clear(1, &BarRect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, Cor, 0,  0); 
    }
    
    //front
    void SteamBase(IDirect3DDevice9* Unidade, int baseX, int baseY, int baseW, int baseH, D3DCOLOR Linha2, D3DCOLOR Linha1, D3DCOLOR Linha3)
    {
    DrawRect(Unidade, baseX+1, baseY+1, baseW+1, baseH+1, Linha1); 
    
    DrawRect(Unidade, baseX, baseY-1, baseW+1 , baseH, Linha2);
    
    DrawRect(Unidade, baseX+1, baseY, baseW , baseH , Linha3);
    }
    
    //back
    void SteamBack(IDirect3DDevice9* Unidade,int baseX, int baseY, int baseW, int baseH, D3DCOLOR Linha2, D3DCOLOR Linha1, D3DCOLOR Linha3)
    {
    DrawRect(Unidade, baseX+1, baseY+1, baseW+1, baseH+1, Linha1); 
    
    DrawRect(Unidade, baseX, baseY-1, baseW+1 , baseH, Linha2);
    
    DrawRect(Unidade, baseX+1, baseY, baseW , baseH , Linha3);
    }
    
    //button
    void SteamButton(IDirect3DDevice9* Unidade, int baseX, int baseY, int baseW, int baseH, D3DCOLOR Linha2, D3DCOLOR Linha1, D3DCOLOR Linha3)
    {
    DrawRect(Unidade, baseX+1, baseY+1, baseW+1, baseH+1, Linha1); 
    
    DrawRect(Unidade, baseX, baseY-1, baseW+1 , baseH, Linha2);
    
    DrawRect(Unidade, baseX+1, baseY, baseW , baseH , Linha3);
    }
    
    //checkbox
    void SteamCheckBox(IDirect3DDevice9* Unidade,int baseX, int baseY, int baseW, int baseH, D3DCOLOR Linha2, D3DCOLOR Linha1, D3DCOLOR Linha3)
    {
    DrawRect(Unidade, baseX+1, baseY+1, baseW+1, baseH+1, Linha1); 
    
    DrawRect(Unidade, baseX, baseY-1, baseW+1 , baseH, Linha2);
    
    DrawRect(Unidade, baseX+1, baseY, baseW , baseH , Linha3);
    }
    
    void fillrgba(int x, int y, int w, int h, int r, int g, int b, int a);
    void drawopx(int x, int y, int width, int height, int r, int g, int b, int a, int l);
    void DrawStatBox(int x, int y, int w, int h, int r, int g, int b, int a,int rr, int gg, int bb, int aa, int l);
    
    
    ID3DXLine *pLiner;
    
    void fillrgba(int x, int y, int w, int h, int r, int g, int b, int a)
    {
    	D3DXVECTOR2 vLine[2];
    
    	pLiner->SetWidth( w );
    	pLiner->SetAntialias( true );
    	pLiner->SetGLLines( true );
    
    	vLine[0].x = x + w/2;
    	vLine[0].y = y;
    	vLine[1].x = x + w/2;
    	vLine[1].y = y + h;
    
    	pLiner->Begin();
    	pLiner->Draw(vLine, 2, D3DCOLOR_RGBA( r, g, b, a ));
    	pLiner->End();
    }
    //=============================================
    void drawopx(int x, int y, int width, int height, int r, int g, int b, int a, int line)
    {
    	fillrgba(x,y+height,width,line,r,g,b,a);
    	fillrgba(x,y,line,height,r,g,b,a);
    	fillrgba(x,y,width,line,r,g,b,a);
    	fillrgba(x+width,y,line,height,r,g,b,a);
    }
    //
    void DrawStatBox(int x, int y, int w, int h, int r, int g, int b, int a,int rr, int gg, int bb, int aa, int l)
    {
    	drawopx(x,y,w,h,r,g,b,a,l); 
    	fillrgba(x,y,w,h,rr,gg,bb,aa); 
    }
    
    //__________________CREATE CIRCLE FUNC___________________________________________________
    ID3DXLine *gLine;
    
    void Circle(int X, int Y, int radius, int numSides, D3DCOLOR Color)
    {
    	D3DXVECTOR2 Line[128];
    	float Step = PI * 2.0 / numSides;
    	int Count = 0;
    	for (float a=0; a < PI*2.0; a += Step)
    	{
    		float X1 = radius * cos(a) + X;
    		float Y1 = radius * sin(a) + Y;
    		float X2 = radius * cos(a+Step) + X;
    		float Y2 = radius * sin(a+Step) + Y;
    		Line[Count].x = X1;
    		Line[Count].y = Y1;
    		Line[Count+1].x = X2;
    		Line[Count+1].y = Y2;
    		Count += 2;
    	}
    	gLine->Begin();
    	gLine->Draw(Line,Count,Color);
    	gLine->End();
    }
    
    
    
    
    
    
    
    
    //esp format
    #include <math.h>
    #include "cod4_structs.h"
    
    #define MAX_PLAYERS			64
    #define M_PI				3.14159265358979323846
    #define	PITCH				0
    #define	YAW					1
    #define	ROLL				2
    
    
    
    #define DotProduct(x,y)			((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
    #define VectorSubtract(a,b,c)	((c)[0]=(a)[0]-(b)[0],(c)[1]=(a)[1]-(b)[1],(c)[2]=(a)[2]-(b)[2])
    #define VectorAdd(a,b,c)		((c)[0]=(a)[0]+(b)[0],(c)[1]=(a)[1]+(b)[1],(c)[2]=(a)[2]+(b)[2])
    #define VectorCopy(a,b)			((b)[0]=(a)[0],(b)[1]=(a)[1],(b)[2]=(a)[2])
    #define	VectorScale(v, s, o)	((o)[0]=(v)[0]*(s),(o)[1]=(v)[1]*(s),(o)[2]=(v)[2]*(s))
    #define	VectorMA(v, s, b, o)	((o)[0]=(v)[0]+(b)[0]*(s),(o)[1]=(v)[1]+(b)[1]*(s),(o)[2]=(v)[2]+(b)[2]*(s))
    #define VectorCmp(a,b)			(((a)[0]==(b)[0])&&((a)[1]==(b)[1])&&((a)[2]==(b)[2]))
    
    /*FOR CG_TRACE---------------------------
    0045A292   6A 00            PUSH 0
    0045A294   6A 00            PUSH 0
    0045A296   50               PUSH EAX
    0045A297   8B4424 20        MOV EAX,DWORD PTR SS:[ESP+20]
    0045A29B   51               PUSH ECX
    0045A29C   8B4C24 20        MOV ECX,DWORD PTR SS:[ESP+20]
    0045A2A0   52               PUSH EDX
    0045A2A1   50               PUSH EAX
    0045A2A2   8B4424 30        MOV EAX,DWORD PTR SS:[ESP+30]
    0045A2A6   51               PUSH ECX
    0045A2A7   E8 94FCFFFF      CALL iw3mp.00459F40
    
    __asm{
    push    0x00
    push    0x00
    push    0x02803001
    push    ecx
    lea     edx,Origin //EnemyXYZ
    push    edx
    lea     eax,vOrg //MyXYZ
    push    nullvec
    push    eax
    mov     eax,nullvec
    lea     edi,trace
    call    TraceAddress
    }
    */
    
    #define	CONTENTS_SOLID			1
    #define	CONTENTS_SLIME			16
    #define	CONTENTS_BODY			0x2000000
    vec3_t nullvec = { 0,0,0 };
    
    // plane_t structure
    // !!! if this is changed, it must be changed in asm code too !!!
    typedef struct cplane_s {
    	vec3_t	normal;
    	float	dist;
    	byte	type;			// for fast side tests: 0,1,2 = axial, 3 = nonaxial
    	byte	signbits;		// signx + (signy<<1) + (signz<<2), used as lookup during collision
    	byte	pad[2];
    } cplane_t;
    
    // a trace is returned when a box is swept through the world
    typedef struct 
    {
    	bool	allsolid;	// if true, plane is not valid
    	bool	startsolid;	// if true, the initial point was in a solid area
    	float		fraction;	// time completed, 1.0 = didn't hit anything
    	vec3_t		endpos;		// final position
    	cplane_t	plane;		// surface normal at impact, transformed to world space
    	int			surfaceFlags;	// surface hit
    	int			contents;	// contents on other side of surface hit
    	int			entityNum;	// entity the contacted sirface is a part of
    } trace_t;
    
    typedef bool( __cdecl* FTrace) (trace_t*,vec3_t,vec3_t,vec3_t,vec3_t,int,DWORD);
    FTrace pTrace = (FTrace)0x0045A230;
    
    bool IsVisible( vec3_t Origin )
    {
        trace_t trace;
        
        pTrace( &trace, refdef->viewOrg, nullvec, nullvec, Origin, 0, (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_SLIME) );
        
    	if( trace.fraction != 1.0 )
            return false;
        
        return true;
    }
    //FOR CG_TRACE---------------------------
    
    float AngleNormalize360( float angle )
    {
    	return ( 360.0 / 65536 ) * ( (int)( angle * ( 65536 / 360.0 ) ) & 65535 );
    }
    float AngleNormalize180( float angle )
    {
    	angle = AngleNormalize360( angle );
    	if( angle > 180.0 )
    	{
    		angle -= 360.0;
    	}
    	return angle;
    }
    
    void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) {
    	float	angle;
    	static float	sr, sp, sy, cr, cp, cy;
    
    	angle = angles[YAW] * (M_PI*2 / 360);
    	sy = sin(angle);
    	cy = cos(angle);
    	angle = angles[PITCH] * (M_PI*2 / 360);
    	sp = sin(angle);
    	cp = cos(angle);
    	angle = angles[ROLL] * (M_PI*2 / 360);
    	sr = sin(angle);
    	cr = cos(angle);
    
    	if (forward){
    		forward[0] = cp*cy;
    		forward[1] = cp*sy;
    		forward[2] = -sp;
    	}
    	if (right){
    		right[0] = (-1*sr*sp*cy+-1*cr*-sy);
    		right[1] = (-1*sr*sp*sy+-1*cr*cy);
    		right[2] = -1*sr*cp;
    	}
    	if (up){
    		up[0] = (cr*sp*cy+-sr*-sy);
    		up[1] = (cr*sp*sy+-sr*cy);
    		up[2] = cr*cp;
    	}
    }
    
    void vectoangles(const vec3_t value1, vec3_t angles)
    {
        float forward;
        float yaw, pitch;
    
        if (value1[1] == 0 && value1[0] == 0) {
    	yaw = 0;
    	if (value1[2] > 0) {
    	    pitch = 90;
    	} else {
    	    pitch = 270;
    	}
        } else {
    	if (value1[0]) {
    	    yaw = (atan2(value1[1], value1[0]) * 180 / M_PI);
    	} else if (value1[1] > 0) {
    	    yaw = 90;
    	} else {
    	    yaw = 270;
    	}
    	if (yaw < 0) {
    	    yaw += 360;
    	}
    
    	forward = sqrt(value1[0] * value1[0] + value1[1] * value1[1]);
    	pitch = (atan2(value1[2], forward) * 180 / M_PI);
    	if (pitch < 0) {
    	    pitch += 360;
    	}
        }
    
        angles[PITCH] = -pitch;
        angles[YAW] = yaw;
        angles[ROLL] = 0;
    }
    
    bool WorldToScreen(vec3_t vWorldLocation, float * fScreenX, float * fScreenY)
    {
    	float fXZ, fYZ;
    	int iCenterX, iCenterY;    
    	vec3_t vLocal, vTransForm, vForward, vRight, vUpward;
    
    	iCenterX = Viewport.Width / 2;
    	iCenterY = Viewport.Height / 2;
    
    	AngleVectors(refdef->refdefViewAngles, vForward, vRight, vUpward);
    	VectorSubtract(vWorldLocation, refdef->viewOrg, vLocal);
    
        vTransForm[0] = DotProduct (vLocal, vRight);
        vTransForm[1] = DotProduct (vLocal, vUpward);
        vTransForm[2] = DotProduct (vLocal, vForward);
    
        if (vTransForm[2] < 0.01)
    	{
    		return 0;
        }
    	/*
    	fXZ = iCenterX / vTransForm[2] * ( fovx / ( refd->fov_x * fovx ));
    	fYZ = iCenterY / vTransForm[2] * ( fovy / ( refd->fov_y * fovy ));
    	out->x = iCenterX + fXZ * vTransForm[0];
    	out->y = iCenterY - fYZ * vTransForm[1];
    	*/
    
    	fXZ = iCenterX / vTransForm[2] * (90 / (refdef->fov_x * 100));
    	fYZ = iCenterY / vTransForm[2] * (90 / (refdef->fov_y * 100));
    
        *fScreenX = iCenterX + fXZ * vTransForm[0];
        *fScreenY = iCenterY - fYZ * vTransForm[1];
    
        return 1;
    }
    
     float VectorLength( const vec3_t v ) 
    {
        return ( float )sqrt ( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] );
    }
    
    //-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
    
    float GetDistance( const vec3_t p1, const vec3_t p2 ) 
    {
    	vec3_t  v;
    	VectorSubtract( p2, p1, v );
    	return VectorLength( v );
    }
    
    
    DWORD GetHypotenuseFromCenter(vec3_t Point)
    {
    	float ScreenX, ScreenY, XDif, YDif, xcenter, ycenter;
    
    	xcenter = Viewport.Width/2;
    	ycenter = Viewport.Height/2;
    
    	if(WorldToScreen(Point, &ScreenX, &ScreenY) == false)
    		return 0xFFFFFFFF;
    
    	ScreenX > xcenter ? XDif = ScreenX - xcenter : XDif = xcenter - ScreenX;
    	ScreenY > ycenter ? YDif = ScreenY - ycenter : YDif = ycenter - ScreenY;
    
    	return (DWORD)sqrt( ((XDif*XDif) + (YDif*YDif)) );
    }
    
    int GetClosestClientByXhair()
    {
    	int ClientNum = -1;
    	DWORD CurHypotenuse = 0xFFFFFFFF;
    	DWORD Tmp;
    	vec3_t pos;
    
    	for(int ID = 0; ID < MAX_PLAYERS; ID++)
    	{
    		if(Centity[ID].isAlive == 1)
    		{
    			pos[0] = Centity[ID].X;
    			pos[1] = Centity[ID].Y;
    			pos[2] = Centity[ID].Z;
    
    			Tmp = GetHypotenuseFromCenter(pos);
    			if(Tmp < CurHypotenuse)
    			{
    				ClientNum = ID;
    				CurHypotenuse = Tmp;
    			}
    		}
    	}
    
    	return ClientNum;
    }
    
    void VectorAngle(const vec3_t Fwd, vec3_t Angle)
    {
        float Tmp, Yaw, Pitch;
    
        if(Fwd[1] == 0 && Fwd[0] == 0) 
    	{
    		Yaw = 0;
    		if(Fwd[2] > 0) Pitch = 90;
    		else Pitch = 270;
        } 
    	else
    	{
    		Yaw = (atan2(Fwd[1], Fwd[0]) * 180 / M_PI);
    		if(Yaw < 0) Yaw += 360;
    
    		Tmp = sqrt(Fwd[0] * Fwd[0] + Fwd[1] * Fwd[1]);
    		Pitch = (atan2(Fwd[2], Tmp) * 180 / M_PI);
    		if(Pitch < 0) Pitch += 360;
        }
    
        Angle[PITCH] = Pitch;
        Angle[YAW] = Yaw;
        Angle[ROLL] = 0;
    }
    /*
    void RadarPlayers (void)
        {
    	for (int i = 0; i < snapi->numEntities; i++)
    	    {
    		if(snapi->entities[i].pos.trType == TR_INTERPOLATE || snapi->entities[i].pos.trType == TR_LINEAR_STOP || snapi->entities[i].pos.trType == TR_LINEAR)
    			{
    			if (!(snapi->entities[i].eFlags & EF_DEAD)&& snapi->entities[i].eType == ET_PLAYER)
    			    {
    
      vec3_t dirplayer, dirlook;
      float dist, angleplayer, anglelook, angle;
      vec4_t red   = { 1.0f, 0.0f, 0.0f, RADAR_ALPHA };
      vec4_t green = { 0.0f, 1.0f, 0.0f, RADAR_ALPHA };
      vec4_t white = { 1.0f, 1.0f, 1.0f, RADAR_ALPHA };
      float *color;
      VectorSubtract (refd->vieworg, snapi->entities[i].pos.trBase, dirplayer);
      dirplayer[2] = 0;
      dist = VectorNormalize (dirplayer);
      if (dist > RADAR_RANGE * 0.8f)
      return;
      dist = dist / RADAR_RANGE;
      dist *= RADAR_RADIUS;
      AngleVectors (refd->viewangles, dirlook, NULL, NULL);
      dirlook[2] = 0;
      angleplayer = atan2 (dirplayer[0], dirplayer[1]);
      VectorNormalize (dirlook);
      anglelook = atan2 (dirlook[0], dirlook[1]);
      angle = anglelook - angleplayer;
      if (g_teamgame && gcg_teamcheck->integer > 0){
      if (gcg_teamcheck->integer == 2){
      if (info_getteam (snapi->entities[i].clientNum) ==
      info_getteam (pps->clientNum))
      color = (float *) &green;   // friendly
      else
      color = (float *) &red;     // enemy
      }
      if (gcg_teamcheck->integer == 1) {
      if (info_getteam (snapi->entities[i].clientNum) ==
      info_getteam (pps->clientNum))
      color = (float *) &red;     // enemy
      else
      color = (float *) &green;   // friendly
    }}
      else
      color = (float *) &red;     // enemy
      trap_R_SetColor (color);
      drawFillRect(RADAR_X + RADAR_RADIUS + sin( angle ) * dist,RADAR_Y + RADAR_RADIUS + cos( angle ) * dist,
    			             3,3,(360 - snapi->entities[i].angles[YAW]) + refd->viewangles[YAW], color);
    
    			}
    		}
    	}
    }
    */
    
    int Entity2Radar(centity_t *cent, float *screenX, float *screenY)
    {
    	vec3_t vec,rot,pos;
    	float distance, RadarPos_X, RadarPos_Y;
    
    	RadarPos_X = (Viewport.Width/2) - 100.0;
    	RadarPos_Y = (Viewport.Height * 0.020);
    
    	if( (cent->isAlive == 0) )
    		return 0;
    
    	pos[0] = cent->X;
    	pos[1] = cent->Y;
    	pos[2] = cent->Z;
    
    		VectorSubtract(pos,refdef->viewOrg,vec);
    		vec[2]=0.0;
    		distance = GetDistance( pos, refdef->viewOrg) / 25;
    		VectorAngle(vec,rot);
    		rot[1]=AngleNormalize360(rot[1]- refdef->refdefViewAngles[1]);
    		AngleVectors(rot,vec,0,0);
    		VectorScale(vec,distance,vec);
    
    	if(vec[0]>100.0f)
    	   VectorScale(vec,100.0f/vec[0],vec);
    	else if(vec[0]<-100.0f)
    	   VectorScale(vec,-100.0f/vec[0],vec);
    	if(vec[1]>100.0f)
    	   VectorScale(vec,100.0f/vec[1],vec);
    	else if(vec[1]<-100.0f)
    	   VectorScale(vec,-100.0f/vec[1],vec);
    
    	*screenX = (float)-vec[1] + (RadarPos_X + 100.0);
    	*screenY = (float)-vec[0] + (RadarPos_Y + 100.0);
    
    	return 1;
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    HRESULT WINAPI myReset ( PDEVICE pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters )
    {	
    	pFont->OnLostDevice();
    	pFont->OnResetDevice();
    
    	pFont = NULL;
    
    	return pReset(pDevice, pPresentationParameters);
    }
    
    
        
     
    
    HRESULT WINAPI myEndScene (PDEVICE pDevice)
    {	
    
    		
    	if (pFont){
    		RenderMenu(pDevice);
    	}else{
    		PostReset(pDevice);	
    		RenderMenu(pDevice);
    	}
    
    	
    	DWORD IsInGame = *( DWORD* )0x0074E35C;
    	
    
    
    
    
    
    GenerateTexture(pDevice, &texRed, D3DCOLOR_ARGB (255,255,0 ,0 ));
    GenerateTexture(pDevice, &texYellow, D3DCOLOR_ARGB (255,255,255,0 ));
    GenerateTexture(pDevice, &texGreen, D3DCOLOR_ARGB (255,0 ,255,0 ));
    GenerateTexture(pDevice, &texBlue, D3DCOLOR_ARGB (255,0 ,0 ,255));
    GenerateTexture(pDevice, &texPurple, D3DCOLOR_ARGB (255,102,0 ,153));
    GenerateTexture(pDevice, &texPink, D3DCOLOR_ARGB (255,255,20 ,147));
    GenerateTexture(pDevice, &texOrange, D3DCOLOR_ARGB (255,255,165,0 ));
    GenerateTexture(pDevice, &texBlack, D3DCOLOR_ARGB (255,0 ,0 ,0 ));
    GenerateTexture(pDevice, &texWhite, D3DCOLOR_ARGB (255,255,255,255));
    
    
    
    
    /*
    	GenerateShader( pDevice, &sa.PixelShader[0], 0.0, 0.0, 1.0 );//blue
        GenerateShader( pDevice, &sa.PixelShader[1], 0.0, 1.0, 0.0 );//green
        GenerateShader( pDevice, &sa.PixelShader[2], 1.0, 0.5, 0.0 );//orange
        GenerateShader( pDevice, &sa.PixelShader[3], 1.0, 0.0, 1.0 );//purple
        GenerateShader( pDevice, &sa.PixelShader[4], 1.0, 0.0, 0.0 );//red
        GenerateShader( pDevice, &sa.PixelShader[5], 1.0, 1.0, 1.0 );//white
        GenerateShader( pDevice, &sa.PixelShader[6], 1.0, 1.0, 0.0 );//yellow
    	GenerateShader( pDevice, &sa.PixelShader[7], 0.0, 0.0, 0.0 );//black*/
    
    
    if(xhair)
    	 { 
    pDevice->GetViewport(&Viewport);
    ScreenCenterX = (float)Viewport.Width / 2;
    ScreenCenterY = (float)Viewport.Height / 2;
    D3DRECT rec4 = {ScreenCenterX-35, ScreenCenterY, ScreenCenterX+ 35, ScreenCenterY+1};
    D3DRECT rec5 = {ScreenCenterX, ScreenCenterY-35, ScreenCenterX+ 1,ScreenCenterY+35}; 
    pDevice->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DXCOLOR(0.62745098, 0.125490, 0.959999, 1.0), 0, 0 );//purple
    pDevice->Clear( 1, &rec5, D3DCLEAR_TARGET, D3DXCOLOR(0.62745098, 0.125490, 0.959999, 1.0), 0, 0 ); 
    D3DRECT rec6 = {ScreenCenterX-30, ScreenCenterY, ScreenCenterX+ 30, ScreenCenterY+1};
    D3DRECT rec7 = {ScreenCenterX, ScreenCenterY-30, ScreenCenterX+ 1,ScreenCenterY+30}; 
    pDevice->Clear( 1, &rec6, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 1.0, 1.0), 0, 0 );//blue
    pDevice->Clear( 1, &rec7, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 1.0, 1.0), 0, 0 ); 
    D3DRECT rec8 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
    D3DRECT rec9 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25}; 
    pDevice->Clear( 1, &rec8, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 1.0, 1.0), 0, 0 );//cyan
    pDevice->Clear( 1, &rec9, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 1.0, 1.0), 0, 0 );
    D3DRECT rec10 = {ScreenCenterX-20, ScreenCenterY, ScreenCenterX+ 20, ScreenCenterY+1};
    D3DRECT rec11 = {ScreenCenterX, ScreenCenterY-20, ScreenCenterX+ 1,ScreenCenterY+20}; 
    pDevice->Clear( 1, &rec10, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), 0, 0 );// green
    pDevice->Clear( 1, &rec11, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 1.0, 0.0, 1.0), 0, 0 );
    D3DRECT rec12 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+1};
    D3DRECT rec13 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 1,ScreenCenterY+15}; 
    pDevice->Clear( 1, &rec12, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );// yellow
    pDevice->Clear( 1, &rec13, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );
    
    D3DRECT rec14 = {ScreenCenterX-10, ScreenCenterY, ScreenCenterX+ 10, ScreenCenterY+1};
    D3DRECT rec15 = {ScreenCenterX, ScreenCenterY-10, ScreenCenterX+ 1,ScreenCenterY+10}; 
    pDevice->Clear( 1, &rec14, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.549019608, 0.0, 1.0), 0, 0 );// orange
    pDevice->Clear( 1, &rec15, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.549019608, 0.0, 1.0), 0, 0 );
    D3DRECT rec16 = {ScreenCenterX-5, ScreenCenterY, ScreenCenterX+ 5, ScreenCenterY+1};
    D3DRECT rec17 = {ScreenCenterX, ScreenCenterY-5, ScreenCenterX+ 1,ScreenCenterY+5}; 
    pDevice->Clear( 1, &rec16, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );//red
    pDevice->Clear( 1, &rec17, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
    } 
    
    
    
    if (xhair2)
    {
        D3DRECT rec1 = {ScreenCenterX-25, ScreenCenterY, ScreenCenterX+ 25, ScreenCenterY+1};
        D3DRECT rec2 = {ScreenCenterX, ScreenCenterY-25, ScreenCenterX+ 1,ScreenCenterY+25};  
        pDevice->Clear( 1, &rec1, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0,  0 );
        pDevice->Clear( 1, &rec2, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0,  0 );
    //red
    
        
        D3DRECT rec3 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+1};
        D3DRECT rec4 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 1,ScreenCenterY+15};  
        pDevice->Clear( 1, &rec3, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 0.0, 0.0), 0,  0 );
        pDevice->Clear( 1, &rec4, D3DCLEAR_TARGET, D3DXCOLOR(0.0, 0.0, 0.0, 0.0), 0,  0 );
    // black
        
        D3DRECT rec5 = {ScreenCenterX-3, ScreenCenterY, ScreenCenterX+ 3, ScreenCenterY+1};
        D3DRECT rec6 = {ScreenCenterX, ScreenCenterY-3, ScreenCenterX+ 1,ScreenCenterY+3};  
        pDevice->Clear( 1, &rec5, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0,  0 );
        pDevice->Clear( 1, &rec6, D3DCLEAR_TARGET, D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0,  0 );
    // black
    }
    
    
    
    
    
    
    
    
    
    
    if(xhair3)
    	{
    
    				
       D3DRECT rec2 = {ScreenCenterX-10, ScreenCenterY, ScreenCenterX+10, ScreenCenterY+1};
    	D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-10, ScreenCenterX+ 1,ScreenCenterY+10};								
    	pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );//red
    	pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 0.0, 0.0, 1.0), 0, 0 );
    	}
    
    
    if(xhair4)
    	 {
        D3DRECT rec2 = {ScreenCenterX-15, ScreenCenterY, ScreenCenterX+ 15, ScreenCenterY+2};
    	D3DRECT rec3 = {ScreenCenterX, ScreenCenterY-15, ScreenCenterX+ 2,ScreenCenterY+15};
    								
    	pDevice->Clear(1, &rec2, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );// yellow
    	pDevice->Clear(1, &rec3, D3DCLEAR_TARGET,D3DXCOLOR(1.0, 1.0, 0.0, 1.0), 0, 0 );
    	}
    
    
    
    
    
    if(fullbright)
    {
    pDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE );
    }
    
    
    
    if(sair){
    		ExitProcess(0);
    	}
    
    
    
    
    		
    		if(Console)
    		{
    			WriteProcessMemory(hand, (void*)(UNLOCK_CONSOLE), ConsoleOn, sizeof(ConsoleOn), &bytes);
    			WriteProcessMemory(hand, (void*)(WRITEPROTECTED), WriteProtectedOn, sizeof(WriteProtectedOn), &bytes);
    		}
    		else
    		{
    			WriteProcessMemory(hand, (void*)(UNLOCK_CONSOLE), ConsoleOff, sizeof(ConsoleOff), &bytes);
    			WriteProcessMemory(hand, (void*)(WRITEPROTECTED), WriteProtectedOrig, sizeof(WriteProtectedOrig), &bytes);
    		}
    
    		if(Nametags)
    		{
    			WriteProcessMemory(hand, (void*)(NAMETAGS1), NopSix, sizeof(NopSix), &bytes);
    			WriteProcessMemory(hand, (void*)(NAMETAGS2), NopSix, sizeof(NopSix), &bytes);
    			WriteProcessMemory(hand, (void*)(NAMETAGS3), NopTwo, sizeof(NopTwo), &bytes);	
    		}
    		else
    		{
    			WriteProcessMemory(hand, (void*)(NAMETAGS1), Tags1, sizeof(Tags1), &bytes);
    			WriteProcessMemory(hand, (void*)(NAMETAGS2), Tags2, sizeof(Tags2), &bytes);
    			WriteProcessMemory(hand, (void*)(NAMETAGS3), Tags3, sizeof(Tags3), &bytes);
    		}
    
    	
    		if(Laser)
    		{
    			WriteProcessMemory(hand, (void*)(LASER), LaserOn, sizeof(LaserOn), &bytes);
    		}
    		else
    		{
    			WriteProcessMemory(hand, (void*)(LASER), LaserOrig, sizeof(LaserOrig), &bytes);
    		}
    
    		if(boxESP)
    		{
    			WriteProcessMemory(hand, (void*)(BOXESP1), Box1On, sizeof(Box1On), &bytes);
    			WriteProcessMemory(hand, (void*)(BOXESP2), Box2On, sizeof(Box2On), &bytes);
    		}
    		else
    		{
    			WriteProcessMemory(hand, (void*)(BOXESP1), Box1Orig, sizeof(Box1Orig), &bytes);
    			WriteProcessMemory(hand, (void*)(BOXESP2), Box2Orig, sizeof(Box2Orig), &bytes);
    		}
    
    		if(Minimap)
    		{
    			WriteProcessMemory(hand, (void*)(MINIMAP), NopFive, sizeof(NopFive), &bytes);
    		}
    		else
    		{
    			WriteProcessMemory(hand, (void*)(MINIMAP), MinimapOrig, sizeof(MinimapOrig), &bytes);
    		}
    		
    		if(IsInGame)
    		{
    			for( int e = 0; e < MAX_PLAYERS; e++ )
    			{
    				int MyTeam;
    				char cDist[1027];
    				char sClass[1024];
    				vec3_t ESP_pos;
    				char Name[1024];
    				float ScreenX,ScreenY,Distance,RadarX,RadarY;
    
    				CClientInfo pInfo = cClientInfo[e];
    				centity_t pEntity = Centity[e];
    
    				if( (pEntity.isAlive == 1) && (cg->clientNum != pEntity.clientNum))
    				{
    					ESP_pos[0] = pEntity.X;
    					ESP_pos[1] = pEntity.Y;
    					ESP_pos[2] = pEntity.Z;
    
    					MyTeam = cClientInfo[cg->clientNum].iTeam;
    					Distance = GetDistance( ESP_pos, refdef->viewOrg) / 48;
    
    					if(WorldToScreen( ESP_pos, &ScreenX, &ScreenY))
    					{
    						/*
    						Prediction:
    
    						Basicly you have to search the Speed Vector of the enemy. 
    						(How much the enemy moves/ms) Furthermore you need to find your Ping.
    						The Basic Calculation looks like following:
    
    						Enemy_Coord.x + (Enemy_Speed.x * LocalPlayer_Ping/1000);
    						Enemy_Coord.y + (Enemy_Speed.y * LocalPlayer_Ping/1000);
    
    						int PingCorrection(APawn* Target)
    						{
    							if (iPingCorrection != 0) 
    							{
    							  return Target->Velocity * fMyPing;
    							}
    						return FVector(0,0,0);
    						}
    							*/
    						if(Aimbot)
    						{
    							if(pEntity.clientNum == GetClosestClientByXhair())
    							{	
    								if(GetAsyncKeyState(VK_LBUTTON))
    								{
    									if(MyTeam != pInfo.iTeam)
    									{
    										SetCursorPos(ScreenX-(rand()%10),ScreenY-(650.0 / Distance)-(rand()%10));//crazy shake effect with rand()
    										drawopx((Viewport.Width/2)-10,(Viewport.Height/2)-10,20,20,255,255,0,255,1);
    									}
    								}
    							}
    						}
    						if(NameESP)
    						{
    							sprintf(Name,"::%s::",pInfo.PlayerName);
    							if(MyTeam == pInfo.iTeam)
    							{
    								DrawMyText(Name,ScreenX+5,ScreenY-70,D3DCOLOR_ARGB(255, 0, 255, 0),Font[Menu_Font]);
    							}
    							else if(MyTeam != pInfo.iTeam)
    							{
    								DrawMyText(Name,ScreenX+5,ScreenY-70,dRed,Font[Menu_Font]);
    							}	
    						}
    						if(DistanceESP)
    						{
    							sprintf(cDist, "D: %.1f", Distance);
    							if(MyTeam == pInfo.iTeam)
    							{
    								DrawMyText(cDist,ScreenX+5,ScreenY-55,D3DCOLOR_ARGB(255, 0, 255, 0),Font[Menu_Font]);	
    							}
    							else if(MyTeam != pInfo.iTeam)
    							{
    								DrawMyText(cDist,ScreenX+5,ScreenY-55,dRed,Font[Menu_Font]);
    							}
    						}
    						if(ClassESP)
    						{
    							const char* temp = pInfo.bodyModel;
    
    							if(strstr(temp,"sniper"))
    								strcpy(sClass,"Sniper");
    							else if(strstr(temp,"cops"))
    								strcpy(sClass,"Spec-Op");
    							else if(strstr(temp,"support"))
    								strcpy(sClass,"Support");
    							else if(strstr(temp,"cqb"))
    								strcpy(sClass,"Custom");
    							else if(strstr(temp,"assault"))
    								strcpy(sClass,"Assault");
    							else if(strstr(temp,"engineer"))
    								strcpy(sClass,"Engineer");
    							else if(strstr(temp,"recon"))
    								strcpy(sClass,"Demolition");
    							else
    								strcpy(sClass,"Unknown");
    
    							if(MyTeam == pInfo.iTeam)
    							{
    								DrawMyText(sClass,ScreenX+5,ScreenY-40,D3DCOLOR_ARGB(255, 0, 255, 0),Font[Menu_Font]);	
    							}
    							else if(MyTeam != pInfo.iTeam)
    							{
    								DrawMyText(sClass,ScreenX+5,ScreenY-40,dRed,Font[Menu_Font]);
    							}
    						}
    						if(BoxESP)
    						{
    							if(MyTeam == pInfo.iTeam)
    							{
    								drawopx(ScreenX-(800.0 / Distance),ScreenY-(1400.0 / Distance),(750.0 / Distance),(1400.0 / Distance),0, 255, 0, 255,1);
    							}
    							else if(MyTeam != pInfo.iTeam)
    							{
    								drawopx(ScreenX-(800.0 / Distance),ScreenY-(1400.0 / Distance),(750.0 / Distance),(1400.0 / Distance),255,0,0,255,1);
    							}	
    						}
    						if(Radar2D)
    						{
    							float Radar_X = (Viewport.Width/2) - 100.0;
    							float Radar_Y = (Viewport.Height * 0.020);
    
    							DrawStatBox(Radar_X,Radar_Y,Radar_Width,Radar_Height,255,255,255,255,Menu_Red,Menu_Green,Menu_Blue,120,2);
    							fillrgba(Radar_X+(Radar_Width/2),Radar_Y,1,Radar_Height,255,255,255,255);
    							fillrgba(Radar_X,Radar_Y+(Radar_Height/2),Radar_Width,1,255,255,255,255);
    							fillrgba(Radar_X+98,Radar_Y+98,4,4,255,255,0,255);
    
    							if( Entity2Radar( &pEntity, &RadarX, &RadarY) )
    							{	
    								if(MyTeam == pInfo.iTeam)
    								{
    									fillrgba(RadarX-1, RadarY-1, 4, 4, 0, 255, 0, 255);
    								}
    								else
    								{
    									fillrgba(RadarX-1, RadarY-1, 4, 4, 255, 0, 0, 255);
    								}
    							}
    						}
    						if(PlayerWarning)
    						{
    							if(MyTeam != pInfo.iTeam)
    							{
    								if(Distance <= 10.0)
    								{
    									DrawMyText("Enemy Is Close To You!",(Viewport.Width/2)-180,15,dRed,Font[11]);
    								}
    							}
    						}
    						if(StealName)
    						{
    							char Steal_Name[1024];
    
    							if(GetAsyncKeyState(VK_NUMPAD1)&1)
    							{
    								sprintf(Steal_Name,"name %s",pInfo.PlayerName);
    								SendCommandToConsole(Steal_Name);	
    							}
    							/*
    								if (bESPHealth) {
    								FColor sColor = ColorWhite;
    								appSprintf(Text, TEXT("    H: %d%%"), Target->Health);
    								if(Target->Health > 70) {
    								  sColor = ColorGreen;
    								} else if (Target->Health > 40) {
    								  sColor = ColorYellow;
    								} else if(Target->Health > 0) {
    								  sColor = ColorRed;
    								}
    							*/
    						}
    					}
    				}
    			}
    		}
    
    
    
    	return pEndScene(pDevice);
    }
    
      
    
    
    
    
    HRESULT WINAPI myDrawIndexedPrimitive(PDEVICE pDevice, D3DPRIMITIVETYPE Type, INT BaseIndex, 
    UINT MinIndex, UINT NumVertices, UINT StartIndex, UINT primCount)
    {
    
    
    /*if(chams)
    {
    if(GoodPlayers&&BadPlayers&&Weapons)
    {
    DWORD dwOldZEnable = D3DZB_TRUE;
    pDevice->SetTexture(0, texRed);
    pDevice->GetRenderState(D3DRS_ZENABLE, &dwOldZEnable);
    pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    pDevice->SetRenderState(D3DRS_ZENABLE, dwOldZEnable);
    pDevice->SetTexture(0, texBlack);
    }
    }
    
    }*/
    
    
    
    	if(chams)
    	{
    		
    		if(Weapons)
    		{
    			pDevice->SetTexture(0, texRed);
    			pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    		}
    		if(GoodPlayers)
    		{
    			pDevice->SetTexture(0, texGreen);
    			pDevice->SetRenderState(D3DRS_ZENABLE,false);
    			
    			pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    
    			pDevice->SetRenderState(D3DRS_ZENABLE,true);
    			pDevice->SetTexture(0, texPurple);
    		}
    		if(BadPlayers)
    		{
    			pDevice->SetTexture(0, texWhite);
    			pDevice->SetRenderState(D3DRS_ZENABLE,false);
    
                pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    			
    			pDevice->SetRenderState(D3DRS_ZENABLE,true);
    			pDevice->SetTexture(0, texBlack);
    		}
    	}
    
    if(unknownhack)
    {
    if(m_Stride == Sky)
    {
    pDevice->SetRenderState( D3DRS_SRCBLEND, 3 );
    pDevice->SetRenderState( D3DRS_DESTBLEND, 4 );
    pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
    }
    }
    
    
    
    
    if (wallhack)
    {
    if (m_Stride == WALLS)
    {
    
     pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
     pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
     pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE);  
    
    }
    }
    
    if(wireframe){
    
    if(GoodPlayers)
    {
    
    DWORD dwZEnable = D3DZB_TRUE;
    pDevice->SetTexture(0, texRed);
    pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
    pDevice->GetRenderState(D3DRS_ZENABLE, &dwZEnable); 
    pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    pDevice->SetRenderState(D3DRS_ZENABLE, dwZEnable);
    pDevice->SetTexture(0, texGreen);}
    else{         
    pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );} 
    
    if(BadPlayers)
    {
    DWORD dwZEnable = D3DZB_TRUE;
    pDevice->SetTexture(0, texYellow);
    pDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
    pDevice->GetRenderState(D3DRS_ZENABLE, &dwZEnable); 
    pDevice->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE);
    pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    pDevice->SetRenderState(D3DRS_ZENABLE, dwZEnable);
    pDevice->SetTexture(0, texBlack);}
    else{         
    pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );} 
    	
    }
    
    
    
    
    
    return pDrawIndexedPrimitive(pDevice, Type, BaseIndex, MinIndex, NumVertices, StartIndex, primCount);
    }
    
    
    
    
    
    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(DWORD dwAddress,DWORD dwLen,BYTE *bMask,char * szMask)
    {
    	for(DWORD i=0; i<dwLen; i++)
    		if (bCompare((BYTE*)(dwAddress+i),bMask,szMask))  return (DWORD)(dwAddress+i);
    	return 0;
    }
    
    void *DetourCreate(BYTE *src, const BYTE *dst, const int len)
    {
    	BYTE *jmp = (BYTE*)malloc(len+5);
    	DWORD dwBack;
    
    	VirtualProtect(src, len, PAGE_EXECUTE_READWRITE, &dwBack);
    	memcpy(jmp, src, len);	
    	jmp += len;
    	jmp[0] = 0xE9;
    	*(DWORD*)(jmp+1) = (DWORD)(src+len - jmp) - 5;
    	src[0] = 0xE9;
    	*(DWORD*)(src+1) = (DWORD)(dst - src) - 5;
    	for (int i=5; i<len; i++)  src[i]=0x90;
    	VirtualProtect(src, len, dwBack, &dwBack);
    	return (jmp-len);
    }
    
    int D3Dhook(void){
    	DWORD		hD3D, adr, *vTable;
    
    	// wait for the d3dx dll
    	hD3D=0;
    	do {
    		hD3D = (DWORD)GetModuleHandleA("d3d9.dll");
    		Sleep(25);
    	} while(!hD3D);
    	adr = FindPattern(hD3D, 0x128000, (PBYTE)"\xC7\x06\x00\x00\x00\x00\x89\x86\x00\x00\x00\x00\x89\x86", "xx????xx????xx");
    	if(adr){
    		memcpy(&vTable,(void *)(adr+2),4);
    		/*pReset				  = (oReset)				DetourCreate((PBYTE)vTable[16]   , (PBYTE)myReset		,5);
     		pEndScene			  = (oEndScene)				DetourCreate((PBYTE)vTable[42]	 , (PBYTE)myEndScene	,5);
    		pDrawIndexedPrimitive   = (oDrawIndexedPrimitive)        DetourFunction((PBYTE)vTable[82]    , (PBYTE)myDrawIndexedPrimitive  ,5);*/
    		pReset				  = (oReset)				DetourFunction((PBYTE)vTable[16]	, (PBYTE)myReset	);
     		pEndScene			  = (oEndScene)				DetourFunction((PBYTE)vTable[42]	, (PBYTE)myEndScene	);
    		pDrawIndexedPrimitive = (oDrawIndexedPrimitive) DetourFunction((PBYTE)vTable[82]    , (PBYTE)myDrawIndexedPrimitive );
    	}
    	CreateThread(NULL,NULL,CallHacks,NULL,NULL,NULL);
    	CreateThread(NULL,NULL,EveryFrame,NULL,NULL,NULL);
    
    	return 0;
    }
    
    
    
    
    BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved ){
    
    	DisableThreadLibraryCalls(hDll);
    
    	if (dwReason == DLL_PROCESS_ATTACH) 	
    		CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)D3Dhook, NULL, NULL, NULL);
    	
    	return TRUE;
    }
    
    //////////////////////HACK PART////////////////////////////////////////////////////////////////
    // group states
    int		CH_cheats	  = 1;
    int  	CH_WallHacks  = 1;
    
    
    // item  states
    int		a[15], b[15], c[15];
    
    // none standard options
    char	*opt_Grp[]     = { ("+"),("-") };
    char	*opt_OffOn[]   = { ("Off"),("On") };
    
    
    D3DMenu *pMenu = NULL;
    
    // --- simple FPS vars and function
    char sFPS[20]= "xxx Fps";
    int	  FPScounter = 0;
    float FPSfLastTickCount = 0.0f;
    float FPSfCurrentTickCount;
    
    void FPScheckW(char*str)
    {
    	FPSfCurrentTickCount = clock() * 0.001f;
    	FPScounter++;
    
    	if((FPSfCurrentTickCount - FPSfLastTickCount) > 1.0f) {
    	    FPSfLastTickCount = FPSfCurrentTickCount;
    		sprintf(str, "%d",FPScounter);
    	    FPScounter = 0;
    	} 
    }
    void MakeMenu(){
    	pMenu->AddText("Framerate", sFPS);
    	pMenu->AddGroup(	("[D3DCheats]"), &CH_cheats, opt_Grp);
    	
       if (CH_cheats) {
    
          pMenu->AddItem(("fullbright")		, &fullbright	, opt_OffOn);
    	  pMenu->AddItem(("xhair")		, &xhair	, opt_OffOn);
    	  pMenu->AddItem(("xhair2")		, &xhair2	, opt_OffOn);
    	  pMenu->AddItem(("xhair3")		, &xhair3	, opt_OffOn);
    	  pMenu->AddItem(("xhair3")		, &xhair4	, opt_OffOn);	
    	  pMenu->AddItem(("Laser")		, &Laser	, opt_OffOn);
    	  pMenu->AddItem(("Minimap")		, &Minimap	, opt_OffOn);
    	  pMenu->AddItem(("KillSpam")		, &KillSpam	, opt_OffOn);
      
    
    
    }
       pMenu->AddGroup(	("[WallHacks]"), &CH_WallHacks, opt_Grp);
    
       if (CH_WallHacks) {
    	  pMenu->AddItem(("Player chams")		, &chams	, opt_OffOn);
    	  pMenu->AddItem(("InvisibleHack")		, &unknownhack	, opt_OffOn);
    	  pMenu->AddItem(("WallHack ")		, &wallhack	, opt_OffOn);
    	  pMenu->AddItem(("WireFrame ")   , &wireframe , opt_OffOn);
    	  pMenu->AddItem(("BoxESP ")   , &BoxESP , opt_OffOn);
    	  pMenu->AddItem(("boxESP 2 ")   , &boxESP , opt_OffOn);
          pMenu->AddItem(("NameESP")			, &NameESP	, opt_OffOn);
    	  pMenu->AddItem(("DistanceESP")		, &DistanceESP	, opt_OffOn);
    	  pMenu->AddItem(("ClassESP")	, &ClassESP	, opt_OffOn);
    	  pMenu->AddItem(("Radar2D")		, &Radar2D , opt_OffOn);
    	  pMenu->AddItem(("PlayerWarning")		, &PlayerWarning	, opt_OffOn);
    	  pMenu->AddItem(("StealName")		, &StealName	, opt_OffOn);
    	  pMenu->AddItem(("Exit Cod4")		, &sair	, opt_OffOn);
    }
    
    
    
    
    }
    void RenderMenu(PDEVICE pDev){
    	if (pMenu==0) {	
    		pMenu = new D3DMenu("Chuculun D3d hack",300,160,200,200, true);// first time , create the menu// title, maxitems,width
    		pMenu->visible=1;										// make it visible
    		pMenu->col_title=0xffffffff;							// change title color to white
    	} else {
    		if(pMenu->visible) FPScheckW(sFPS);
    		if (pMenu->noitems==0) MakeMenu();
    	    pMenu->Show(pFont, pDev);
    		pMenu->Nav();
    	}
    }
    
    void __cdecl PushToConsole( const char* De_Man_Out )
    {
    	DWORD *Client = ( DWORD* )( 0x377C8D2C );
    	void* LazyMan = ( void* )*( DWORD* )( *Client + 0x208 );
     
    	__asm
    	{
    		push De_Man_Out;
    		call LazyMan;
    		add esp, 4;
    	}
    }
    
    void MemEdit(PVOID address, void* val, int bytes)
    {
        DWORD d, ds;
        VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &d);
        memcpy(address, val, bytes);
        VirtualProtect(address,bytes,d,&ds);
    }
    
    //Called EveryFrame
    DWORD WINAPI EveryFrame(LPVOID param){
    	while(1){
    		while(!WaitForGame){Sleep(100);}
    
    		//Do you Hacks Now
    
    	}
    }
    
    //Called Twist a Second
    DWORD WINAPI CallHacks(LPVOID param){
    	while(1){
    		while(!WaitForGame){Sleep(100);}
    
    
    		//Do Hacks Now
    
    		Sleep(500);
    	}
    }
    "MenuFormat.cpp"
    Code:
    
    //	Project : Basic D3D Menu v1.0
    //	Author	: Topblast
    //	Date	: July 22, 2010
    //
    //	Credits : 
    //		People of : Game-Deception, ***, ******, Unknown Cheats, Hans211, Gellin
    //	
    //	Tools used:
    //		Microsoft Visual Studio 2010 ULTIMATE
    //		DirectX SDK Update (June 2010)			
    //		D3Dx9.h									
    //													
    //	Features:										
    //		Use Insert key to show/hide menu
    //		Use up and down arrow keys to manouvre through the menuitems
    //		Use Control + arrow keys to move the menu
    //		Use left and right arrow keys to toggle menuitems
    //		Items can have multiple custom states like: "Off" "On"  or "Head" "Neck" "Spine"
    //		Support for textonly items
    //		Support for folder style items
    //	    Menu GUI
    //
    #include "MenuFormat.h"
    
    // Adding items, group, text to the menu
    void D3DMenu::AddItem(char *txt, int *var, char **opt, int maxval, int typ)
    {
      if (noitems>=(maxitems-1)) return;
      MENU[noitems]->typ=typ;
      MENU[noitems]->txt=txt;
      MENU[noitems]->opt=opt;
      MENU[noitems]->var=var;
      MENU[noitems]->maxval=maxval;
      noitems++;
      totheight=(noitems*height)+titleheight;
    }
    
    void FillRGB( int x, int y, int w, int h, D3DCOLOR color, IDirect3DDevice9* pDevice ) 
    { 
        if( w < 0 )w = 1; 
        if( h < 0 )h = 1; 
        if( x < 0 )x = 1; 
        if( y < 0 )y = 1; 
    
        D3DRECT rec = { x, y, x + w, y + h }; 
        pDevice->Clear( 1, &rec, D3DCLEAR_TARGET, color, 0, 0 ); 
    } 
    
    void DrawBorder( int x, int y, int w, int h, int px, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice ) 
    { 
        FillRGB( x - px, y  - px,  (w+(px+px)) ,(h+(px+px)),    BorderColor, pDevice ); 
    } 
    
    void DrawBox( int x, int y, int w, int h, D3DCOLOR BoxColor, D3DCOLOR BorderColor, IDirect3DDevice9* pDevice ) 
    { 
    	DrawBorder( x, y, w, h, 2,    BorderColor, pDevice ); 
        FillRGB( x, y, w, h,        BoxColor, pDevice ); 
    } 
    
    
    
    
    void DrawString(int x, int y, DWORD color, const char *fmt, LPD3DXFONT g_pFont, DWORD TRPE = DT_NOCLIP )
    {
    	RECT FontPos = { x, y, x + 120, y + 20 };
    	char buf[1024] = {'\0'};
    	va_list va_alist;
    
    	va_start(va_alist, fmt);
    	vsprintf_s(buf, fmt, va_alist);
    	va_end(va_alist);
    
    	g_pFont->DrawTextA(NULL, buf, -1, &FontPos, TRPE, color);
    }
    
    void D3DMenu::AddGroup(char *txt, int *var, char **opt, int maxval)
    {
    	AddItem(txt, var, opt, maxval, MENUGROUP);
    }
    
    void D3DMenu::AddText(char *txt, char *opt)
    {
    	AddItem(txt,0,(char **)opt,0,MENUTEXT);
    }
    
    // Show the Menu
    void D3DMenu::Show(LPD3DXFONT pFont, PDEVICE pDev)
    {
      int	i,val,cy;
      DWORD color;
      DWORD texty;
     
      if (!visible) return;
    
    
      if(back){
    	  DrawBox(x-13,((y-2)+(titleheight)),totwidth+6,((totheight+4)-(titleheight)),0x00000000	, D3DCOLOR_ARGB (255,102,0 ,153)	,pDev);
    	  DrawBox(x-13,(y-2),totwidth+6,titleheight,0x00000000 , D3DCOLOR_ARGB (255,102,0 ,153)	,pDev);
      }
      cy=y;
      if (title) {
    	  DrawString(x-10, cy+1, col_title,title,pFont);
    	  cy+=titleheight;
      }
      for (i=0; i<noitems; i++) {
    	  if (MENU[i]->typ==MENUTEXT) {
    	      DrawString(x, cy, col_text,MENU[i]->txt,pFont);
    		  if (MENU[i]->opt) {
    			  DrawString((x+ofs), cy, col_text,(char *)MENU[i]->opt,pFont, DT_RIGHT);
    		  }
    	  } else  {
    		  val=(MENU[i]->var)?(*MENU[i]->var):0;
    
    		  if (i==cur){
                  color=col_current;
    			  texty=col_current;
    		  }else if(MENU[i]->typ==MENUGROUP){
    			  color=col_group;
    			  texty=col_group;
    		  }else{
    			  color=(val)?col_on:col_off;
    			  texty=(val)?D3DCOLOR_ARGB(255,50,205,50):D3DCOLOR_ARGB( 255, 255, 155, 0 );
    		  }
    		  if(MENU[i]->typ==MENUGROUP){
    			  DrawString(x, cy, texty,MENU[i]->txt,pFont,DT_CENTER);
    			 if (MENU[i]->opt) 
    				  DrawString((x+ofs), cy, color,MENU[i]->opt[val],pFont, DT_RIGHT);
    		  }else{
    			 DrawString(x, cy, texty,MENU[i]->txt,pFont);
    			 if (MENU[i]->opt) 
    				  DrawString((x+ofs), cy, color,MENU[i]->opt[val],pFont, DT_RIGHT);
    		  }
    	 }
         cy+=height;
      }
    }
    
    void D3DMenu::Nav(void)
    {
      if (GetAsyncKeyState(VK_INSERT)&1) visible=(!visible);
      if (!visible) return;
    
      if (GetAsyncKeyState(VK_CONTROL) ) {
        if (GetAsyncKeyState(VK_UP)&1   ) y-=10;
        if (GetAsyncKeyState(VK_DOWN)&1 ) y+=10;
        if (GetAsyncKeyState(VK_LEFT)&1 ) x-=10;
        if (GetAsyncKeyState(VK_RIGHT)&1) x+=10;
      } else {
        if (GetAsyncKeyState(VK_UP)&1) {
    		do {
    			cur--;
    			if (cur<0)  cur=noitems-1;
    		} while (MENU[cur]->typ==MENUTEXT);	
    	} else if (GetAsyncKeyState(VK_DOWN)&1) {
    		do {
    			cur++;
    		    if (cur==noitems) cur=0;
    		} while (MENU[cur]->typ==MENUTEXT);
    	} else if (MENU[cur]->var) {
    		int dir=0;
    		if (GetAsyncKeyState(VK_LEFT )&1 && *MENU[cur]->var > 0                    ) dir=-1;
    		if (GetAsyncKeyState(VK_RIGHT)&1 && *MENU[cur]->var < (MENU[cur]->maxval-1)) dir=1;
    		if (dir) {
    			*MENU[cur]->var += dir;
    			if (MENU[cur]->typ==MENUGROUP) noitems=0; 
    		}
    	}
      }
    }
    
    please make sure to follow same procedures.
    Build your application it has error free.
    and its undetected.
    oh and try to update uffsets and info for esp.
    if you dont updated you will get banned.
    
    ////////////////Hack Part///////////////////////////////
    void RenderMenu(PDEVICE INCASE);
    DWORD WINAPI CallHacks(LPVOID param);
    DWORD WINAPI EveryFrame(LPVOID param);
    Last edited by Heartview; 08-06-2011 at 08:51 AM.
    MPGH ROCKS ADD [email]saunak143@gmail.com /


    https://www.youtube.com/watch?v=ylO50i7TvnI

  2. The Following User Says Thank You to saunak123 For This Useful Post:

    nasehsn (08-10-2011)

  3. #2
    IGotBanned.'s Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    imageshack.us/photo/my-images/190/uban.png
    Posts
    1,290
    Reputation
    -49
    Thanks
    122
    My Mood
    Aggressive
    is this chams?

  4. #3
    nasehsn's Avatar
    Join Date
    Apr 2011
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    My Mood
    Sick
    can u compile it and post a .dll so we dont need to make this shit

  5. #4
    -CooL-'s Avatar
    Join Date
    Aug 2011
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    Hey,

    I'm new can you tell me where i find the active hacks for CoD 4 to PC?

  6. #5
    lightningss's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    amsterdam
    Posts
    216
    Reputation
    10
    Thanks
    66
    My Mood
    Sleepy
    just read, its a multihack. i don't know if its a real new one or just a old script.
    wallhacks, xhairs etc..
    to do list

    MAKE A 'TO DO LIST'


    i bet i'm the firsrt one who finished


    thank me if you stared back

  7. The Following User Says Thank You to lightningss For This Useful Post:

    lucifer4601 (08-28-2011)

  8. #6
    Carl10's Avatar
    Join Date
    Apr 2008
    Gender
    male
    Posts
    5
    Reputation
    10
    Thanks
    1
    Can somebody please show how to compile this hack or compile it and post it?

  9. #7
    IGotBanned.'s Avatar
    Join Date
    Jun 2011
    Gender
    male
    Location
    imageshack.us/photo/my-images/190/uban.png
    Posts
    1,290
    Reputation
    -49
    Thanks
    122
    My Mood
    Aggressive
    don't bump old thread brah...