Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <hamsandwich>
- #include <fakemeta>
- #define PLUGIN "Armor block knife dmg"
- #define VERSION "1.0"
- #define AUTHOR "Nubo"
- // Credits: cheap_suit - Biohazard ZM 3.1
- new g_cAbsorbPercent
- public plugin_init()
- {
- register_plugin( PLUGIN, VERSION, AUTHOR )
- RegisterHam( Ham_TakeDamage, "player", "ham_takedamage_pre", 0 )
- g_cAbsorbPercent = register_cvar( "armor_absorption_percent", "0.20" ) // 0.25 = 25% , 0.5 = 50% , etc.
- }
- public ham_takedamage_pre( victim, inflictor, attacker, Float:damage, damagetype )
- {
- if( victim == attacker || !is_user_alive(victim) || !is_user_alive(attacker) )
- return HAM_IGNORED
- if( attacker != inflictor )
- return HAM_IGNORED
- static Float:armor
- pev( victim, pev_armorvalue, armor )
- static Float:extra_dmg
- static Float:absorption
- if( armor > 0.0 )
- {
- absorption = damage * get_pcvar_float(g_cAbsorbPercent)
- extra_dmg = damage - absorption
- armor -= absorption
- if( armor < 0.0 )
- {
- extra_dmg -= armor
- armor = 0.0
- }
- set_pev( victim, pev_armorvalue, armor )
- SetHamParamFloat( 4, extra_dmg )
- }
- return HAM_HANDLED
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement