Tired of looping every single entity to find out just what is healing the player?
Well no more!
PHP Code:
stock int GetHealerByIndex(int client, int index)
{
int m_aHealers = FindSendPropInfo("CTFPlayer", "m_nNumHealers") + 12;
Address m_Shared = GetEntityAddress(client) + view_as<Address>(m_aHealers);
Address aHealers = view_as<Address>(LoadFromAddress(m_Shared, NumberType_Int32));
return (LoadFromAddress(aHealers + view_as<Address>(index * 0x24), NumberType_Int32) & 0xFFF);
}
Example usage:
PHP Code:
for (int i = 0; i < GetEntProp(client, Prop_Send, "m_nNumHealers"); i++)
{
int iHealerIndex = GetHealerByIndex(client, i);
bool bIsClient = (iHealerIndex <= MaxClients);
if(bIsClient)
{
PrintToServer("\"%N\" <- healed by player \"%N\" [%i]", client, iHealerIndex, iHealerIndex);
}
else
{
char class[64];
GetEntityClassname(iHealerIndex, class, sizeof(class));
PrintToServer("\"%N\" <- healed by entity \"%s\" [%i]", client, class, iHealerIndex);
}
}
Output:
Code:
"Pelipoika" <- healed by entity "obj_dispenser" [56]
"Pelipoika" <- healed by player "Chell" [2]
"Pelipoika" <- healed by player "Totally Not A Bot" [4]
https://github.com/Pelipoika/The-unf...alerByIndex.sp
__________________