Вопрос Хелпаните где ошибочка?

душнила
Пользователь
Статус
Оффлайн
Регистрация
19 Июн 2019
Сообщения
254
Реакции[?]
45
Поинты[?]
6K
Мб я тупой (в чём не сомневаюсь), эт мой первый скрипт, он работает, но функции сами не хотят работать
Где у меня ошибка?
JavaScript:
UI.SetValue("Misc", "GENERAL", "Miscellaneous", "Hidden cvars", true)


function anim()
{
    if (UI.GetValue("Misc", "JAVASCRIPT", "Script items", "legfucker"))
    {
        clock = clock + 0.5
        if (clock > 1)
        {
            if (UI.GetValue("Misc", "GENERAL", "Movement", "Slide walk") && UI.GetValue("Anti-Aim", "Extra", "Jitter move"))
            {
                UI.SetValue("Misc", "GENERAL", "Movement", "Slide walk", 0);
                UI.SetValue("Anti-Aim", "Extra", "Jitter move", 0);
                clock = 0
            }
            else
            {
                UI.SetValue("Misc", "GENERAL", "Movement", "Slide walk", 1);
                UI.SetValue("Anti-Aim", "Extra", "Jitter move", 1);
                clock = 0
            }
        }
    }
}


var lasttime = 0;
function onRender( )
{
var tag = UI.GetValue("Clantag");
var speed = 4.5;
var time = parseInt((Globals.Curtime() * speed))
if (time != lasttime)
{
if (tag == 1) {
switch ((time) % 60) {

case 1: { Local.SetClanTag(""); break; }
case 2: { Local.SetClanTag("|"); break; }
case 3: { Local.SetClanTag("|\ "); break; }
case 4: { Local.SetClanTag("|\|"); break; }
case 5: { Local.SetClanTag("N"); break; }
case 6: { Local.SetClanTag("N3"); break; }
case 7: { Local.SetClanTag("Ne"); break; }
case 8: { Local.SetClanTag("Ne3"); break; }
case 9: { Local.SetClanTag("Nee"); break; }
case 10: { Local.SetClanTag("Nee<"); break; }
case 11: { Local.SetClanTag("Nee<|"); break; }
case 12: { Local.SetClanTag("Need"); break; }
case 13: { Local.SetClanTag("Need$"); break; }
case 14: { Local.SetClanTag("Needs"); break; }
case 15: { Local.SetClanTag("Needs("); break; }
case 16: { Local.SetClanTag("NeedsC"); break; }
case 17: { Local.SetClanTag("NeedsC0"); break; }
case 18: { Local.SetClanTag("NeedsCo"); break; }
case 19: { Local.SetClanTag("NeedsCo|"); break; }
case 20: { Local.SetClanTag("NeedsCo|2"); break; }
case 21: { Local.SetClanTag("NeedsCor"); break; }
case 22: { Local.SetClanTag("NeedsCor<"); break; }
case 23: { Local.SetClanTag("NeedsCor<|"); break; }
case 24: { Local.SetClanTag("NeedsCord"); break; }
case 25: { Local.SetClanTag("NeedsCord."); break; }
case 26: { Local.SetClanTag("NeedsCord.!"); break; }
case 27: { Local.SetClanTag("NeedsCord.j"); break; }
case 28: { Local.SetClanTag("NeedsCord.j$"); break; }
case 29: { Local.SetClanTag("NeedsCord.js"); break; }
case 30: { Local.SetClanTag("Help me"); break; }
case 31: { Local.SetClanTag("NeedsCord.js"); break; }
case 32: { Local.SetClanTag("NeedsCord.j$"); break; }
case 33: { Local.SetClanTag("NeedsCord.j"); break; }
case 34: { Local.SetClanTag("NeedsCord.!"); break; }
case 35: { Local.SetClanTag("NeedsCord."); break; }
case 36: { Local.SetClanTag("NeedsCord"); break; }
case 37: { Local.SetClanTag("NeedsCor<|"); break; }
case 38: { Local.SetClanTag("NeedsCor<"); break; }
case 39: { Local.SetClanTag("NeedsCor"); break; }
case 40: { Local.SetClanTag("NeedsCo|2"); break; }
case 41: { Local.SetClanTag("NeedsCo|"); break; }
case 42: { Local.SetClanTag("NeedsCo"); break; }
case 43: { Local.SetClanTag("NeedsC0"); break; }
case 44: { Local.SetClanTag("NeedsC"); break; }
case 45: { Local.SetClanTag("Needs("); break; }
case 46: { Local.SetClanTag("Needs"); break; }
case 47: { Local.SetClanTag("Need$"); break; }
case 48: { Local.SetClanTag("Need"); break; }
case 49: { Local.SetClanTag("Nee<|"); break; }
case 50: { Local.SetClanTag("Nee<"); break; }
case 51: { Local.SetClanTag("Nee"); break; }
case 52: { Local.SetClanTag("Ne3"); break; }
case 53: { Local.SetClanTag("Ne"); break; }
case 54: { Local.SetClanTag("N3"); break; }
case 55: { Local.SetClanTag("N"); break; }
case 56: { Local.SetClanTag("|\|"); break; }
case 57: { Local.SetClanTag("|\ "); break; }
case 58: { Local.SetClanTag("|"); break; }
case 59: { Local.SetClanTag("help me again"); break; }
case 60: { Local.SetClanTag(""); break; }
}
}
}
lasttime = time;
}


function ImportGrenades()
{
    var grenades = Entity.GetEntitiesByClassID(9).concat(Entity.GetEntitiesByClassID(114).concat(Entity.GetEntitiesByClassID(100)));
    for (e in grenades)
    {
        pass = false;
        for (g in positions)
        {
            if (positions[g][0] == grenades[e])
            {
                pass = true;
                continue;
            }
        }
        if (pass)
            continue;

        positions.push([grenades[e], Globals.Curtime(), [Entity.GetRenderOrigin(grenades[e])], Globals.Curtime()]);
    }
}


function GrenadeWarning()
{
    var grenades = Entity.GetEntitiesByClassID(9).concat(Entity.GetEntitiesByClassID(114).concat(Entity.GetEntitiesByClassID(100)));

    if (!Entity.IsAlive(local)) { return; }
  
    for (g in grenades) {
        for (var i = 0; i < grenades.length; i++) {
          
            var g = grenades[i];
            var isInferno = Entity.GetClassID(g) === 100;
            var isHeGrenade = Entity.GetClassID(g) === 9;

            /* --------------- */

            function DistanceInFeets (origin, destination) {
                var sub = [destination[0] - origin[0], destination[1] - origin[1], destination[2] - origin[2]];
                return Math.round(Math.sqrt(sub[0] ** 2 + sub[1] ** 2 + sub[2] ** 2) / 12);
                //return Math.round(sub[0] + sub[1] + sub[2]); // Для измерения в юнитах
            }

            /* --------------- */

            var destination = Entity.GetRenderOrigin(g);
            var origin = Entity.GetEyePosition(local);
            var distance = DistanceInFeets(origin, destination);
            var screen = Render.WorldToScreen(destination);
            var isSafe = distance > (isInferno ? 15 : 20) || trace[1] < 0.61;

            /* --------------- */

            if (distance > 256) { continue; }

            if (isHeGrenade && Entity.GetProp (g, "CBaseCSGrenadeProjectile", "m_nExplodeEffectTickBegin")) { continue; }

            /* --------------- */

            Render.FilledRect (screen[0] + 16, screen[1] - 12, 48, 24, clr[1]);

            Render.Polygon ([ [ screen[0] + 8,  screen[1] - 1 ], [ screen[0] + 16, screen[1] - 8 ], [ screen[0] + 16, screen[1] + 8 ] ], clr[1]);

            Render.String (screen[0] + 36, screen[1] - 5, 0, Math.round(distance / 3.28) + " m", clr[0], 3);
            Render.String (screen[0] + 20, screen[1] - 6, 0, isHeGrenade ? "I" : "K", isSafe ? clr[0] : clr[4], 6);

            /* --------------- */

            const warning_stroke = false; // true для красной обводки при опасности

            Render.Line ( screen[0] + 8, screen[1], screen[0] + 16, screen[1] - 8, !isSafe && warning_stroke ? clr[4] : clr[3])
            Render.Line ( screen[0] + 8, screen[1], screen[0] + 16, screen[1] + 8, !isSafe && warning_stroke ? clr[4] : clr[3])

            Render.Line ( screen[0] + 16, screen[1] - 12, screen[0] + 16, screen[1] - 7, !isSafe && warning_stroke ? clr[4] : clr[3])
            Render.Line ( screen[0] + 16, screen[1] + 12, screen[0] + 16, screen[1] + 8, !isSafe && warning_stroke ? clr[4] : clr[3])

            Render.Line ( screen[0] + 16, screen[1] - 12, screen[0] + 64, screen[1] - 12, !isSafe && warning_stroke ? clr[4] : clr[3])
            Render.Line ( screen[0] + 16, screen[1] + 12, screen[0] + 64, screen[1] + 12, !isSafe && warning_stroke ? clr[4] : clr[3])
            Render.Line ( screen[0] + 64, screen[1] + 12, screen[0] + 64, screen[1] - 12, !isSafe && warning_stroke ? clr[4] : clr[3])
          
            /* --------------- */

            if (isInferno)
            {
                var time = Entity.GetProp(g, "CInferno", "m_nFireEffectTickBegin") * Globals.TickInterval();
                var factor = Clamp(((time + 7) - Globals.Curtime()) / 7, 0, 7);
  
                Render.FilledRect(screen[0] + 16, screen[1] + 10, 48, 2, clr[2]);
                Render.FilledRect(screen[0] + 16, screen[1] + 10, Math.trunc(factor * 48), 2, clr[4]);
            }
        }
    }
}

function DrawNade()
{
if(UI.GetValue("Misc", "JAVASCRIPT", "Script items", "Nade warning"))
    {
    ImportGrenades();
    GrenadeWarning();
    }
}


function Main()
{
                  UI.AddLabel("------------Zalupa------------")
                  UI.AddCheckbox("legfucker");
                  UI.AddLabel("----------Indicators----------")
    UI.AddCheckbox("Nade warning")           
                  UI.AddLabel("--------------Misca--------------")
                  UI.AddCheckbox( "Clantag")

                  
// callbacks
                Global.RegisterCallback("Draw", "DrawNade");
                Global.RegisterCallback("CreateMove", "anim");
}
Main();
 
Сверху Снизу