AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SDKHooks_TakeDamage not calling OnTakeDamage (https://forums.alliedmods.net/showthread.php?t=334265)

xSquared 09-11-2021 01:26

SDKHooks_TakeDamage not calling OnTakeDamage
 
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);
            }
        }
    } 


Marttt 09-12-2021 07:35

Re: SDKHooks_TakeDamage not calling OnTakeDamage
 
I remember asking this on SM Discord once and someone said that SDKHooks_TakeDamage don't call SDKHook_OnTakeDamage by design.

I have the same issue with SDKHooks_DropWeapon doesn't trigger SDKHook_WeaponDrop/Post.

Is not kinda a bug.

You can ask on Discord or open an Issue on sourcemod github repo, although you will get a similar reply.

Here is the discord link message in case you wanna check.

Bacardi 09-12-2021 07:40

Re: SDKHooks_TakeDamage not calling OnTakeDamage
 
...you would not to like to get infinite loop, would you ?

Marttt 09-12-2021 07:52

Re: SDKHooks_TakeDamage not calling OnTakeDamage
 
SDKHooks_TakeDamage may be called outside SDKHook_OnTakeDamage in some scenarios, which wouldn't cause a loop, in theory.

xSquared 09-17-2021 22:18

Re: SDKHooks_TakeDamage not calling OnTakeDamage
 
Quote:

Originally Posted by Bacardi (Post 2757570)
...you would not to like to get infinite loop, would you ?

this is exactly what I want

azalty 09-18-2021 12:01

Re: SDKHooks_TakeDamage not calling OnTakeDamage
 
Quote:

Originally Posted by xSquared (Post 2758076)
this is exactly what I want

That would just hang/freeze your server. You need to add a delay of some sort.


All times are GMT -4. The time now is 09:37.

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