#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
new g_iMaxPlayers, g_iFhEmitSound
#define IsPlayer(%0) (1 <= %0 <= g_iMaxPlayers)
public plugin_init()
{
register_plugin("Vehicle Knife Sound Fix", "1.0", "KayDee")
register_cvar("@VehicleKnifeSoundFix", "1.0", FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED)
if(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_vehicle"))
{
RegisterHam(Ham_TraceAttack, "func_vehicle", "Vehicle_TraceAttack", 1)
g_iMaxPlayers = get_maxplayers()
}
}
public Vehicle_TraceAttack(iVictim, iAttacker)
{
if(IsPlayer(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE)
{
g_iFhEmitSound = register_forward(FM_EmitSound, "Fm_EmitSound", 0)
}
}
public Fm_EmitSound(iEnt, iChannel)
{
emit_sound(iEnt, iChannel, "weapons/knife_hitwall1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
unregister_forward(FM_EmitSound, g_iFhEmitSound, 0)
return FMRES_SUPERCEDE
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2055\\ f0\\ fs16 \n\\ par }
*/