Вопрос Хелпаните с анимацией логов

Государственная служба РФ
Пользователь
Статус
Оффлайн
Регистрация
26 Дек 2018
Сообщения
361
Реакции[?]
70
Поинты[?]
0
Короче, хочу сделать я анимацию на выдвижение и убирание логов, но я тупой как бублик. (otc3)

Вот типо крутой код:
JavaScript:
UI.AddCheckbox("Logs");
UI.AddColorPicker("Color (logs)");

//ShadowSting
Render.ShadowString = function(x, y, align, text, color, alha_text, alpha_shadow, font, custom) {
    if (custom == 1) {
        Render.StringCustom(x, y, align, text, [color[0], color[1], color[2], alha_text], font);
    } else {
        Render.StringCustom(x, y, align, text, [color, color, color, alha_text], font);
    }
    Render.StringCustom(x + 3, y + 3, align, text, [0, 0, 0, alpha_shadow], font);
}

//getcol
getcol = function(col) {
    return UI.GetColor("Script items", col);
}

//Logs
var logs = [];

const log = function(text, tick, curtime, alpha, alpha2){
    this.text = text
    this.tick = tick
    this.curtime = curtime
    this.alpha = alpha
    this.alpha2 = alpha2
}

const hitboxes = [ "generic", "head", "chest", "stomach", "pelvis", "right arm", "left arm", "right legs", "left legs", "body" ];

const get_hitbox = function(i){ return hitboxes[i] || "Generic" };

const hitlogs = function(){
    const color = getcol("Color (logs)");
    const uid = Entity.GetEntityFromUserID(Event.GetInt("userid"));
    const attaker = Entity.GetEntityFromUserID(Event.GetInt("attacker"));
    const hl = Event.GetInt("health");
    const text_harmed = "hurmed by " + Entity.GetName(attaker) + " for " + Event.GetInt("dmg_health") + " in " + get_hitbox(Event.GetInt("hitgroup"));
    const text_hurt = "hurt " + Entity.GetName(uid) + " for " + Event.GetInt("dmg_health") + " in " + get_hitbox(Event.GetInt("hitgroup"));
    const text_kill = "killed " + Entity.GetName(uid) + " in " + get_hitbox(Event.GetInt("hitgroup"));

    if (UI.GetValue("Script items", "Logs")) {

        if (Entity.IsLocalPlayer(uid) && attaker != uid) {
            Cheat.PrintColor([color[0], color[1], color[2], 255], "[CSGO TOP1] ");
            Cheat.PrintColor([255, 255, 255, 255], text_harmed + "\n");
            logs.push(new log(text_harmed, Globals.Tickcount(), Globals.Curtime(), 255, 35));
        }

        if (Entity.IsLocalPlayer(attaker) && attaker != uid && hl > 0) {
            Cheat.PrintColor([color[0], color[1], color[2], 255], "[CSGO TOP1] ");
            Cheat.PrintColor([255, 255, 255, 255], text_hurt + "\n");
            logs.push(new log(text_hurt, Globals.Tickcount(), Globals.Curtime(), 255, 35));
        }

        if (Entity.IsLocalPlayer(attaker) && attaker != uid && hl < 1) {
            Cheat.PrintColor([color[0], color[1], color[2], 255], "[CSGO TOP1] ");
            Cheat.PrintColor([255, 255, 255, 255], text_kill + "\n");
            logs.push(new log(text_kill, Globals.Tickcount(), Globals.Curtime(), 255, 35));
        }
    }
}

const buylogs = function(){
    const color = getcol("Color (logs)");

    if (UI.GetValue("Script items", "Logs")) {
        if (Event.GetInt('team') != Entity.GetProp(Entity.GetLocalPlayer(), "CBaseEntity", "m_iTeamNum")) {
            var uid = Entity.GetEntityFromUserID(Event.GetInt("userid"));
            var item = Event.GetString('weapon')
            item = item.replace("weapon_", "")
            item = item.replace("item_", "")
            item = item.replace("assaultsuit", "kevlar + helmet")
            item = item.replace("incgrenade", "molotov")

            if (item != "unknown") {
                const text_buy = Entity.GetName(uid) + " bought " + item;
                Cheat.PrintColor([color[0], color[1], color[2], 255], "[CSGO TOP1] ");
                Cheat.PrintColor([255, 255, 255, 255], text_buy + "\n");
                logs.push(new log(text_buy, Globals.Tickcount(), Globals.Curtime(), 255, 35));
            }
        }
    }
}


const draw_log = function(){
    const color = getcol("Color (logs)");
    const font = Render.AddFont("Lucida Console", 8, 0);

    if (logs[0].curtime + 4 < Globals.Curtime()) {
        logs[0].alpha -= Globals.Frametime() * 255;
        logs[0].alpha2 -= Globals.Frametime() * 35;
    }

    if (logs[0].alpha < 0 || logs.length > 14) {
       logs.shift();
    }

    for (var i in logs) {
        if (!Entity.IsAlive(Entity.GetLocalPlayer()) || !UI.GetValue("Script items", "Logs")) {
            logs[i].alpha -= Globals.Frametime() * 635;
            logs[i].alpha2 -= Globals.Frametime() * 35;
        }

        if (logs[i].alpha <= 0) {
            logs[i].shift();
        }

        Render.ShadowString(5, 5 - (i * -14), 0, "[CSGO TOP1] ", color, logs[i].alpha, logs[i].alpha2, font, 1)
        Render.ShadowString(85, 5 - (i * -14), 0, logs[i].text, 255, logs[i].alpha, logs[i].alpha2, font, 0)
    }
}

Cheat.RegisterCallback("item_purchase", "buylogs");
Cheat.RegisterCallback("player_hurt", "hitlogs");
Cheat.RegisterCallback("Draw", "draw_log");
 
Последнее редактирование:
Сверху Снизу