UI.AddLabel("------------ C4 Timer -------------");
UI.AddCheckbox("Enable C4 Indicator");
function calcDist(local, target) {
var lx = local[0];
var ly = local[1];
var lz = local[2];
var tx = target[0];
var ty = target[1];
var tz = target[2];
var dx = lx - tx;
var dy = ly - ty;
var dz = lz - tz;
return Math.sqrt(dx * dx + dy * dy + dz * dz);
}
function dispDamage() {
local = Entity.GetLocalPlayer();
if (!UI.GetValue("Script items", "Enable C4 Indicator")) return;
var c4 = Entity.GetEntitiesByClassID(128)[0];
if (c4 == undefined) return;
var eLoc = Entity.GetRenderOrigin(c4);
var lLoc = Entity.GetRenderOrigin(local)
var distance = calcDist(eLoc, lLoc);
var willKill = false;
var dmg;
//player checks
var armor = Entity.GetProp(local, "CCSPlayerResource", "m_iArmor"); // player armor
var health = Entity.GetProp(local, "CBasePlayer", "m_iHealth"); // player health
//c4 things
var timer = (Entity.GetProp(c4, "CPlantedC4", "m_flC4Blow") - Globals.Curtime()); // c4 left time
var c4length = Entity.GetProp(c4, "CPlantedC4", "m_flTimerLength");
var bar_length = (((Render.GetScreenSize()[1] - 50) / c4length) * (timer));
var isbombticking = Entity.GetProp(c4, "CPlantedC4", "m_bBombTicking");
//defusing things
var deflength = Entity.GetProp(c4, "CPlantedC4", "m_flDefuseLength"); // length of defuse
var deftimer = (Entity.GetProp(c4, "CPlantedC4", "m_flDefuseCountDown") - Globals.Curtime()); // timer when defusing
var defbarlength = (((Render.GetScreenSize()[1] - 50) / deflength) * (deftimer)); // lenght for left bar
var isbeingdefused = Entity.GetProp(c4, "CPlantedC4", "m_hBombDefuser"); // check if bomb is being defused
var gotdefused = Entity.GetProp(c4, "CPlantedC4", "m_bBombDefused"); // check if bomb has or hasnt defused
const a = 450.7;
const b = 75.68;
const c = 789.2;
const d = (distance - b) / c;
var damage = a * Math.exp(-d * d);
if (armor > 0) {
var newDmg = damage * 0.5;
var armorDmg = (damage - newDmg) * 0.5;
if (armorDmg > armor) {
armor = armor * (1 / .5);
newDmg = damage - armorDmg;
}
damage = newDmg;
}
dmg = Math.ceil(damage);
if (dmg >= health) {
willKill = true;
}
else {
willKill = false;
}
timer = parseFloat(timer.toPrecision(3));
timer2 = parseFloat(timer.toPrecision(2));
timer3 = parseFloat(timer.toPrecision(1));
bomb_font = Render.AddFont("Arial Black", 16, 800);
if (!isbombticking) return;
if (gotdefused) return;
if (timer >= 1 && timer > 10)
{
Render.StringCustom(10 + 1, 5 + 1, 0, getSite(c4) + timer + "s", [0, 0, 0, 255], bomb_font);
Render.StringCustom(10, 5, 0, getSite(c4) + timer + "s", [129, 177, 14, 255], bomb_font);
}
else if (timer <= 10 && timer > 5 && timer >= 1)
{
Render.StringCustom(10 + 1, 5 + 1, 0, getSite(c4) + timer2 + "s", [0, 0, 0, 255], bomb_font);
Render.StringCustom(10, 5, 0, getSite(c4) + timer2 + "s", [210, 216, 112, 255], bomb_font);
}
else if (timer <= 5 && timer >= 1)
{
Render.StringCustom(10 + 1, 5 + 1, 0, getSite(c4) + timer2 + "s", [0, 0, 0, 255], bomb_font);
Render.StringCustom(10, 5, 0, getSite(c4) + timer2 + "s", [252, 18, 19, 255], bomb_font);
}
else if (timer < 1 && timer >= 0.1)
Это не то. Еще ты забыл это в конце:JavaScript:UI.AddLabel("------------ C4 Timer -------------"); UI.AddCheckbox("Enable C4 Indicator"); function calcDist(local, target) { var lx = local[0]; var ly = local[1]; var lz = local[2]; var tx = target[0]; var ty = target[1]; var tz = target[2]; var dx = lx - tx; var dy = ly - ty; var dz = lz - tz; return Math.sqrt(dx * dx + dy * dy + dz * dz); } function dispDamage() { local = Entity.GetLocalPlayer(); if (!UI.GetValue("Script items", "Enable C4 Indicator")) return; var c4 = Entity.GetEntitiesByClassID(128)[0]; if (c4 == undefined) return; var eLoc = Entity.GetRenderOrigin(c4); var lLoc = Entity.GetRenderOrigin(local) var distance = calcDist(eLoc, lLoc); var willKill = false; var dmg; //player checks var armor = Entity.GetProp(local, "CCSPlayerResource", "m_iArmor"); // player armor var health = Entity.GetProp(local, "CBasePlayer", "m_iHealth"); // player health //c4 things var timer = (Entity.GetProp(c4, "CPlantedC4", "m_flC4Blow") - Globals.Curtime()); // c4 left time var c4length = Entity.GetProp(c4, "CPlantedC4", "m_flTimerLength"); var bar_length = (((Render.GetScreenSize()[1] - 50) / c4length) * (timer)); var isbombticking = Entity.GetProp(c4, "CPlantedC4", "m_bBombTicking"); //defusing things var deflength = Entity.GetProp(c4, "CPlantedC4", "m_flDefuseLength"); // length of defuse var deftimer = (Entity.GetProp(c4, "CPlantedC4", "m_flDefuseCountDown") - Globals.Curtime()); // timer when defusing var defbarlength = (((Render.GetScreenSize()[1] - 50) / deflength) * (deftimer)); // lenght for left bar var isbeingdefused = Entity.GetProp(c4, "CPlantedC4", "m_hBombDefuser"); // check if bomb is being defused var gotdefused = Entity.GetProp(c4, "CPlantedC4", "m_bBombDefused"); // check if bomb has or hasnt defused const a = 450.7; const b = 75.68; const c = 789.2; const d = (distance - b) / c; var damage = a * Math.exp(-d * d); if (armor > 0) { var newDmg = damage * 0.5; var armorDmg = (damage - newDmg) * 0.5; if (armorDmg > armor) { armor = armor * (1 / .5); newDmg = damage - armorDmg; } damage = newDmg; } dmg = Math.ceil(damage); if (dmg >= health) { willKill = true; } else { willKill = false; } timer = parseFloat(timer.toPrecision(3)); timer2 = parseFloat(timer.toPrecision(2)); timer3 = parseFloat(timer.toPrecision(1)); bomb_font = Render.AddFont("Arial Black", 16, 800); if (!isbombticking) return; if (gotdefused) return; if (timer >= 1 && timer > 10) { Render.StringCustom(10 + 1, 5 + 1, 0, getSite(c4) + timer + "s", [0, 0, 0, 255], bomb_font); Render.StringCustom(10, 5, 0, getSite(c4) + timer + "s", [129, 177, 14, 255], bomb_font); } else if (timer <= 10 && timer > 5 && timer >= 1) { Render.StringCustom(10 + 1, 5 + 1, 0, getSite(c4) + timer2 + "s", [0, 0, 0, 255], bomb_font); Render.StringCustom(10, 5, 0, getSite(c4) + timer2 + "s", [210, 216, 112, 255], bomb_font); } else if (timer <= 5 && timer >= 1) { Render.StringCustom(10 + 1, 5 + 1, 0, getSite(c4) + timer2 + "s", [0, 0, 0, 255], bomb_font); Render.StringCustom(10, 5, 0, getSite(c4) + timer2 + "s", [252, 18, 19, 255], bomb_font); } else if (timer < 1 && timer >= 0.1)
{
Render.StringCustom(55, 648, 0, getSite(c4) + timer3 + "s", [255, 255, 255, 255], 8);
}
// defuse time bar
if (isbeingdefused > 0){
if (timer > deflength && timer >= 0.1) {
Render.FilledRect(0, 0, 12, defbarlength, [98,145,255, 255]);
}
else {
Render.FilledRect(0, 0, 12, defbarlength, [255,55,48, 255]);
}
}
if (!Entity.IsAlive(local)) return;
if (willKill) {
Render.StringCustom(76, 670, 0, "fatal", [255,255,255, 255], 8);
}
else if (damage > 0.5) {
Render.StringCustom(76, 670, 0, "" + dmg, [255, 255, 255, 255], 8);
}
else if (damage > 0) {
Render.StringCustom(76, 670, 0, "0", [255, 255, 255, 255], 8);
}
}
function getSite(c4) {
bombsite = Entity.GetProp(c4, "CPlantedC4", "m_nBombSite");
if (bombsite == 0) {
return "a ";
} else {
return "b ";
}
}
Cheat.RegisterCallback("Draw", "dispDamage");
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz