UI.AddCheckbox(["Misc.", "Helpers", "Sound"], "Kill Spam")

var sayWhat = ["Wow Your Bad Download Cheats At youtube.com/channel/UC-wwfz9vyxITPL29-9ZsakA?", "im just better", "i also sell steam accounts at shoppy.gg/product/mBLg3Uf", "hit P with dankware youtube.com/channel/UC-wwfz9vyxITPL29-9ZsakA?", "Yikes Your Bad Well Why Not Sub To Zooming CS:GO And Get Better :)"];

function getRandomArrayElement(arr){
    var min = 0;
    var max = (arr.length - 1);
    var randIndex = Math.floor(Math.random() * (max - min)) + min;
    return arr[randIndex];
}

function onPlayerDeath() {
    if (!UI.GetValue(["Misc.","Helpers","Sound","Kill Spam"])) return;

    attacker = Event.GetInt("attacker");
    attacker_index = Entity.GetEntityFromUserID(attacker);
    attacker_name = Entity.GetName(attacker_index);
    attacker_me = Entity.IsLocalPlayer(attacker_index);

    if (attacker_me) {
        Global.ExecuteCommand("say " + getRandomArrayElement(sayWhat));
    }
}


Global.RegisterCallback("player_death", "onPlayerDeath");