life is cheap, death is free!
-
Автор темы
- #1
JavaScript:
var lastkill = 0;
var kills = 0;
var headshot = false;
var badges = [];
function draw() {
if(!World.GetServerString() || Entity.IsAlive(Entity.GetLocalPlayer()) == false) badges.length = 0;
if(!World.GetServerString() || Entity.IsAlive(Entity.GetLocalPlayer()) == false) return;
if (kills == 1) RenderFrame = Render.AddTexture("ot/killmarks/badge_multi1.png");
if (kills == 2) RenderFrame = Render.AddTexture("ot/killmarks/badge_multi2.png");
else if (kills == 3) RenderFrame = Render.AddTexture("ot/killmarks/badge_multi3.png");
else if (kills == 4) RenderFrame = Render.AddTexture("ot/killmarks/badge_multi4.png");
else if (kills == 5) RenderFrame = Render.AddTexture("ot/killmarks/badge_multi5.png");
else if (kills == 6) RenderFrame = Render.AddTexture("ot/killmarks/badge_multi6.png");
if (Event.GetInt("headshot") == 1 && kills > 0) {
headshot = true;
}
if (kills > 0 && Globals.Curtime() < (lastkill + 2) && headshot == false) {
Render.TexturedRect(Global.GetScreenSize()[0]/2 - 79, Global.GetScreenSize()[1] - 158, 158, 158, RenderFrame);
}
else if (kills < 5 && Globals.Curtime() < (lastkill + 2) && headshot == true) {
RenderFrame = Render.AddTexture("ot/killmarks/badge_headshot.png");
Render.TexturedRect(Global.GetScreenSize()[0]/2 - 79, Global.GetScreenSize()[1] - 158, 158, 158, RenderFrame);
}
else if (kills > 5 && Globals.Curtime() < (lastkill + 2) && headshot == true) {
RenderFrame = Render.AddTexture("ot/killmarks/badge_headshot_gold.png");
Render.TexturedRect(Global.GetScreenSize()[0]/2 - 79, Global.GetScreenSize()[1] - 158, 158, 158, RenderFrame);
}
if (badges.length > 0) {
for (var i = badges.slice(-11).length, j = 0; i > 0; i-- , j++) {
if (j > 11) {
j = 0;
}
var badge = badges.slice(-11)[i - 1];
if (badge.type == "headshot") RenderBadge = Render.AddTexture("ot/killmarks/badge_crosshair.png");
if (badge.type == "body") RenderBadge = Render.AddTexture("ot/killmarks/badge_elite.png");
Render.TexturedRect(Global.GetScreenSize()[0] - 500 - 30 * i, Global.GetScreenSize()[1] - 125, 158, 158, RenderBadge);
}
if (badges.length > 10) {
badges.shift();
}
}
}
function onkill() {
if(!World.GetServerString() || Entity.IsAlive(Entity.GetLocalPlayer()) == false) return;
if(Entity.GetEntityFromUserID(Event.GetInt("attacker")) == Entity.GetLocalPlayer() && Entity.GetEntityFromUserID(Event.GetInt("userid")) != Entity.GetLocalPlayer()){
kills++;
lastkill = Globals.Curtime();
if (Event.GetInt("headshot") == 1 && kills > 0) {
headshot = true;
}
if (Event.GetInt("headshot") == 1) {
badges.push({
type: "headshot"
});
}
else {
badges.push({
type: "body"
});
}
}
}
function round_pre() {
kills = 0;
}
Cheat.RegisterCallback("Draw", "draw");
Cheat.RegisterCallback("player_death", "onkill")
Cheat.RegisterCallback("round_prestart","round_pre");