hi.. the problem with this code is that when you kill someone, it sets the frags to you (1 / 0) but the victim gets (-1 / 1).. so if you kill him again u will have (2 / 0) and the victim (-2 / 2)
I dunno what the problem is.. can any one help me with this?
PHP Code:
public event_damage( id ) {
new victim_id = id;
if( !is_user_connected( victim_id ) ) return PLUGIN_CONTINUE
new dmg_take = read_data( 2 );
new dmgtype = read_data( 3 );
new Float:multiplier = get_pcvar_float(CVAR_DAMAGE);
new Float:damage = dmg_take * multiplier;
new health = get_user_health( victim_id );
new iWeapID, attacker_id = get_user_attacker( victim_id, iWeapID );
if( !is_user_connected( attacker_id ) || !is_user_alive( victim_id ) ) {
return PLUGIN_HANDLED
}
if( iWeapID == CSW_KNIFE && knife_model[attacker_id] == 4 ) {
if( floatround(damage) >= health ) {
if( victim_id == attacker_id ) {
return PLUGIN_CONTINUE
}else{
log_kill( attacker_id, victim_id, "knife", 0 );
}
return PLUGIN_CONTINUE
}else {
if( victim_id == attacker_id ) return PLUGIN_CONTINUE
fakedamage( victim_id, "weapon_knife", damage, dmgtype );
}
}
return PLUGIN_CONTINUE
}
stock log_kill(killer, victim, weapon[],headshot) {
user_silentkill( victim );
message_begin( MSG_ALL, get_user_msgid( "DeathMsg" ), {0,0,0}, 0 );
write_byte( killer );
write_byte( victim );
write_byte( headshot );
write_string( weapon );
message_end();
new kfrags = get_user_frags( killer );
set_user_frags( killer, kfrags + 1 );
new vfrags = get_user_frags( victim );
set_user_frags( victim, vfrags - 1 );
return PLUGIN_CONTINUE
}
__________________