AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   Proper way to deal damage without extensions (https://forums.alliedmods.net/showthread.php?t=111684)

necavi 07-01-2013 02:24

Re: Proper way to deal damage without extensions
 
What you should do to merely increase damage is use a TakeDamage hook or something similar and multiply the damage in place, that'll prevent retriggering.

Sansaurithbane 07-05-2013 22:47

Re: Proper way to deal damage without extensions
 
Quote:

Originally Posted by Powerlord (Post 1981022)
You're setting the inflicator and weapon arguments to the weapon's entity index like psychonic mentioned? (I don't think CS:S supports the weapon argument)

It appears you are correct, in CS:S it shows up as a suicide message. In CSGO it seemed like if the added damage killed the victim, it would show it as a suicide and the attacker killed the victim with whatever weapon was used.

And it seemed like the event didn't re-trigger the damage.

rodrigo286 11-14-2017 17:30

Re: Proper way to deal damage without extensions
 
Nem syntax:

PHP Code:

stock void DealDamage(int nClientVictimint nDamageint nClientAttacker 0int nDamageType DMG_GENERICchar[] sWeapon "")
// ----------------------------------------------------------------------------
{
    
// taken from: http://forums.alliedmods.net/showthread.php?t=111684
    // thanks to the authors!
    
if(    nClientVictim &&
            
IsValidEdict(nClientVictim) &&
            
IsClientInGame(nClientVictim) &&
            
IsPlayerAlive(nClientVictim) &&
            
nDamage 0)
    {
        
int EntityPointHurt CreateEntityByName("point_hurt");
        if(
EntityPointHurt != 0)
        {
            
char sDamage[16];
            
IntToString(nDamagesDamagesizeof(sDamage));

            
char sDamageType[32];
            
IntToString(nDamageTypesDamageTypesizeof(sDamageType));

            
DispatchKeyValue(nClientVictim,            "targetname",        "war3_hurtme");
            
DispatchKeyValue(EntityPointHurt,        "DamageTarget",    "war3_hurtme");
            
DispatchKeyValue(EntityPointHurt,        "Damage",                sDamage);
            
DispatchKeyValue(EntityPointHurt,        "DamageType",        sDamageType);
            if(!
StrEqual(sWeapon""))
                
DispatchKeyValue(EntityPointHurt,    "classname",        sWeapon);
            
DispatchSpawn(EntityPointHurt);
            
AcceptEntityInput(EntityPointHurt,    "Hurt",                    (nClientAttacker != 0) ? nClientAttacker : -1);
            
DispatchKeyValue(EntityPointHurt,        "classname",        "point_hurt");
            
DispatchKeyValue(nClientVictim,            "targetname",        "war3_donthurtme");

            
RemoveEdict(EntityPointHurt);
        }
    }


Regards.


All times are GMT -4. The time now is 18:42.

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