Correct.
You can use following code, allow you to set mp_mirordamage to 0.3 (Used TraceAttack so you won't collect nades and falldamage):
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define VERSION "0.0.1"
#define PLUGIN ""
const m_iTeam = 114
#define cs_get_user_team_index(%0) get_pdata_int(%0, m_iTeam)
new g_iMaxPlayers
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
new mp_mirrordamage, mp_friendlyfire
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
mp_mirrordamage = get_cvar_pointer("mp_mirrordamage")
mp_friendlyfire = get_cvar_pointer("mp_friendlyfire")
RegisterHam(Ham_TraceAttack, "player", "OnCBasePlayer_TraceAttack", false)
g_iMaxPlayers = get_maxplayers()
}
public OnCBasePlayer_TraceAttack(id, iAttacker, Float:flDamage, Float:fVecDir[3], ptr, bitsDamageType)
{
if( IsPlayer(iAttacker)
&& id != iAttacker
&& is_user_alive(iAttacker)
&& cs_get_user_team_index(iAttacker) == cs_get_user_team_index(id)
&& get_pcvar_num(mp_friendlyfire) )
{
new Float:flMirorDamage = get_pcvar_float(mp_mirrordamage)
if( flMirorDamage > 0 )
{
SetHamParamEntity(1, iAttacker)
SetHamParamFloat(3, flDamage * flMirorDamage)
// SetHamParamVector(4, Float:{0.0,0.0,0.0}) // try this one if you get strange blood directions
return HAM_HANDLED
}
}
return HAM_IGNORED
}
__________________