Yesterday evening I had half an hour time and did it (i used a fixed character array as a global variable which is shown permanently and I always fill that with the latest bone the playerPed hit).
I will share the code of my solution on the weekend when I have more time.
Edit:
so heres the code (you can use it just like that if your project has all of alexander blades SDK stuff included):
void DrawText(float x, float y, char* str)
{
UI::DRAW_TEXT(GAMEPLAY::CREATE_STRING(10, "LITERAL_STRING", str), x, y);
}
void main()
{
bool modScriptState{ false };
constexpr int toggleKey{ VK_F8 };
int msgTime{ 0 };
char c[40];
int act = 99999;
std::string text = "Last Damaged Bone = ";
while (true)
{
if (IsKeyJustUp(toggleKey))
{
modScriptState = !modScriptState;
msgTime = GetTickCount() + 3000;
}
if (modScriptState)
{
Player player = PLAYER::PLAYER_ID();
Ped playerPed = PLAYER::PLAYER_PED_ID();
if (WEAPON::IS_PED_WEAPON_READY_TO_SHOOT(playerPed))
{
strcpy(c, text.c_str());
DrawText(0.4, 0.4, c);
}
else
{
if (PED::IS_PED_SHOOTING(playerPed))
{
Entity playerTarget;
if (PLAYER::GET_ENTITY_PLAYER_IS_FREE_AIMING_AT(player, &playerTarget))
{
int actBone;
if (PED::GET_PED_LAST_DAMAGE_BONE(playerTarget, &actBone))
{
act = actBone;
text = "Last Damaged Bone = " + std::to_string(act);
strcpy(c, text.c_str());
DrawText(0.4, 0.4, c);
}
}
}
}
}
WAIT(0);
}
}
void ScriptMain()
{
srand(GetTickCount());
main();
}