naXe odpowiedź w Plugin - dzwiek został oznaczony jako odpowiedź
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
new Handle:g_iCvar = INVALID_HANDLE;
new String:g_szSoundName[80];
public Plugin myinfo = {
name = "Kill Sound",
author = "naXe",
description = "Odtwarza dźwięk wszystkim graczom, gdy ktoś zginie.",
version = "0.0.1",
url = "http://gamesolutions.pl"
};
public OnPluginStart() {
g_iCvar = CreateConVar("sm_kill_sound", "kill.mp3", "Ścieżka oraz nazwa dźwięku (bez sound/!)");
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
}
public OnConfigsExecuted() {
GetConVarString(g_iCvar, g_szSoundName, 80);
decl String:szBuffer[80];
PrecacheSound(g_szSoundName, true);
Format(szBuffer, 80, "sound/%s", g_szSoundName);
AddFileToDownloadsTable(szBuffer);
}
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) {
for(new i = 1; i <= GetMaxHumanPlayers(); i++) {
if(!IsClientInGame(i) || !IsFakeClient(i) || GetClientOfUserId(GetEventInt(event, "userid")) == i) continue;
EmitSoundToClient(i, g_szSoundName);
}
}
Cvar: sm_kill_sound "dźwięk"