#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Knife Kill Sound",
version = "1.0",
}
public OnPluginStart()
{
HookEvent("player_death", Death);
}
public OnMapStart()
{
decl String:sBuffer[128];
FormatEx(sBuffer, sizeof(sBuffer), "sound/misc/your_sound.wav");
if(FileExists(sBuffer))
{
AddFileToDownloadsTable(sBuffer);
PrecacheSound("misc/your_sound.wav", true);
}
else
{
SetFailState("No sound file was found.")
}
}
public Death(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:str[32];
GetEventString(event, "weapon", str, sizeof(str));
if(StrEqual(str, "knife", true)) EmitSoundToAll("misc/your_sound.wav");
}