// start render ESP tags
float w, h, playerBaseY;
while ( iter.pos < iter.end )
{
// map iterator pointer to our pointer
iterPed = iter.pos->second;
// advance to next item for next pass
iter.pos++;
if ( !iterPed )
continue;
// get player id
iGTAID = (int)iterPed->GetArrayID();
// ignore if isPastMaxDistance or if it's us
if ( g_playerTagInfo[iGTAID].isPastMaxDistance || iGTAID == selfGTAID )
continue;
playerBaseY = g_playerTagInfo[iGTAID].tagPosition.fY -
g_playerTagInfo[iGTAID].tagOffsetY +
ESP_tag_player_pixelOffsetY;
int iSAMPID;
if ( g_Players )
iSAMPID = translateGTASAMP_pedPool.iSAMPID[getPedGTAIDFromInterface( (DWORD *)iterPed->GetPedInterface() )];
// get Ped health
// works in single player, but SAMP maintains its own player health
//vh = iterPed->GetHealth();
// get samp health
if ( g_Players )
{
if ( g_Players->pRemotePlayer[iSAMPID] != NULL
&& g_Players->pRemotePlayer[iSAMPID]->pPlayerData != NULL
&& g_Players->pRemotePlayer[iSAMPID]->pPlayerData->pSAMP_Actor != NULL
&& (DWORD)g_Players->pRemotePlayer[iSAMPID]->pPlayerData->pSAMP_Actor->pGTA_Ped == (DWORD)iterPed->GetPedInterface() )
{
vh = g_Players->pRemotePlayer[iSAMPID]->pPlayerData->fActorHealth;
va = g_Players->pRemotePlayer[iSAMPID]->pPlayerData->fActorArmor;
}
else
{
// SA-MP running, but was not a remote player
continue;
}
}
else
{
// SA-MP not running or failed to initialize g_Players
vh = iterPed->GetHealth();
va = iterPed->GetArmor();
}
D3DCOLOR color = D3DCOLOR_ARGB( 75, 0, 200, 0 );
if ( vh > 100.0f )
vh = 100.0f;
if ( vh < 100.0f && vh > 60.0f )
color = D3DCOLOR_ARGB( 111, 0, 200, 0 );
if ( vh < 60.0f && vh > 20.0f )
color = D3DCOLOR_ARGB( 111, 200, 200, 0 );
if ( vh < 20.0f && vh > 0.0f )
color = D3DCOLOR_ARGB( 111, 200, 0, 0 );
render->D3DBox( g_playerTagInfo[iGTAID].tagPosition.fX + ESP_tag_player_D3DBox_pixelOffsetX,
playerBaseY + ESP_tag_player_D3DBox_pixelOffsetY, 100.0f, 10.0f, D3DCOLOR_ARGB(111, 0, 0, 0) );
render->D3DBox( g_playerTagInfo[iGTAID].tagPosition.fX + 1.0f + ESP_tag_player_D3DBox_pixelOffsetX,
playerBaseY + 1.0f + ESP_tag_player_D3DBox_pixelOffsetY, vh - 2.0f, 8.0f, color );
if ( va > 0.0f )
{
if ( va > 100.0f )
va = 100.0f;
va /= 1.0f;
render->D3DBox( g_playerTagInfo[iGTAID].tagPosition.fX + ESP_tag_player_D3DBox_pixelOffsetX,
playerBaseY + ESP_tag_player_D3DBox_pixelOffsetY, va - 1.0f, 10.0f, D3DCOLOR_ARGB(111, 0, 0, 0) );
render->D3DBox( g_playerTagInfo[iGTAID].tagPosition.fX + 1.0f + ESP_tag_player_D3DBox_pixelOffsetX,
playerBaseY + 1.0f + ESP_tag_player_D3DBox_pixelOffsetY, va - 2.0f, 8.0f,
D3DCOLOR_ARGB(111, 220, 220, 220) );
}
// this should also calculate the anti-aliasing top edge somehow
h = pD3DFontFixedSmall->DrawHeight() + 1;
// already check if player is ok before
// so now we only need to check if samp is running
if ( !g_Players )
{
_snprintf_s( buf, sizeof(buf)-1, "H: %d, A: %d", (int)iterPed->GetHealth(), (int)iterPed->GetArmor() );
pD3DFontFixedSmall->PrintShadow( g_playerTagInfo[iGTAID].tagPosition.fX + 8.0f, playerBaseY - h + 10.0f,
D3DCOLOR_ARGB(130, 0xFF, 0x6A, 0), buf );
}
else
{
_snprintf_s( buf, sizeof(buf)-1, "H: %d, A: %d",
(int)g_Players->pRemotePlayer[iSAMPID]->pPlayerData->fActorHealth,
(int)g_Players->pRemotePlayer[iSAMPID]->pPlayerData->fActorArmor );
pD3DFontFixedSmall->PrintShadow( g_playerTagInfo[iGTAID].tagPosition.fX + 8.0f, playerBaseY - h + 10.0f,
D3DCOLOR_ARGB(130, 0xFF, 0x6A, 0), buf );
// render the main nametag last so it's on top
// this should calculate the anti-aliasing top edge somehow
h = pD3DFont_sampStuff->DrawHeight() - 1;
_snprintf_s( buf, sizeof(buf)-1, "%s (%d)", getPlayerName(iSAMPID), iSAMPID );
w = pD3DFont_sampStuff->DrawLength( buf );
pD3DFont_sampStuff->PrintShadow( g_playerTagInfo[iGTAID].tagPosition.fX, playerBaseY - h,
samp_color_get( iSAMPID, 0xDD000000 ), buf );
}
}
// end render ESP tags