View Single Post
Author Message
xSquared
Junior Member
Join Date: Jan 2019
Old 09-11-2021 , 01:26   SDKHooks_TakeDamage not calling OnTakeDamage
Reply With Quote #1

Hi. I've recently got back into sourcemod plugins relating to TF2, and was wondering how to force TakeDamage to call OnTakeDamage, or call OnTakeDamage. For reference, I am creating custom attributes for the CustomWeapons3 plugin; the attribute I'm working on damages targets around the initial victim, and I would like for it to be able to chain between victims indefinitely.

My current code for the attribute is as follows:
PHP Code:
if (ds_radius[attacker][weapon] != 0)
    {
        for (new 
potvictim 1potvictim <= MaxClientspotvictim++)
        {
            if (!
IsClientInGame(potvictim)) continue;
            if (!
IsPlayerAlive(potvictim)) continue;
            if (
GetClientTeam(potvictim) == GetClientTeam(attacker)) continue;
            
            new 
Float:pos1[3];
            
GetClientAbsOrigin(victimpos1);
            
            new 
Float:pos2[3];
            
GetClientAbsOrigin(potvictimpos2);
            
            if(
GetVectorDistance(pos1pos2) <= ds_radius[attacker][weapon])
            {
                if(
IsValidEntity(inflictor)) SDKHooks_TakeDamage(potvictiminflictorattackerdamage ds_percentspread[attacker][weapon], damagetypeweapondamageForcepos2);
            }
        }
    } 
__________________
xSquared/Silver's Custom Attributes:https://forums.alliedmods.net/showth...02#post2663402
xSquared is offline