Raised This Month: $ Target: $400
 0% 

Damage Absorption


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 06-14-2010 , 05:54   Re: Damage Absorption
Reply With Quote #5

Thanks Bugsy!

Exactly what I was trying to do!
Was quickly testing yours and noticed that when you are hit, players don't spill blood or slow down so I just moved some things around and added a few things.
The only downside to this is when you are using a 3rd party plugin which displays the damage dealt to the victim. It doesn't display anything until the last hit where the victim drops dead. Anyway around this if that is possible?

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <hamsandwich>
#include <fun>

public plugin_init() 
{
    
register_plugin("Damage Absorption ""1.0""Mazza")
    
RegisterHam(Ham_TakeDamage,"player""fw_HamTakeDamage")
}

public 
fw_HamTakeDamageiVictim iInflictor iAttacker Float:fDamage iDmgBits 

    
// client_print(iVictim, print_chat, "Dmg Type: %i", iDmgBits)

    
if(iDmgBits DMG_GENERIC || /*iVictim == iAttacker ||*/ !is_user_alive(iVictim) || !is_user_connected(iAttacker)) 
        return 
HAM_IGNORED 

    
new iDmgHP floatroundfDamage 0.3 ); 
    new 
iDmgArmor floatround( ( fDamage 0.7 ) * 0.5 ); //or 0.35 
    
new iHealth get_user_healthiVictim ); 
    new 
CsArmorTypeArmorTypeiArmor cs_get_user_armoriVictimArmorType)

    if(
iArmor)
    {
        if ( ( 
iHealth iDmgHP ) <= )     
        { 
            
//enough damage to kill player so a deathmsg is displayed 
            
SetHamParamFloatfDamage ); 
            return 
HAM_HANDLED
        } 
        else 
        { 
            
ExecuteHam(Ham_TakeDamageiVictimiInflictoriAttacker0.0DMG_BULLET DMG_NEVERGIB);
            
set_user_healthiVictim iHealth iDmgHP ); 
            
cs_set_user_armoriVictim clampiArmor iDmgArmor 100 ), ArmorType ); 
            return 
HAM_SUPERCEDE;     
        } 
    }
    
    return 
HAM_IGNORED

__________________
It's a mystery.
Mini_Midget is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:26.


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