Raised This Month: $ Target: $400
 0% 

Damage Absorption


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Mini_Midget
Veteran Member
Join Date: Jan 2006
Location: It's a mystery.
Old 06-08-2010 , 08:53   Damage Absorption
Reply With Quote #1

I'm trying to manipulate the damage absorption towards the armor. I'm going to base it around how Natural Selection Armor system works. (Here's the site about the Armor System in NS http://www.unknownworlds.com/ns/stat...rmorSystem.htm)

I'm going for a 70% damage absorption with a 50% damage negation. This is my code so far...

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

public plugin_init() 
{
    
register_plugin("Tester ""1.0""Mazza")
    
RegisterHam(Ham_TakeDamage,"player""bacon_takedamage")
}

public 
bacon_takedamage(victiminflictorattackerFloat:Damagedamagetype)
{
    if(
damagetype DMG_GENERIC || victim == attacker || !is_user_alive(victim) || !is_user_connected(attacker))
        return 
HAM_IGNORED

    
new CurrentHealth get_user_health(victim)
    new 
CsArmorTypeArmorTypeCurrentArmor cs_get_user_armor(victimArmorType)

    if(
CurrentArmor)
    {
        new 
FloatDamageAbsorptionFloatDamageNegation
        DamageAbsorption 
CurrentArmor - (Damage 0.7)
        
DamageNegation CurrentHealth - (DamageAbsorption 0.5)

        if(
DamageAbsorption 0
            
Damage += CurrentArmor
        
if(DamageNegation 0
            
Damage += CurrentHealth

        cs_set_user_armor
(victimclamp(CurrentArmor0255), ArmorType)
        
set_user_health(victimclamp(CurrentHealth0255))
        
        
SetHamParamFloat(4Damage)

        
client_print(attackerprint_chat"[Test] Damage: %f Armor Damage: %f, Heatlh Damage, %f"DamageDamageAbsorptionDamageNegation)
    }
    
    return 
HAM_IGNORED

__________________
It's a mystery.
Mini_Midget is offline
 


Thread Tools
Display Modes

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