AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [TF2] GetHealerByIndex (https://forums.alliedmods.net/showthread.php?t=306854)

Pelipoika 04-16-2018 20:31

[TF2] GetHealerByIndex
 
Tired of looping every single entity to find out just what is healing the player?

Well no more!

PHP Code:

stock int GetHealerByIndex(int clientint 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_SharedNumberType_Int32));
    
    return (
LoadFromAddress(aHealers view_as<Address>(index 0x24), NumberType_Int32) & 0xFFF);


Example usage:
PHP Code:

for (int i 0GetEntProp(clientProp_Send"m_nNumHealers"); i++)
{
    
int iHealerIndex GetHealerByIndex(clienti);
    
    
bool bIsClient = (iHealerIndex <= MaxClients);
    
    if(
bIsClient)
    {
        
PrintToServer("\"%N\" <- healed by player \"%N\" [%i]"clientiHealerIndexiHealerIndex);
    }
    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

ThatKidWhoGames 04-17-2018 17:31

Re: [TF2] GetHealerByIndex
 
Thank you very much for this!!

Dr.Doctor 04-22-2018 13:24

Re: [TF2] GetHealerByIndex
 
This proves Pelipoika is a coding hacker,
Thanks for that.

xXDeathreusXx 04-25-2018 16:16

Re: [TF2] GetHealerByIndex
 
You wizard

ThatKidWhoGames 04-26-2018 07:54

Re: [TF2] GetHealerByIndex
 
Quote:

Originally Posted by xXDeathreusXx (Post 2589399)
You wizard

Completely agree!


All times are GMT -4. The time now is 02:08.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.