const master_switch = UI.AddCheckbox("test"); // checkbox
const normal_killsays = ["1.", // bodyaim trashtalk
"2"]; // bodyaim trashtalk
const hs_killsays = ["1", // hs trashtalk
"2"]; // hs trashtalk
const on_player_death = function()
{
if(UI.GetValue.apply(null, master_switch))
{
const attacker = Entity.GetEntityFromUserID(Event.GetInt("attacker"));
if(Entity.IsLocalPlayer(attacker) && attacker != Entity.GetEntityFromUserID(Event.GetInt("userid")))
{
Cheat.ExecuteCommand("say " + (Event.GetInt("headshot") == 1 && Math.random() > 0.5 ? hs_killsays[Math.floor(Math.random() * hs_killsays.length)] : normal_killsays[Math.floor(Math.random() * normal_killsays.length)]));
}
}
};
Cheat.RegisterCallback("player_death", "on_player_death");