Is there any simple solution, how to get Attacker from TakeDamage or TraceAttack hook? I cant figure out what exactly SerialNumber and EntryIndex are. This method not work for me:
Code:
int ZombiePlugin::OnTakeDamage( const CTakeDamageInfo &info )
{
CBasePlayer *pVictim = META_IFACEPTR( CBasePlayer );
edict_t *pEdict = m_GameEnts->BaseEntityToEdict( pVictim );
if ( pVictim && pEdict && !pEdict->IsFree() )
{
int nIndex = m_Engine->IndexOfEdict( pEdict );
int AIndex = info.m_hAttacker.GetEntryIndex();
if ( AIndex > 0 && AIndex <= MAX_CLIENTS )
{
pAEdict = m_Engine->PEntityOfEntIndex( AIndex );
}
}
}
All the time I'm getting huge serial numbers. I also tryed to parse through all players and get theit serialnumbers/indexes, but none of them were equal to what I got. Also I tryed to get pointer from memory to g_pEntityList, but still nothing. I suppose info.m_hAttacker.GetEntryIndex(); return wrong number and whole EHANDLE shold be rewritten?
The game is CS:S