These are from old mod(s), you should figure out how to use them yourself so it's just a plain dump replace the functions needed and you have nice nametags with weapon icons :0 Ask questions if you have some.
If someone gets them working for themselves then don't be shy post it and brag!
[shcode=cpp]
if (settings.Nametags)
{
SAMPHelper::RequestPingUpdates();
void* pPlayerTags = (void*)(*(DWORD*)(dwSAMPBase + 0x21A0B0));
void(__thiscall *CPlayerTags__Draw)(void *_this, CVector *position, char *text, DWORD color, float dist, BYTE unk, int unk1) =
((void(__thiscall *)(void *_this, CVector *position, char *text, DWORD color, float dist, BYTE renderPause, int unk1))(dwSAMPBase + 0x686C0));
void(__thiscall *CPlayerTags__Begin)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x686A0));
void(__thiscall *CPlayerTags__End)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x686B0));
void(__thiscall *CPlayerTagsBars__Draw)(void *_this, CVector *position, float health, float armor, float dist) =
((void(__thiscall *)(void *_this, CVector *position, float health, float armor, float dist))(dwSAMPBase + 0x689C0));
void(__thiscall *CPlayerTagsBars__Begin)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x68FD0));
void(__thiscall *CPlayerTagsBars__End)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x68670));
CPlayerTags__Begin(pPlayerTags);
for (it = 0; it != n; it++)
{
CPed *ped = pGame->GetPools()->GetPed(it);
if (ped)
{
if (pLocalPed == ped)
continue;
iSAMPID = loader->GetSAMP()->GetPlayerIDFromGtaPed(ped);
DWORD dwColor = D3DCOLOR_XRGB(255, 0, 0);
if (iSAMPID != INVALID_SAMP_ID)
{
dwColor = players[iSAMPID]->GetColor();
}
float dist = ped->GetPosition()->DistanceTo(pLocalPed->GetPosition());
ped->GetBonePosition(BONE_HEAD, &vecTemp1);
vecTemp1.fZ += 0.146000f;
if (iSAMPID != INVALID_SAMP_ID)
{
sprintf_s(szRenderBuffer, 80, "{B9C9BF}%ims\n{%s}%s (%i)", players[iSAMPID]->GetPing(), players[iSAMPID]->GetColorCode(), players[iSAMPID]->GetName(), iSAMPID);
CPlayerTags__Draw(pPlayerTags, &vecTemp1, szRenderBuffer, dwColor, dist, players[iSAMPID]->IsAFK() ? 1 : 0, 2);
}
else
{
sprintf_s(szRenderBuffer, 80, "Actor");
CPlayerTags__Draw(pPlayerTags, &vecTemp1, szRenderBuffer, dwColor, dist, 0, 0);
}
if (iSAMPID != INVALID_SAMP_ID && settings.NametagIcons)
{
// Weapon Icons
void *dwDeathWindow = (void*)(*(DWORD*)(dwSAMPBase + 0x21A0EC));
ID3DXSprite *sprite = (ID3DXSprite*)(*(DWORD*)((DWORD)dwDeathWindow + 0x143));
ID3DXFont *m_pWeaponFont = (ID3DXFont*)(*(DWORD*)((DWORD)dwDeathWindow + 0x13B));
D3DXVECTOR3 TagPos = CVecToD3DXVEC(vecTemp1);
TagPos.z += 0.2f + (dist * 0.047499999f);
D3DVIEWPORT9 Viewport;
device->GetViewport(&Viewport);
/* COULD REPLACE THIS STUFF WITH WORLDTOSCREEN */
D3DXMATRIX proj(*(D3DXMATRIX*)(dwSAMPBase + 0x12C980));
D3DXMATRIX view(*(D3DXMATRIX*)(dwSAMPBase + 0x12C940));
D3DXVECTOR3 out;
D3DXMATRIX ident;
D3DXMatrixIdentity(&ident);
D3DXVec3Project(&out, &TagPos, &Viewport, &proj, &view, &ident);
/* COULD REPLACE THIS STUFF WITH WORLDTOSCREEN END */
if (out.z < 1.0f)
{
sprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE);
RECT rect = { (LONG)out.x + 20, (LONG)out.y + 17, (LONG)out.x + 1, (LONG)out.y + 1 };
m_pWeaponFont->DrawText(sprite, "G", -1, &rect, DT_NOCLIP | DT_LEFT, D3DCOLOR_XRGB(0, 0, 0));
m_pWeaponFont->DrawText(sprite, SpriteIDForWeapon(players[iSAMPID]->GetWeaponID()), -1, &rect, DT_NOCLIP | DT_LEFT, 0xFFFFFFFF);
sprite->End();
}
}
}
}
CPlayerTags__End(pPlayerTags);
// Bars
CPlayerTagsBars__Begin(pPlayerTags);
for (it = 0; it != n; it++)
{
CPed *ped = pGame->GetPools()->GetPed(it);
if (ped)
{
if (pLocalPed == ped)
continue;
iSAMPID = loader->GetSAMP()->GetPlayerIDFromGtaPed(ped);
static float fHealth = 100.0f;
static float fArmor = 0.0f;
if (iSAMPID != INVALID_SAMP_ID)
{
fHealth = players[iSAMPID]->GetHealth();
fArmor = players[iSAMPID]->GetArmor();
}
else
{
fHealth = ped->GetHealth();
fArmor = ped->GetArmor();
}
ped->GetBonePosition(BONE_HEAD, &vecTemp1);
vecTemp1.fZ += 0.146000f;
CPlayerTagsBars__Draw(pPlayerTags, &vecTemp1, fHealth, fArmor, ped->GetPosition()->DistanceTo(pLocalPed->GetPosition()));
}
}
CPlayerTagsBars__End(pPlayerTags);
}
[/shcode]
If someone gets them working for themselves then don't be shy post it and brag!
[shcode=cpp]
if (settings.Nametags)
{
SAMPHelper::RequestPingUpdates();
void* pPlayerTags = (void*)(*(DWORD*)(dwSAMPBase + 0x21A0B0));
void(__thiscall *CPlayerTags__Draw)(void *_this, CVector *position, char *text, DWORD color, float dist, BYTE unk, int unk1) =
((void(__thiscall *)(void *_this, CVector *position, char *text, DWORD color, float dist, BYTE renderPause, int unk1))(dwSAMPBase + 0x686C0));
void(__thiscall *CPlayerTags__Begin)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x686A0));
void(__thiscall *CPlayerTags__End)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x686B0));
void(__thiscall *CPlayerTagsBars__Draw)(void *_this, CVector *position, float health, float armor, float dist) =
((void(__thiscall *)(void *_this, CVector *position, float health, float armor, float dist))(dwSAMPBase + 0x689C0));
void(__thiscall *CPlayerTagsBars__Begin)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x68FD0));
void(__thiscall *CPlayerTagsBars__End)(void *_this) = ((void(__thiscall *)(void *_this))(dwSAMPBase + 0x68670));
CPlayerTags__Begin(pPlayerTags);
for (it = 0; it != n; it++)
{
CPed *ped = pGame->GetPools()->GetPed(it);
if (ped)
{
if (pLocalPed == ped)
continue;
iSAMPID = loader->GetSAMP()->GetPlayerIDFromGtaPed(ped);
DWORD dwColor = D3DCOLOR_XRGB(255, 0, 0);
if (iSAMPID != INVALID_SAMP_ID)
{
dwColor = players[iSAMPID]->GetColor();
}
float dist = ped->GetPosition()->DistanceTo(pLocalPed->GetPosition());
ped->GetBonePosition(BONE_HEAD, &vecTemp1);
vecTemp1.fZ += 0.146000f;
if (iSAMPID != INVALID_SAMP_ID)
{
sprintf_s(szRenderBuffer, 80, "{B9C9BF}%ims\n{%s}%s (%i)", players[iSAMPID]->GetPing(), players[iSAMPID]->GetColorCode(), players[iSAMPID]->GetName(), iSAMPID);
CPlayerTags__Draw(pPlayerTags, &vecTemp1, szRenderBuffer, dwColor, dist, players[iSAMPID]->IsAFK() ? 1 : 0, 2);
}
else
{
sprintf_s(szRenderBuffer, 80, "Actor");
CPlayerTags__Draw(pPlayerTags, &vecTemp1, szRenderBuffer, dwColor, dist, 0, 0);
}
if (iSAMPID != INVALID_SAMP_ID && settings.NametagIcons)
{
// Weapon Icons
void *dwDeathWindow = (void*)(*(DWORD*)(dwSAMPBase + 0x21A0EC));
ID3DXSprite *sprite = (ID3DXSprite*)(*(DWORD*)((DWORD)dwDeathWindow + 0x143));
ID3DXFont *m_pWeaponFont = (ID3DXFont*)(*(DWORD*)((DWORD)dwDeathWindow + 0x13B));
D3DXVECTOR3 TagPos = CVecToD3DXVEC(vecTemp1);
TagPos.z += 0.2f + (dist * 0.047499999f);
D3DVIEWPORT9 Viewport;
device->GetViewport(&Viewport);
/* COULD REPLACE THIS STUFF WITH WORLDTOSCREEN */
D3DXMATRIX proj(*(D3DXMATRIX*)(dwSAMPBase + 0x12C980));
D3DXMATRIX view(*(D3DXMATRIX*)(dwSAMPBase + 0x12C940));
D3DXVECTOR3 out;
D3DXMATRIX ident;
D3DXMatrixIdentity(&ident);
D3DXVec3Project(&out, &TagPos, &Viewport, &proj, &view, &ident);
/* COULD REPLACE THIS STUFF WITH WORLDTOSCREEN END */
if (out.z < 1.0f)
{
sprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE);
RECT rect = { (LONG)out.x + 20, (LONG)out.y + 17, (LONG)out.x + 1, (LONG)out.y + 1 };
m_pWeaponFont->DrawText(sprite, "G", -1, &rect, DT_NOCLIP | DT_LEFT, D3DCOLOR_XRGB(0, 0, 0));
m_pWeaponFont->DrawText(sprite, SpriteIDForWeapon(players[iSAMPID]->GetWeaponID()), -1, &rect, DT_NOCLIP | DT_LEFT, 0xFFFFFFFF);
sprite->End();
}
}
}
}
CPlayerTags__End(pPlayerTags);
// Bars
CPlayerTagsBars__Begin(pPlayerTags);
for (it = 0; it != n; it++)
{
CPed *ped = pGame->GetPools()->GetPed(it);
if (ped)
{
if (pLocalPed == ped)
continue;
iSAMPID = loader->GetSAMP()->GetPlayerIDFromGtaPed(ped);
static float fHealth = 100.0f;
static float fArmor = 0.0f;
if (iSAMPID != INVALID_SAMP_ID)
{
fHealth = players[iSAMPID]->GetHealth();
fArmor = players[iSAMPID]->GetArmor();
}
else
{
fHealth = ped->GetHealth();
fArmor = ped->GetArmor();
}
ped->GetBonePosition(BONE_HEAD, &vecTemp1);
vecTemp1.fZ += 0.146000f;
CPlayerTagsBars__Draw(pPlayerTags, &vecTemp1, fHealth, fArmor, ped->GetPosition()->DistanceTo(pLocalPed->GetPosition()));
}
}
CPlayerTagsBars__End(pPlayerTags);
}
[/shcode]