C# External Call of Duty 4 Modern Warfare ESP AIMBOT Source Code



Hey guys this is Fleep from GuidedHacking with a COD4 ESP and aimbot source code free download for Call of Duty 4 Modern Warfare. I will be doing an exact version of this with a C++ Hook which will have a couple more features. The method used here is a very good one and does not require any hooks, because of this it is very evasive and won’t be detected on quite a few games obviously you need to try it yourself to confirm this because every game is different.

DOWNLOAD FREE CALL OF DUTY 4…

22 thoughts on “C# External Call of Duty 4 Modern Warfare ESP AIMBOT Source Code

  1. Could not load file or assembly 'Microsoft.DirectX.Direct3D.dll' or one of its dependencies. is not a valid Win32 application.
    (Exception from HRESULT: 0x800700C1)

    need HELP Pliz.

  2. Could not load file or assembly 'Microsoft.DirectX.Direct3D.dll' or one of its dependencies. is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) HELP

  3. #include <Windows.h>
    #include <iostream>
    #include <math.h>

    typedef struct
    {
    int Valid;                                       //0x0 (0xAD28F8)
    char _0x0004[0x8];                               //0x4
    char Name[16];                                   //0xC (0xAD2904)
    int Team;                                        //0x1C (0xAD2914)
    char _0x0020[0x4];                               //0x20
    int Rank;                                        //0x24 (0xAD291C)
    char _0x0028[0x10];                              //0x28
    int Perk;                                        //0x38 (0xAD2930)
    char _0x003C[0x8];                               //0x3C
    int Score;                                       //0x44 (0xAD293C)
    char _0x0048[0x458];                             //0x48
    int Attacking;                                   //0x4A0 (0xAD2D98)
    char _0x04A4[0x4];                               //0x4A4
    int Zooming;                                     //0x4A8 (0xAD2DA0)
    char _0x04AC[0xB8];                              //0x4AC
    }ClientInfo_T; //[Addr: 0xAD28F8] [Size: 0x564]

    typedef struct
    {
    char _0x0000[0x8];                               //0x0
    int Width;                                       //0x8 (0xA40438)
    int Height;                                      //0xC (0xA4043C)
    int FovX;                                        //0x10 (0xA40440)
    int FovY;                                        //0x14 (0xA40444)
    float Origin[3];                                  //0x18 (0xA40448)
    float ViewAngles[3][3];                              //0x24 (0xA40454)
    char _0x0048[0x24];                              //0x48
    float ZoomProgress;                              //0x6C (0xA4049C)
    char _0x0070[0x4ABC];                            //0x70
    float RefViewAngleY;                             //0x4B2C (0xA44F5C)
    float RefViewAngleX;                             //0x4B30 (0xA44F60)
    char _0x4B34[0x34];                              //0x4B34
    float WeaponViewAngleX;                          //0x4B68 (0xA44F98)
    float WeaponViewAngleY;                          //0x4B6C (0xA44F9C)
    }RefDef; //[Addr: 0xA40430] [Size: 0x4B70]

    typedef struct
    {
    float Recoil[3];                                   //0x0 (0x1139E48)
    float Origin[3];                                   //0xC (0x1139E54)
    char _0x0018[0x80];                              //0x18
    float ViewAngleY;                                //0x98 (0x1139EE0)
    float ViewAngleX;                                //0x9C (0x1139EE4)
    }viewmatrix_t; //[Addr: 0x1139E48] [Size: 0xA0]

    typedef struct
    {
    char _0x0000[0x2];                               //0x0
    short Valid;                                     //0x2 (0xADE82A)
    char _0x0004[0x10];                              //0x4
    float Origin[3];                                   //0x14 (0xADE83C)
    float Angles[3];                                   //0x20 (0xADE848)
    char _0x002C[0x3C];                              //0x2C
    int Flags;                                       //0x68 (0xADE890)
    char _0x006C[0xC];                               //0x6C
    float OldOrigin[3];                                //0x78 (0xADE8A0)
    char _0x0084[0x18];                              //0x84
    float OldAngles[3];                                //0x9C (0xADE8C4)
    char _0x00A8[0x28];                              //0xA8
    int ClientNumber;                                   //0xD0 (0xADE8F8)
    short Type;                                      //0xD4 (0xADE8FC)
    char _0x00D6[0x12];                              //0xD6
    float NewOrigin[3];                                //0xE8 (0xADE910)
    char _0x00F4[0x1C];                              //0xF4
    float NewAngles[3];                                //0x110 (0xADE938)
    char _0x011C[0x7C];                              //0x11C
    byte WeaponID;                                   //0x198 (0xADE9C0)
    char _0x0199[0x37];                              //0x199
    int IsAlive;                                     //0x1D0 (0xADE9F8)
    char _0x01D4[0x24];                              //0x1D4
    }Entity_T; //[Addr: 0xADE828] [Size: 0x1F8]

    typedef struct
    {
    int ServerTime;                                  //0x0 (0x9D5220)
    int PlayerState;                                 //0x4 (0x9D5224)
    int StaminaTimer;                                //0x8 (0x9D5228)
    unsigned short PlayerStance;                     //0xC (0x9D522C)
    char _0x000E[0x2];                               //0xE
    int IsIngame;                                    //0x10 (0x9D5230)
    char _0x0014[0x4];                               //0x14
    int iVelocity;                                   //0x18 (0x9D5238)
    float Origin[3];                                   //0x1C (0x9D523C)
    float Velocity[3];                                 //0x28 (0x9D5248)
    char _0x0034[0x2C];                              //0x34
    float RefViewAngleY;                             //0x60 (0x9D5280)
    float RefViewAngleX;                             //0x64 (0x9D5284)
    char _0x0068[0xE8];                              //0x68
    int ClientNumber;                                   //0x150 (0x9D5370)
    char _0x0154[0x4];                               //0x154
    float ViewAngleY;                                //0x158 (0x9D5378)
    float ViewAngleX;                                //0x15C (0x9D537C)
    char _0x0160[0x3C];                              //0x160
    int Health;                                      //0x19C (0x9D53BC)
    char _0x01A0[0x1C];                              //0x1A0
    int MaxEntities;                                 //0x1BC (0x9D53DC)
    char _0x01C0[0x44];                              //0x1C0
    int AdvancedUAV;                                 //0x204 (0x9D5424)
    }CG_T; //[Addr: 0x9D5220] [Size: 0x205608]

    typedef struct
    {
    char _0x0000[0x8];                               //0x0
    int Width;                                       //0x8 (0x9D0CA8)
    int Height;                                      //0xC (0x9D0CAC)
    char _0x0010[0x14];                              //0x10
    char GameType[4];                                //0x24 (0x9D0CC4)
    char _0x0028[0x1C];                              //0x28
    char HostName[64];                               //0x44 (0x9D0CE4)
    char _0x0084[0xC4];                              //0x84
    int MaxClients;                                  //0x148 (0x9D0DE8)
    char _0x014C[0x4];                               //0x14C
    char MapName[64];                                //0x150 (0x9D0DF0)
    char _0x0190[0x43F0];                            //0x190
    }CGS_T; //[Addr: 0x9D0CA0] [Size: 0x45C0]

    enum entity_type_t
    {
    ET_GENERAL = 0,
    ET_PLAYER           = 1,
    ET_PLAYER_CORPSE    = 2,
    ET_ITEM             = 3,
    ET_EXPLOSIVE        = 4,
    ET_INVISIBLE        = 5,
    ET_SCRIPTMOVER      = 6,
    ET_SOUND_BLEND      = 7,
    ET_FX               = 8,
    ET_LOOP_FX          = 9,
    ET_PRIMARY_LIGHT    = 10,
    ET_TURRET           = 11,
    ET_HELICOPTER       = 12,
    ET_PLANE            = 13,
    ET_VEHICLE          = 14,
    ET_VEHICLE_COLLMAP  = 15,
    ET_VEHICLE_CORPSE   = 16,
    ET_VEHICLE_SPAWNER  = 17
    };  

    #define FLAGS_CROUCHED 0x0004
    #define FLAGS_PRONE 0x0008
    #define FLAGS_FIRING 0x0200 

    #define REFDEF 0x00A414B0
    #define CG 0x009D62A0
    #define CGS 0x009D1D20
    #define ENTITY 0x00ADF8C0
    #define CLIENTINFO 0x00AD3978
    #define VIEWMATRIX 0x0113AE9C
    #define ISINGAME 0x009D62B0
    #define PLAYERMAX 18
    #define ENTITIESMAX 2048

    #define NORECOIL_ADDRESS 0x572DC9

    #define FONT_SMALL_DEV    "fonts/smallDevFont"
    #define FONT_BIG_DEV    "fonts/bigDevFont"
    #define FONT_CONSOLE    "fonts/consoleFont"
    #define FONT_BIG        "fonts/bigFont"
    #define FONT_SMALL        "fonts/smallFont"
    #define FONT_BOLD        "fonts/boldFont"
    #define FONT_NORMAL        "fonts/normalFont"
    #define FONT_EXTRA_BIG    "fonts/extraBigFont"
    #define FONT_OBJECTIVE    "fonts/objectiveFont" 

    typedef float vec_t;
    typedef vec_t vec4_t[4];

    class CScreenMatrix
    {
    public:
    char _0x0000[64];
    };

    char* Bones[20] = {
    /Head/          "j_helmet"     , "j_head"            , "j_neck" 
    /Arms/        , "j_shoulder_le", "j_shoulder_ri"  , "j_elbow_le"     , "j_elbow_ri", "j_wrist_le", "j_wrist_ri", "j_gun"
    /Back/        , "j_mainroot"   , "j_spineupper"   , "j_spinelower" , "j_spine4" 
    /Legs/        , "j_hip_ri"     , "j_hip_le"       , "j_knee_le"    , "j_knee_ri" , "j_ankle_ri", "j_ankle_le"};

    class w2s_t
    {
    public:
    char unknown[0xDC];
    };

    class trace_t
    {
    public:
        float Fraction;
    char _0x0004[0x60];
    };

    //TYPEDEFS
    typedef void* ( * tRegisterFont )( char* szName );
    typedef int ( * tDrawEngineText )( char* Text, int NumOfChars, void* Font, float X, float Y, float scaleX, float scaleY, float unk1, float* Color, int unk2 );
    typedef void (__cdecl* tUiShowList) (int a1, int a2, int a3, int a4);
    typedef int(*R_RegisterShader)(char *ShaderName);
    typedef CScreenMatrix* ( __cdecl* tGetScreenMatrix )();
    typedef int ( __cdecl* tDrawRotatedPic )( CScreenMatrix* ptr, float x, float y, float w, float h, float angle, float* color, int shader);
    typedef void ( __cdecl *CG_Trace_t)( trace_t *tr,float start[3],float NullVec[3],float endpos[3],int Skip, int mask);
    typedef int(*R_RegisterTag)(char *szName);
    typedef bool (World2Screen_)(int unknown, w2s_t w2scalc, float vPoint[3], float Screen[2]);
    typedef w2s_t *(*Getw2s_t)();
    typedef int(*CG_StrWidth)(char *szText,int a2,void *lpFont,int a4);

    vec4_t WHITE = {1.0f, 1.0f, 1.0f, 1.0f};
    vec4_t BLACK = {0   , 0   , 0   , 1.0f};
    vec4_t RED   = {1.0f, 0   , 0   , 1.0f};
    vec4_t GREEN = {0   , 1.0f, 0   , 1.0f};
    vec4_t BLUE  = {0   , 0   , 1.0f, 1.0f};
    int shader;

    tRegisterFont RegisterFont_ = ( tRegisterFont )0x53C340;
    tDrawEngineText DrawEngineText_ = ( tDrawEngineText )0x4635C0;
    R_RegisterShader RegisterShader_ = ( R_RegisterShader )0x456100;
    tGetScreenMatrix GetScreenMatrix = ( tGetScreenMatrix )0x5561C0;
    tDrawRotatedPic DrawRotatedPic_ = ( tDrawRotatedPic )0x4E55C0;
    CG_Trace_t CG_Trace=(CG_Trace_t)0x4A82D0;
    R_RegisterTag GetTagByName = (R_RegisterTag)0x00488EF0;
    World2Screen_ w2s = (World2Screen_)0x546D70;
    Getw2s_t GetCalc = (Getw2s_t)0x5561C0;
    CG_StrWidth tStrWidth = (CG_StrWidth)0x4043F0;

    RefDef_T* RefDef;
    CG_T* Cg;
    ClientInfo_T* Clients[PLAYERMAX];
    Entity_T* Entities[ENTITIESMAX];
    CGS_T* Cgs;
    static bool bInitialize;
    int* IsInGame;
    void pFont;
    int MyTeam;

    tUiShowList UiShowList = NULL;

    DWORD OFFuiShowList = 0x65E1D0;
    DWORD OFFDraw2D = 0x471740;
    DWORD OFFSGetTagPos = 0x58B440; 

    bool GetTagPos(Entity_T *pEnt,char *szTag,float flOut[3])
    {
    WORD wTag = GetTagByName(szTag);
    if(!wTag) 
    return false;

    DWORD dwCall=OFFSGetTagPos;
    __asm
    {
    MOV ESI,pEnt;
    MOVZX EDI,wTag;
    PUSH flOut;
    CALL dwCall;
    ADD ESP,0x4
    }
    return true;
    }

    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 MakeJMP( BYTE *pAddress, DWORD dwJumpTo, DWORD dwLen )
    {
        DWORD dwOldProtect, dwBkup, dwRelAddr;
        
        VirtualProtect(pAddress, dwLen, PAGE_EXECUTE_READWRITE, &dwOldProtect);
        dwRelAddr = (DWORD) (dwJumpTo – (DWORD) pAddress) – 5;
        *pAddress = 0xE9;
        
        *((DWORD *)(pAddress + 0x1)) = dwRelAddr;
        for(DWORD x = 0x5; x < dwLen; x++) *(pAddress + x) = 0x90;
        VirtualProtect(pAddress, dwLen, dwOldProtect, &dwBkup);
        
        return;
    }

    void *DetourFunction (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);
    }
    {
    char szBuf[300] = "";
    va_list valist;

    va_start(valist,szString);
    _vsnprintf_s(szBuf,sizeof(szBuf),szString,valist);
    va_end(valist);

    return tStrWidth(szBuf,0,pFont,0);
    }
    void DrawText(bool center, float x, float y, void* pFont, float* color, const char *Text, … )
    {
    char buf[300] = "";
    va_list va_alist;
    va_start( va_alist, Text );
    vsnprintf( buf, sizeof( buf ), Text, va_alist );
    va_end( va_alist );
    if(!center)
    DrawEngineText_( buf, 0x7FFFFFFF, pFont, x, y, 1.0f, 1.0f, 0.0f, color, 0 );
    else
    DrawEngineText_( buf, 0x7FFFFFFF, pFont, x – StrWidth(buf)/2, y, 1.0f, 1.0f, 0.0f, color, 0 );
    }

    int DrawLine1(int x1, int y1, int x2, int y2, float* color, int shader){
    CScreenMatrix* ptr = GetScreenMatrix();

    float x,y,angle,l1,l2,h1;
        h1=y2-y1;
        l1=x2-x1;
        l2=sqrt(l1 * l1 + h1 * h1);
        x=x1+((l1-l2)/2);
        y=y1+(h1/2);
        angle=atan(h1/l1)* (180 / 3.14159265358979323846) ;
        return DrawRotatedPic_(ptr,x,y,l2,1.5,angle,color, shader);
    }

    int DrawLine2(int x1, int y1, int x2, int y2, float* color, int shader){
    CScreenMatrix* ptr = GetScreenMatrix();

    float x,y,angle,l1,l2,h1;
        h1=y2-y1;
        l1=x2-x1;
        l2=sqrt(l1 * l1 + h1 * h1);
        x=x1+((l1-l2)/2);
        y=y1+(h1/2);
        angle=atan(h1/l1)* (180 / 3.14159265358979323846) ;
        return DrawRotatedPic_(ptr,x,y,l2,1,angle,color, shader);
    }

    void MakeESPLine(float center[3], float x1, float y1, float z1, float x2, float y2, float z2, vec4_t color)
    {
    float pointPos1[3] = {center[0] + x1, center[1] + y1, center[2] + z1};
    float pointPos2[3] = {center[0] + x2, center[1] + y2, center[2] + z2};
    float xy1[2], xy2[2];
    w2s_t * calc;
    calc = GetCalc();
    if (w2s(0, calc,pointPos1, xy1) && w2s(0,calc,pointPos2, xy2))
    DrawLine2(xy1[0], xy1[1], xy2[0], xy2[1], color, shader);
    }

    void Make3DBox(float center[3], float w, float h, vec4_t color)
    {
    //bottom
    MakeESPLine(center, -w, -w, 0, w, -w, 0, color);
    MakeESPLine(center, -w, -w, 0, -w, w, 0, color);
    MakeESPLine(center, w, w, 0, w, -w, 0, color);
    MakeESPLine(center, w, w, 0, -w, w, 0, color);

    //middle
    MakeESPLine(center, -w, -w, 0, -w, -w, h, color);
    MakeESPLine(center, -w, w, 0, -w, w, h, color);
    MakeESPLine(center, w, -w, 0, w, -w, h, color);
    MakeESPLine(center, w, w, 0, w, w, h, color);

    //top
    MakeESPLine(center, -w, -w, h, w, -w, h, color);
    MakeESPLine(center, -w, -w, h, -w, w, h, color);
    MakeESPLine(center, w, w, h, w, -w, h, color);
    MakeESPLine(center, w, w, h, -w, w, h, color);
    }

    void ReadGame(){
    IsInGame = (int*)ISINGAME;
    RefDef = (RefDef_T*)REFDEF;
    Cg = (CG_T*)CG;
    Cgs = (CGS_T*)CGS;
    for(int i = 0; i < ENTITIESMAX; i++)
    Entities[i] = (Entity_T*)(ENTITY + ((int)0x1F8 * i));
    for(int i = 0; i < PLAYERMAX; i++)
    Clients[i] = (ClientInfo_T*)(CLIENTINFO + ((int)0x564 * i));

    for(int i = 0; i < PLAYERMAX; i++)
    {
    if (Cg->ClientNumber == Entities[i]->ClientNumber) {
    MyTeam = Clients[i]->Team;
    break;
    }
    }
    }

    #define MenuItems 5
    int MenuSelectedIndex = 0;
    bool Toogles[MenuItems] = { true, true, true, true, true};
    char* Labels[MenuItems] = {"Bones", "Names", "Distance","3D Boxes", "No-Recoil"};
    bool IsMenuOn = true;
    int MenuOffset[2] = {30,125};
    void Toggles(){
    if((GetAsyncKeyState(VK_INSERT) & 0x1))
    IsMenuOn = !IsMenuOn;
    if(IsMenuOn){
    if((GetAsyncKeyState(VK_DOWN) & 0x1) && MenuSelectedIndex < MenuItems-1)
    MenuSelectedIndex++;
    if((GetAsyncKeyState(VK_UP) & 0x1) && MenuSelectedIndex > 0)
    MenuSelectedIndex–;
    if((GetAsyncKeyState(VK_RIGHT) & 0x1) || (GetAsyncKeyState(VK_LEFT) & 0x1))
    Toogles[MenuSelectedIndex] = !Toogles[MenuSelectedIndex];
    }
    }

    float BackColor[4] = {0,0,0,0.6f};
    void DrawMenu(){
    if(IsMenuOn){
    CScreenMatrix* ptr = GetScreenMatrix();
    DrawRotatedPic_(ptr, MenuOffset[0]-25, MenuOffset[1]-30, 165, MenuItems * 20, 0, BackColor, shader);
    DrawText(false,(float)MenuOffset[0] – 20, (float)MenuOffset[1] -15, pFont, RED, "Press INSERT to Close");
    for(int i = 0; i< MenuItems; i++){
    if(i == MenuSelectedIndex){
    DrawText(false,(float)MenuOffset[0], (float)MenuOffset[1] + i*15, pFont, GREEN, "%s", Labels[i]);
    DrawText(false,(float)MenuOffset[0] + 100, (float)MenuOffset[1] + i*15, pFont, GREEN, "%d", Toogles[i]);
    }
    else{
    DrawText(false,(float)MenuOffset[0], (float)MenuOffset[1] + i*15, pFont, WHITE, "%s", Labels[i]);
    DrawText(false,(float)MenuOffset[0] + 100, (float)MenuOffset[1] + i*15, pFont, WHITE, "%d", Toogles[i]);
    }

    }
    }
    }

    bool CanBeKilled(float Point[3])
    {
    trace_t trace;
    float nullvec[3] = {0.f, 0.f, 0.f};
    CG_Trace(&trace,RefDef->Origin, Point, nullvec,Cg->ClientNumber, 0x803003);
    return (trace.Fraction>=1.0f);
    }

    float PegarDistancia( float A[3], float B[3] )
    {
    float dx = A[0] – B[0];
    float dy = A[1] – B[1];
    float dz = A[2] – B[2];

    return (float)sqrt( ( dx * dx ) + ( dy * dy ) + ( dz * dz ) ) * 0.03048f;
    }
    float GetBoxWidth(Entity_T *ent){
    if(ent->Flags & FLAGS_PRONE)
    return 60;
    else return 17;
    }
    float GetBoxHeight(Entity_T *ent){
    if(ent->Flags & FLAGS_PRONE)
    return 17;
    else if(ent->Flags & FLAGS_CROUCHED)
    return 40;
    else return 60;
    }

    float BonePos[20][3];
    float BonePos2[20][3];
    void ESP(){
    float Screen[2];
    float Origin[3];
    char* cor = "^1";
    w2s_t * calc;
    for(int i = 0; i < ENTITIESMAX; i++)
    {
    if (Entities[i]->Type != ET_PLAYER)
    continue;
    if ((i < PLAYERMAX) && (Entities[i]>Type == ET_PLAYER) && Entities[i]>Valid && (Entities[i]>IsAlive & 1) && !(Cg>ClientNumber == Entities[i]->ClientNumber))
    {
    calc = GetCalc();
    cor = "^1";
    for(int j = 0;j < 20;j++){
    GetTagPos(Entities[i], Bones[j], BonePos[j]);
    if (w2s(0, calc, BonePos[j], Screen))
    {
    if(j==0 && CanBeKilled(Entities[i]->Origin)){
    cor = "^3";
    }
    if (((Clients[i]>Team == 1) || (Clients[i]>Team == 2)) && (Clients[i]->Team == MyTeam)){
    if(Toogles[0])DrawText(false,Screen[0], Screen[1],pFont, RED, "^2.");
    if(j == 0){
    if(Toogles[1])
    DrawText(true,Screen[0], Screen[1]10,pFont, WHITE, "^7[^2%s^7]", Clients[i]>Name);
    if(Toogles[2])
    DrawText(true,Screen[0], Screen[1]20,pFont, RED, "^7[^2%.2f^7]", PegarDistancia(RefDef>Origin, Entities[i]->Origin));
    }
    }
    else{
    if(Toogles[0])DrawText(false,Screen[0], Screen[1],pFont, RED, "%s.", cor);
    if(j == 0){
    if(Toogles[1])
    DrawText(true,Screen[0], Screen[1]10,pFont, WHITE, "^7[%s%s^7]",cor, Clients[i]>Name);
    if(Toogles[2])
    DrawText(true,Screen[0], Screen[1]20,pFont, RED, "^7[^2%.2f^7]", PegarDistancia(RefDef>Origin, Entities[i]->Origin));
    if(Toogles[3])
    Make3DBox(BonePos[j], GetBoxWidth(Entities[i]), -GetBoxHeight(Entities[i]), RED);
    }
    }
    }
    }
    }
    }
    }

    void Crosshair(){
    DrawLine1(RefDef->Width/2 – 20, RefDef->Height/2, RefDef->Width/2 – 10, RefDef->Height/2, RED, shader);
    DrawLine1(RefDef->Width/2 + 20, RefDef->Height/2, RefDef->Width/2 + 10, RefDef->Height/2, RED, shader);
    DrawLine1(RefDef->Width/2, RefDef->Height/2 – 20, RefDef->Width/2, RefDef->Height/2 – 10, RED, shader);
    DrawLine1(RefDef->Width/2, RefDef->Height/2 + 20, RefDef->Width/2, RefDef->Height/2 + 10, RED, shader);
    }

    void NoRecoilOn(){
    unsigned long fireRecoil = (unsigned long)NORECOIL_ADDRESS;
    unsigned char patch[5] = {0x90,0x90,0x90,0x90,0x90};
    unsigned long orig1;
    VirtualProtect((void*)fireRecoil, sizeof(patch), PAGE_EXECUTE_READWRITE, &orig1);
    memcpy((void*)fireRecoil, &patch, sizeof(patch));
    VirtualProtect((void*)fireRecoil, sizeof(patch), orig1, &orig1);
    }

    void NoRecoilOff(){
    unsigned long fireRecoil = (unsigned long)NORECOIL_ADDRESS;
    unsigned char patch[5] = {0xE8, 0xE2, 0x61, 0xF2, 0xFF};
    unsigned long orig1;
    VirtualProtect((void*)fireRecoil, sizeof(patch), PAGE_EXECUTE_READWRITE, &orig1);
    memcpy((void*)fireRecoil, &patch, sizeof(patch));
    VirtualProtect((void*)fireRecoil, sizeof(patch), orig1, &orig1);
    }

    void Func()
    {
    if( !bInitialize )
        {
            pFont = RegisterFont_( FONT_SMALL_DEV );
    shader = RegisterShader_("white");
            bInitialize = true;
        }
    ReadGame();
    Toggles();
    DrawMenu();
    if(*IsInGame != 0){
    if(Toogles[0] || Toogles[1] || Toogles[2] || Toogles[3])ESP();
    Crosshair();
    if(Toogles[4])NoRecoilOn();
    else NoRecoilOff();
    }
    }

    void UI_ShowList(int a1, int a2, int a3, int a4)
    {
    __asm PUSHAD;
    Func();
    __asm POPAD;
    UiShowList(a1, a2,a3,a4);
    }

    BOOL WINAPI DllMain( HMODULE hMod, DWORD dwReason, LPVOID lpReserved )
    {
        if( dwReason == DLL_PROCESS_ATTACH )
        {
            UiShowList = (tUiShowList) DetourFunction( (PBYTE)OFFuiShowList, (PBYTE)&UI_ShowList ,5);
        }

        else if( dwReason == DLL_PROCESS_DETACH )
        {
           //Nothing to do here?
        }

        return TRUE;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *