Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <cstrike>
- #include <sdktools>
- #include <sdkhooks>
- #include <clientprefs>
- #include <csgocolors>
- #pragma semicolon 1
- #pragma newdecls required
- Handle Cookie_KillSound;
- bool killSound[MAXPLAYERS + 1];
- public Plugin myinfo =
- {
- name = "Dead Sound",
- author = "Charlie W.",
- description = "",
- version = "1.1",
- url = ""
- };
- #define SOUND_PATH "sound/arena/kill.mp3"
- #define RELATIVE_SOUND_PATH "/arena/kill.mp3"
- public void OnMapStart()
- {
- AddFileToDownloadsTable(SOUND_PATH);
- FakePrecacheSound(RELATIVE_SOUND_PATH);
- }
- public void OnPluginStart()
- {
- Cookie_KillSound = RegClientCookie("kill_sound", "Enable/Disable Kill sound", CookieAccess_Private);
- RegConsoleCmd("sm_quake", Command_Sound , "Enable/Disable kill sound");
- RegConsoleCmd("sm_kłejk", Command_Sound , "Enable/Disable kill sound");
- HookEvent("player_death", PlayerDeath);
- }
- public void OnClientCookiesCached(int client)
- {
- char scookie[64];
- GetClientCookie(client, Cookie_KillSound, scookie, sizeof(scookie));
- if(!StrEqual(scookie, ""))
- killSound[client] = view_as<bool>(StringToInt(scookie));
- else
- killSound[client] = true;
- return;
- }
- public Action Command_Sound(int client, int args)
- {
- if(killSound[client])
- {
- SetClientCookie(client, Cookie_KillSound, "0");
- CPrintToChat(client, "{default}[{green}Arena{default}] Wyłączyłeś właśnie dziwięk po zabiciu przeciwnika.", "Off");
- }
- else if(!killSound[client])
- {
- SetClientCookie(client, Cookie_KillSound, "1");
- CPrintToChat(client, "{default}[{green}Arena{default}] Włączyłeś właśnie dziwięk po zabiciu przeciwnika.", "On");
- }
- OnClientCookiesCached(client);
- return Plugin_Handled;
- }
- public Action PlayerDeath(Handle event, const char[] name, bool dontBroadcast)
- {
- int attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
- if(killSound[attacker])
- EmitSoundToClient(attacker, RELATIVE_SOUND_PATH);
- }
- public void FakePrecacheSound(const char[] szPath)
- {
- AddToStringTable(FindStringTable("soundprecache"), szPath);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement