if (gta_menu_active())
return;
if (cheat_state->_generic.cheat_panic_enabled)
return;
if (!g_dwSAMP_Addr || !g_SAMP || !g_Players)
return;
if (!pGameInterface)
return;
if (isBadPtr_GTA_pPed(pPedSelf))
return;
actor_info* player = getGTAPedFromSAMPPlayerID(id);
actor_info* me = actor_info_get(ACTOR_SELF, NULL);
if (!player)
return;
CPed* pPed = pGameInterface->GetPools()->GetPed((DWORD*)player);
if (!pPed)
return;
float
max_up_val = 0,
max_down_val = 0,
max_left_val = 0,
max_right_val = 0;
bool invalid = false;
for (int bone_id = BONE_PELVIS1; bone_id <= BONE_RIGHTFOOT; ++bone_id)
{
if (bone_id >= BONE_PELVIS1 && bone_id <= BONE_HEAD ||
bone_id >= BONE_RIGHTUPPERTORSO && bone_id <= BONE_RIGHTTHUMB ||
bone_id >= BONE_LEFTUPPERTORSO && bone_id <= BONE_LEFTTHUMB ||
bone_id >= BONE_LEFTHIP && bone_id <= BONE_LEFTFOOT ||
bone_id >= BONE_RIGHTHIP && bone_id <= BONE_RIGHTFOOT)
{
CVector bone;
pPed->GetBonePosition((eBone)bone_id, &bone);
D3DXVECTOR3 bone_pos;
bone_pos.x = bone.fX;
bone_pos.y = bone.fY;
bone_pos.z = bone.fZ;
D3DXVECTOR3 bone_screen_pos;
CalcScreenCoors(&bone_pos, &bone_screen_pos);
if (bone_screen_pos.z < 1.f)
{
invalid = true;
break;
}
if (!max_up_val && !max_down_val &&
!max_left_val && !max_right_val)
{
max_up_val = bone_screen_pos.y;
max_down_val = bone_screen_pos.y;
max_right_val = bone_screen_pos.x;
max_left_val = bone_screen_pos.x;
}
if (bone_screen_pos.y > max_up_val)
max_up_val = bone_screen_pos.y;
if (bone_screen_pos.y < max_down_val)
max_down_val = bone_screen_pos.y;
if (bone_screen_pos.x > max_right_val)
max_right_val = bone_screen_pos.x;
if (bone_screen_pos.x < max_left_val)
max_left_val = bone_screen_pos.x;
}
}
if (!invalid)
{
float height_box = max_up_val - max_down_val;
float widht_box = max_right_val - max_left_val;
if (render)
{
render->D3DBoxBorder(max_left_val, max_down_val, widht_box, height_box, D3DCOLOR_RGBA(0, 255, 0, 255), 0);
}
}