Сообщение от
Revalto
Код:
Код:
float GetDistance(D3DXVECTOR3 target)
{
D3DXVECTOR3 player(PEDSELF->GetPosition()->fX, PEDSELF->GetPosition()->fY, PEDSELF->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));
}
Example:
Код:
Код:
sprintf(szMsg, "%.0f m.", GetDistance(D3DXVECTOR3(x, y, z)));
thank you very much !
here is the full code if someone need
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));
}
sprintf(ctarget_ping_score, "{8cff00}Ping{FFFFFF} %d{007bff} Score{FFFFFF} %d ", g_Players>pRemotePlayer[Informer_Target_PlayerID]>iPing, g_Players->pRemotePlayer[Informer_Target_PlayerID]->iScore);
this code you see should display player ping and score, it does sometimes but not always what's wrong with this ? here you can see that player score and ping is 0 and sometimes it displays correct value idk what's wrong
thanks for help !