JS-скрипт [weave] Logs.

Эксперт
Статус
Оффлайн
Регистрация
22 Мар 2020
Сообщения
2,187
Реакции[?]
484
Поинты[?]
3K
Первоначальный креатеор prince1337
Код:
ui.add_checkbox("Enable Logs","logso")
var logs = []

const log = function(text, time) {
    this.text = text
    this.time = time
}

const hitboxes = [ "generic", "head", "chest", "stomach", "left arm", "right arm", "left leg", "right leg", "body" ];
const get_hitbox = function(i){ return hitboxes[i] || "Generic" };

function hitlog() {
    var attacker = current_event.get_int("attacker");
    var enemy = current_event.get_int("userid");
    var enemy_index = entity.get_player_for_user_id(enemy);
    var enemy_name = entity.get_player_info(enemy_index)['name'];

    const text = "[weave] hurt " + enemy_name + " for " + current_event.get_int("dmg_health") + " in " + get_hitbox(current_event.get_int("hitgroup"))

    if(entity.get_local_player(attacker) && attacker != enemy) logs.push(new log(text, global_vars.tick_count()))
}

function draw() {
    if(!vars.get_bool("js.logso")) return

    for(var i in logs) {
        render.text([5, 5 - (i * -15)], [255, 255, 255, 255], 12, 0, logs[i].text)
            if(logs[i].time + 300 <  global_vars.tick_count()) logs.shift();
    }
}

register_callback("render", draw)
register_callback("player_hurt", hitlog)
 
Сверху Снизу