Sorry for overdoing it...
Code:
#include <amxmodx>
#define PLUGIN_NAME "Ultimate Sounds Advanced"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "SAMURAI"
new g_kills[33];
new g_deaths[33];
new bool:g_sound_enabled[33];
new g_pcvar_flags;
enum enum_information {
kills,
message[64],
sound[64]
}
new const g_information[][enum_information] = {
{ 3, "%s: Triple Kill !", "ultimate_sounds/triplekill_ultimate" },
{ 4, "%s: Multi Kill !", "ultimate_sounds/multikill_ultimate" },
{ 6, "%s: Ultra Kill !", "ultimate_sounds/ultrakill_ultimate" },
{ 8, "%s: Killing Spree !", "ultimate_sounds/killingspree_ultimate" },
{ 10, "%s: Mega Kill !", "ultimate_sounds/megakill_ultimate" },
{ 12, "%s: Holy Shit !", "ultimate_sounds/holyshit_ultimate" },
{ 14, "%s: Ludicrous Kill !", "ultimate_sounds/ludicrouskill_ultimate" },
{ 15, "%s: Rampage !", "ultimate_sounds/rampage_ultimate" },
{ 16, "%s: Unstoppable !", "ultimate_sounds/unstoppable_ultimate" },
{ 18, "%s: M o n s t e R K i L L ! ! !", "ultimate_sounds/monsterkill_ultimate" }
};
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
g_pcvar_flags = register_cvar("ultimate_sounds_advanced", "ab");
register_event("ResetHUD", "reset_hud", "b");
register_event("DeathMsg", "death_event", "a");
register_clcmd("say /play", "enable_sound");
register_clcmd("say /stop", "disable_sound");
}
public enable_sound(id)
g_sound_enabled[id] = true;
public disable_sound(id)
g_sound_enabled[id] = false;
public client_connect(id) {
g_kills[id] = 0;
g_deaths[id] = 0;
g_sound_enabled[id] = true;
}
public plugin_precache() {
for ( new i = 0 ; i < sizeof g_information ; i++ )
precache_sound(g_information[i][sound]);
}
plugin_mode() {
new mode[9];
get_pcvar_string(g_pcvar_flags, mode, charsmax(mode));
return read_flags(mode);
}
public death_event() {
new killer = read_data(1);
new victim = read_data(2);
if ( is_user_connected(victim) ) {
g_kills[victim] = 0;
g_deaths[victim]++;
}
if ( ! is_user_connected(killer) )
return;
g_kills[killer]++;
g_deaths[killer] = 0;
for ( new i = 0 ; i < sizeof g_information ; i++ ) {
if ( g_kills[killer] == g_information[i][kills]) {
announce(killer, i);
break;
}
}
return;
}
announce(killer, level) {
new name[33];
get_user_name(killer, name, 32);
set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);
new mode = plugin_mode();
if ( mode & 2 )
show_hudmessage(0, g_information[level][message], name);
else if ( mode & 8 )
show_hudmessage(killer, g_information[level][message], name);
if ( mode & 1 ) {
new players[32], iplayers;
get_players(players, iplayers, "ch");
for ( new i = 0 ; i < iplayers ; i++ ) {
if ( g_sound_enabled[players[i]] )
client_cmd(players[i], "spk %s", g_information[level][sound]);
}
}
else if ( mode & 4 )
client_cmd(killer, "spk %s", g_information[level][sound]);
}
public reset_hud(id) {
if ( ! ( plugin_mode() & 16 ) )
return;
if ( g_kills[id] > g_information[0][kills] )
client_print(id, print_chat, "* You are on a killstreak with %d kills.", g_kills[id]);
else if ( g_deaths[id] > 1 )
client_print(id, print_chat, "* Take care, you are on a deathstreak with %d deaths in a row.", g_deaths[id]);
}