Page 1 of 1
Problema Plugin
Posted: 12 Jan 2020, 20:02
by JustMatz
Plugin Cerut: Doresc rezolvarea acestui plugin
Descriere (adica ce face el mai exact): doresc ca armura sa fie buna si cand primeste dmg de la ct serverul este mod furien.
Serverul impune conditii strict HLDS/REHLDS?: REHDLS
Ai cautat pluginul?(daca da, precizeaza cum): Da si degeaba.
Necesita mod special?:No
- | Afiseaza codul
#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.5" ) // 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( get_user_weapon(attacker) != CSW_KNIFE || 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
}
Re: Problema Plugin
Posted: 21 Jan 2020, 18:57
by levin
- | Afiseaza codul
#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.5" ) // 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
}