Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Call of Duty Hacks & Cheats › Call of Duty 4 - Modern Warfare (MW) Hacks › CoD4 Simple ESP Code

CoD4 Simple ESP Code

Posts 1–4 of 4 · Page 1 of 1
JoEyHaX
JoEyHaX
CoD4 Simple ESP Code
Here is a simple cod4 esp code!

Code:
void DoESP( void )
{__try{
    
    CEntity * pEntity = 0;
    CClientInfo * pClientInfo = 0;

    for ( int i = 0; i < 64; i++ )
    {
            D3DXVECTOR3 v3DrawPos, v3DrawScr,v3DrawScr2, v3DrawPos2;

            CEntity * pEntity = GetEntityIndex( i );
            CClientInfo * pClientInfo = GetClientIndex( i );

            if (v3DrawScr.z  >= 1 && v3DrawScr2.z  >= 1 )
                    continue;

            if ( !IsValidEntity ( pEntity, pClientInfo ) || pEntity->iEntityType != ENTTYPE_HUMAN )
                continue;

            if(i == gCG->iLocalClient)
                continue;

            if(cvar.mespfont == 1)
                espfont = FONTS_SMALLDEV;
            else if(cvar.mespfont == 2)
                espfont = FONTS_NORMAL;
            else if(cvar.mespfont == 3)
                espfont = FONTS_BOLD;
            else if(cvar.mespfont == 4)
                espfont = FONTS_CONSOLE;
            else if(cvar.mespfont == 5)
                espfont = FONTS_OBJECTIVE;
            else if(cvar.mespfont == 6)
                espfont = FONTS_SMALL;
            else if(cvar.mespfont == 7)
                espfont = FONTS_BIG;

            unsigned short HeadTag = RegisterTag_( "j_head", 1, strlen("j_head") + 1 );

            Vector3 Head, Leg, vDir;

            GET_BONE_POS(pEntity, Head, HeadTag );
            v3DrawPos = Head;
            v3DrawPos2 = *(D3DXVECTOR3*)GET_BONE_ORIGIN(pEntity, Leg);

            bool enemy = IsEnemyEntity(pClientInfo);

            vDir[0] = camera->Location[0] - Head[0];
            vDir[1] = camera->Location[1] - Head[1];
            vDir[2] = camera->Location[2] - Head[2];

            float fDistance = cVec._VectorLength(vDir) / 48.f;
            //float fDistance = CMath.GetDistance( camera->Location, pEntity->Location ) / 48.f;

            
/*
^0 = Black
^1 = Red
^2 = Green
^3 = Yellow
^4 = Blue
^5 = Cyan
^6 = Purple
^7 = White or Pink
^8 = Gray^6[ ^7%s ^6]
*/
            bool isvis = Trace_Target( Head );

            if ( World2Screen( &v3DrawPos, &v3DrawScr ) && World2Screen( &v3DrawPos2, &v3DrawScr2 ) )
            {
                char name[24];
                sprintf(name, "^7[^7%s^7]", pClientInfo->szPlayerName);

                char friendlyname[24];
                sprintf(friendlyname, "^5[^7%s^5]", pClientInfo->szPlayerName);

                char distance[24];
                sprintf(distance, "^7[^7%.0f^7]", fDistance);

                if(cvar.visibleesp)
                    isvis = !isvis;

                if (!memcmp(server->GameType,"dm",2))
                    pClientInfo->iTeamID == gLocalInfo->iTeamID;

                float BoxLength = ((v3DrawScr2.y+10) - v3DrawScr.y);
                float BoxWidth  = (BoxLength/2.0);
                float BoxFlow   = (v3DrawScr.x - (BoxWidth/2));

                if(cvar.weaponesp)
                {
                        CWeapon * pWeapon = GetWeaponByIndex( pClientInfo->iWeaponID );
                        char* Shader = weapons[i];
                        char* temp = pWeapon->Name;
                        temp = Shader;
                        if(strstr(temp, "hud_icon_40mm_grenade"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_ak47"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_ak47_gp25"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_ak74u"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_at4"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_barrett50cal"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_benelli_m4"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_c4"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_claymore"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_colt_45"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_desert_eagle"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_dragunov"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_g3"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_g36c"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_g36c_mp"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_javelin"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m14"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m14_scoped"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m16a4"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m16a4_grenade"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m249saw"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m4_grenadier"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m4_grunt"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m4_silencer"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m40a3"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m4carbine"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m4m203_silencer"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m60e4"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_m9beretta"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_mini_uzi"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_mp44"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_mp5"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_mp5_silencer"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_p90"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_pistol"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_remington700"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_rpd"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_rpg"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_skorpian"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_sniperrifle"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_stinger"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_usp_45"))
                            Shader = temp; 
                        if(strstr(temp, "hud_icon_winchester_1200"))
                            Shader = temp; 
                        if(strstr(temp, "hud_us_grenade"))
                            Shader = temp; 
                        if(strstr(temp, "hud_us_stungrenade"))
                            Shader = temp;

                    if ( enemy )
                    {
                        Engine_DrawStretchPic( v3DrawScr.x  + 15 / fDistance,v3DrawScr.y + 20 / fDistance,35,15,0,0,1,1,&Green,RegisterShader(Shader,7));
                    }
                    else
                    {

                    }
                }
                if ( cvar.nameesp )
                {
                    if ( enemy )
                    {
                        DrawString( BoxFlow - ( strlen ( name ) / 2 * 6 ) + 25, v3DrawScr.y - 15, espfont, 1, isvis ? &Yellow : &Red , name );//^5[ ^7%s ^5]
                    }
                    else
                    {
                        if(cvar.drawfriendly)
                        {
                            DrawString(  BoxFlow - ( strlen ( friendlyname ) / 2 * 6 ) + 25,v3DrawScr.y - 5, espfont, 1, &Cyan, friendlyname );
                        }
                    }
                }
                if ( cvar.distanceesp )
                {
                    if ( enemy )
                    {
                        DrawString( BoxFlow - ( strlen ( distance ) / 2 * 6 ) + 25,  v3DrawScr.y - 5,espfont, 1,isvis ? &Yellow : &Red, distance );//[%.1f]
                    }
                    else
                    {

                    }
                }
                if ( cvar.boundingboxes )
                {
                    if ( enemy )
                    {
                        DrawBox( BoxFlow, v3DrawScr.y - ( BoxLength / 6 ), BoxWidth, BoxLength, 1.5f, isvis ? &Yellow : &Red );
                    }
                    else
                    { 
                        if(cvar.drawfriendly)
                        {
                            DrawBox( BoxFlow, v3DrawScr.y - ( BoxLength / 6 ), BoxWidth, BoxLength, 1.5f, &Cyan );
                        }
                    } 
                }
            }
        }
}__except(EXCEPTION_EXECUTE_HANDLER){
    return;
}}
T H A N K M E !
#1 · 14y ago
yge3d
yge3d
Is it UD? Please Answer
#2 · 14y ago
SE
selim321
What do we do this code???????
#3 · 14y ago
HA
hawk1234
What i am suppose to do with it???
What is this!!! What i am suppose to do with it???
#4 · 14y ago
Posts 1–4 of 4 · Page 1 of 1

Post a Reply

Similar Threads

  • simple esp undetectedBy Tautas in Call of Duty 4 - Modern Warfare (MW) Hacks
    2Last post 16y ago
  • Want to sell COD4 original Key codesBy anxigaffit in Call of Duty 4 - Modern Warfare (MW) Hacks
    4Last post 16y ago
  • CoD4 Undetected ESP + LVL 55 HackBy marko4452 in Call of Duty 4 - Modern Warfare (MW) Hacks
    31Last post 16y ago
  • [Request] Simple download codeBy snotpig in Visual Basic Programming
    9Last post 16y ago
  • Super Simple ESP?By Daygum in Call of Duty Modern Warfare 2 Help
    7Last post 16y ago

Tags for this Thread

None