_=Gigant=_
Well-known member
- Joined
- Mar 21, 2017
- Messages
- 353
- Reaction score
- 16
Code:
float GetDistance(D3DXVECTOR3 target)
{
actor_info * playerR = actor_info_get(ACTOR_SELF, NULL);
CPed *pPedSelf = pGameInterface->GetPools()->GetPed((DWORD*)playerR);
D3DXVECTOR3 player(pPedSelf->GetPosition()->fX, pPedSelf->GetPosition()->fY, pPedSelf->GetPosition()->fZ);
return sqrt((player.x - target.x) * (player.x - target.x) + (player.y - target.y) * (player.y - target.y) + (player.z - target.z) * (player.z - target.z));
}
void renderPlayersInfo()
{
traceLastFunc("renderPlayersInfo()");
if (gta_menu_active())
return;
if (cheat_state->_generic.cheat_panic_enabled)
return;
// Exit this function and enable samp nametags, if panic key
if (!g_dwSAMP_Addr || !g_SAMP || !g_Players)
return;
// don't run if the CGameSA doesn't exist
if (!pGameInterface)
return;
// don't run if we don't exist
if (isBadPtr_GTA_pPed(pPedSelf))
return;
if (g_Scoreboard->iIsEnabled)
return;
updateScoreboardData();
for (int i = 0; i < SAMP_MAX_PLAYERS; i++)
{
actor_info *actor = getGTAPedFromSAMPPlayerID(i);
struct actor_info *self = actor_info_get(ACTOR_SELF, 0);
if (self == NULL)
return;
if (!actor)
continue;
D3DXVECTOR3 player_pos, screenposs , my_pos, my_screen_pos;
float * f_pos = &actor->base.matrix[4 * 3];
player_pos.x = f_pos[0];
player_pos.y = f_pos[1];
player_pos.z = f_pos[2];
CalcScreenCoors(&player_pos, &screenposs);
float * f_posme = &self->base.matrix[4 * 3];
my_pos.x = f_posme[0];
my_pos.y = f_posme[1];
my_pos.z = f_posme[2];
CalcScreenCoors(&my_pos, &my_screen_pos);
char pos[256], ping[256], hparmw[256], pnameid[256];
const char * playerName = getPlayerName(i);
if (g_Players->iIsListed[i] != 1)
continue;
stRemotePlayer *pPlayer = g_SAMP->pPools->pPlayer->pRemotePlayer[i];
if (screenposs.z < 1.f)
continue;
if (cheat_state->3DInformer) // bool
{
_snprintf_s(pnameid, sizeof(pnameid) - 1, "{C235DD}Player{FFFFFF} %s <%d>{00FF00} Distance{FFFFFF} %.0f m", playerName, i, GetDistance(D3DXVECTOR3(player_pos.x, player_pos.y, player_pos.z)));
pD3DFont_sampStuff->PrintShadow(screenposs.x, screenposs.y - 38, COLOR_WHITE(255), pnameid);
for (int wep = 0; weapon_list[wep].name != nullptr; wep++)
{
const struct weapon_entry *weapon = &weapon_list[wep];
if (weapon->id == pPlayer->pPlayerData->onFootData.byteCurrentWeapon)
{
_snprintf_s(hparmw, sizeof(hparmw) - 1, "{FF0F0F}Health{FFFFFF} %0.0f Armour %0.0f{FFA00F} Weapon{FFFFFF} %s{FFFFFF} %u", g_Players->pRemotePlayer[i]->pPlayerData->fActorHealth, g_Players->pRemotePlayer[i]->pPlayerData->fActorArmor, weapon->name, g_Players->pRemotePlayer[i]->pPlayerData->onFootData.byteCurrentWeapon);
pD3DFont_sampStuff->PrintShadow(screenposs.x, screenposs.y - 26, COLOR_WHITE(255), hparmw);
}
}
_snprintf_s(ping, sizeof(ping) - 1, "{F0FF0F}Skin{FFFFFF} %d{00FF00} Ping{FFFFFF} %d Score %d", actor->base.model_alt_id, pPlayer->iPing, pPlayer->iScore);
pD3DFont_sampStuff->PrintShadow(screenposs.x, screenposs.y - 14, COLOR_WHITE(255), ping);
_snprintf_s(pos, sizeof(pos) - 1, "Pos X %0.02f Y %0.02f Z %0.02f", player_pos.x, player_pos.y, player_pos.z);
pD3DFont_sampStuff->PrintShadow(screenposs.x, screenposs.y, COLOR_WHITE(255), pos);
}
}
}
put renderPlayersInfo(); under renderSamp(); and #define COLOR_WHITE(a) D3DCOLOR_ARGB(a, 255, 255, 255) in ur .h file (main.h)