just find the sound when hiting a wall in sound/wepons and add this line to the .sma in public EmitSound
Code:
#include <amxmodx>
#include <fakemeta>
#include <engine>
#include <cstrike>
new PLUGIN_NAME[] = "Brass Knuckles"
new PLUGIN_VERSION[] = "1.0"
new PLUGIN_AUTHOR[] = "Cheap_Suit"
new bool:g_bknuckles[33]
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1")
register_event("Damage", "Event_Damage", "be", "2!0")
register_event("DeathMsg", "Event_Death", "a")
register_forward(FM_EmitSound, "EmitSound")
register_clcmd("say /buybk", "cmdBuy")
}
public plugin_precache()
{
precache_model("models/p_bknuckles.mdl")
precache_model("models/v_bknuckles.mdl")
precache_sound("bknuckles/knife_hit1.wav")
precache_sound("bknuckles/knife_hit2.wav")
precache_sound("bknuckles/knife_hit3.wav")
precache_sound("bknuckles/knife_hit4.wav")
precache_sound("bknuckles/knife_stab.wav")
}
public client_connect(id) g_bknuckles[id] = false
public Event_Death() g_bknuckles[read_data(2)] = false
public cmdBuy(id)
{
new Cost = 5000, Money = cs_get_user_money(id)
if(!is_user_alive(id))
client_print(id, print_chat, "Sorry, You need to be alive")
else if(Money < Cost)
client_print(id, print_chat, "Sorry, You need %d to buy", Cost)
else if(g_bknuckles[id])
client_print(id, print_chat, "Sorry, You already bought a pair of brass knuckles")
else
{
g_bknuckles[id] = true
cs_set_user_money(id, Money - Cost)
client_print(id, print_chat, "You bought a pair of brass knuckles")
}
return PLUGIN_HANDLED
}
public Event_Damage(id)
{
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
new AttakerWeapon, AttakerPartHit
new Attacker = get_user_attacker(id, AttakerWeapon, AttakerPartHit)
if(AttakerWeapon != CSW_KNIFE)
return PLUGIN_CONTINUE
if(!g_bknuckles[Attacker])
return PLUGIN_CONTINUE
new Float:Random_Float[3]
for(new i = 0; i < 3; i++) Random_Float[i] = random_float(100.0, 150.0)
Punch_View(id, Random_Float)
return PLUGIN_CONTINUE
}
public Event_CurWeapon(id)
{
if(!is_user_alive(id) || !is_user_connected(id))
return PLUGIN_CONTINUE
new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
if(weapon == CSW_KNIFE)
{
if(g_bknuckles[id])
{
entity_set_string(id, EV_SZ_viewmodel, "models/v_bknuckles.mdl")
entity_set_string(id, EV_SZ_weaponmodel, "models/p_bknuckles.mdl")
}
}
return PLUGIN_CONTINUE
}
public EmitSound(id, channel, sample[])
{
if(!is_user_alive(id) || !is_user_connected(id))
return FMRES_IGNORED
new temp[2], weapon = get_user_weapon(id, temp[0], temp[1])
if(weapon == CSW_KNIFE)
{
if(g_bknuckles[id])
{
if(equal(sample,"weapons/knife_hit1.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/knife_hit1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
else if(equal(sample,"weapons/knife_hit2.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/knife_hit2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
else if(equal(sample,"weapons/knife_hit3.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/knife_hit3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
else if(equal(sample,"weapons/knife_hit4.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/knife_hit4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
else if(equal(sample,"weapons/knife_stab.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/knife_stab.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
else if(equal(sample,"weapons/knife_hitwall1.wav"))
{
emit_sound(id, CHAN_WEAPON, "bknuckles/knife_stab.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return FMRES_SUPERCEDE
}
}
}
return FMRES_IGNORED
}
stock Punch_View(id, Float:ViewAngle[3])
{
entity_set_vector(id, EV_VEC_punchangle, ViewAngle)
}
im not sure if the sound is knife_hitwall1, im in college now so i cant tell u for sure, better check it in ur sound/weapon folder...
PD: Can anyone help me whith the models.. i dunno why the plugin doesnt show themm im runnig 2 plugins with models and they work fine..[/small]