#include <amxmod>

new kills[33] = {0,...};
new deaths[33] = {0,...};

#define LEVELS 6

new levels[6] = {3, 5, 7, 8, 9, 10};
new sounds[6][] = {"misc/multikill", "misc/ultrakill", "misc/dominating", 
                   "misc/killingspree", "misc/unstoppable", "misc/godlike"};
new messages[6][] = {"%s: Multi-Kill!", "%s: Ultra-Kill!!!",
                     "%s: Dominating!!!", "%s IS ON A KILLING SPREE!!!",
                     "%s: Unstoppable!!!", "%s IS GODLIKE." };

public death_event(id) {
    new killer = read_data(1);
    new victim = read_data(2);

    kills[killer] += 1;
    kills[victim] = 0;
    deaths[killer] = 0;
    deaths[victim] += 1;

    for (new i = 0; i < LEVELS; i++) {
        if (kills[killer] == levels[i]) {
            announce(killer, i);
            return PLUGIN_CONTINUE;
        }
    }

    return PLUGIN_CONTINUE;
}

announce(killer, level) {
    new name[32];

    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);
    show_hudmessage(0, messages[level], name);
    client_cmd(0, "spk %s", sounds[level]);
}

public reset_hud(id) {
    if (kills[id] > levels[0]) {
        client_print(id, print_chat, 
                     "* You are on a killstreak with %d kills.", kills[id]);
    } else if (deaths[id] > 1) {
        client_print(id, print_chat, 
                     "* Take care, you are on a deathstreak with %d deaths in a row.", deaths[id]);
    }
}

public client_connect(id) {
    kills[id] = 0;
    deaths[id] = 0;
}

public plugin_init() {
    register_plugin("PsychoStreak", "0.4", "PsychoGuard");

    register_event("ResetHUD", "reset_hud", "b");
    register_event("DeathMsg", "death_event", "a");

    return PLUGIN_CONTINUE;
}

