var pShots = [];

var shouldTime = false;

var timerTime = 0;

var shotTime = 0;





function OnPlayerDeath() {

    var userid = Event.GetInt("userid"); // he got hurt

    var attacker = Event.GetInt("attacker"); // he dealt damage

    var stomach = Event.GetInt("stomach");

    if (Entity.IsLocalPlayer(Entity.GetEntityFromUserID(attacker))) {

        if (Entity.IsEnemy(Entity.GetEntityFromUserID(userid))) {

            if (headshot && pShots.length == 1) {

                Cheat.ExecuteCommand("say " + "купи кфг нищий у меня)"); // say cmd
                // PUT CUSTOM STUFF ABOVE     ^ HERE     ^

                    pShots = []

            }

        }

    }



}

function OnPlayerFire() {

    var localPlayerIndex = Entity.GetLocalPlayer();

    var userid = Event.GetInt("userid");

    var shooter = Entity.GetEntityFromUserID(userid);

    if (localPlayerIndex == shooter) {

        pShots.push(0);

        shouldTime = true;

        shotTime = Globals.Curtime();

    }

    else {

        return;

    }

}

function Timer() {

    if (shouldTime) {

        timerTime = Globals.Curtime();

    }

    var timeDifference = timerTime - shotTime;

    if(timeDifference > .5)

    {

        pShots = [];

        shouldTime = false;

    }

}

Cheat.RegisterCallback("Draw", "Timer")

Cheat.RegisterCallback("weapon_fire", "OnPlayerFire")

Cheat.RegisterCallback("player_death", "OnPlayerDeath")