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 !