"player/kungfuhit.wav" passes through the EmitSound() function, but "player/closecombat.wav" does not. So you won't be able to change it, unfortunately. At least not with the fakemeta method; there may be some other method I'm not aware of. I'd wager it's client-side, and therefore untouchable.
You might be able to catch in prethink if a client has pushed the attack button and then check if an entity lost health, but that may not work and might be a bit hard to figure out...
Anyways, I played around with the code and changed a few things. I used the method from one of my other plugins to make the victim of the punch be knocked back when you hit him with brass knuckles, and the knuckles will do damage twice, meaning you do twice the amount of damage of a normal punch. I didn't bother replacing sounds, because I don't have your brass knuckles sound effects and you could only replace kungfuhit anyways.
I left code in there so you could see for yourself exactly what sound effects are passing through the function. Compiles fine, no errors.
I think the knock-back is entertaining enough.
Code:
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <tsfun>
#define PLUGIN "Brass Knuckles"
#define VERSION "1.0"
#define AUTHOR "Calimaw/stupok69"
new bool:g_brassknuckles[33]
new bool:g_is_in_kungfu[33]
new g_damage
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_message(get_user_msgid("WeaponInfo"), "WeaponInfo_function")
register_event("PTakeDam", "PTakeDam_function", "a")
register_message(50, "killer_victim_function")
register_forward(FM_EmitSound, "EmitSound")
register_clcmd("say /brassknuckles", "cmdBrassKnuckles")
}
public client_connect(id)
{
g_brassknuckles[id] = false
g_is_in_kungfu[id] = true
}
public Event_Death()
{
new id = read_data(2)
g_brassknuckles[id] = false
g_is_in_kungfu[id] = true
}
public WeaponInfo_function(msg_id, msg_dest, msg_entity)
{
if(!get_msg_arg_int(1))
{
g_is_in_kungfu[msg_dest] = true
}
else
{
g_is_in_kungfu[msg_dest] = false
}
}
public PTakeDam_function()
{
g_damage = read_data(7)
}
public killer_victim_function(msg_id, msg_dest, msg_entity)
{
new victim = get_msg_arg_int(2)
new killer = get_msg_arg_int(3)
if(!is_user_alive(killer)) return PLUGIN_HANDLED
new Float:aimvelocity[3]
if(g_brassknuckles[killer])
{
velocity_by_aim(killer, g_damage * 100, aimvelocity)
set_pev(victim, pev_velocity, aimvelocity)
new health = get_user_health(victim)
if(health - g_damage >= 0)
{
set_user_health(victim, health-g_damage)
}
}
return PLUGIN_HANDLED
}
public cmdBrassKnuckles(id)
{
if(!is_user_alive(id))
client_print(id, print_chat, "The dead cannot buy items!")
else if(g_brassknuckles[id])
client_print(id, print_chat, "What good would that do?")
else
{
g_brassknuckles[id] = true
client_print(id, print_chat, "You bought a pair of brass knuckles!")
}
return PLUGIN_HANDLED
}
public EmitSound(id, channel, sample[])
{
/*
if(!is_user_alive(id))
return FMRES_IGNORED
*/
new name[32]
get_user_name(id, name, 31)
if(contain(sample, "spark") == -1)
{
client_print(0, print_chat, "%s %s", name, sample)
}
/*
if(g_brassknuckles[id])
{
if(equal(sample,"player/kungfuhit.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/hit_01.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_chat, "Hit Sound!")
return FMRES_SUPERCEDE
}
else if(equal(sample,"player/closecombat.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/swing_01.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
client_print(id, print_chat, "Swing Sound!")
return FMRES_SUPERCEDE
}
}
*/
return FMRES_IGNORED
}