JS [ OTV4 ] Custom Hud

  • 258
  • 140
Дисклеймер:
Раунды и время правильно работают только в начале игры, тоесть если вы подсоеденились в какой-то момент игры кроме первого раунда, они пойду по пизде.
Худ довольно баганутый, всё пофиксить я не могу, поэтому да.
Вообще делал я его исключительно для опыта в джс.

Шрифты внизу
(Ватермарк и кейбинды в худ не входят)

1652719265494.png
hud.js:
var screen = Render.GetScreenSize();
UI.AddSubTab(["Visuals", "SUBTAB_MGR"], "Hud")
UI.AddSliderInt(["Visuals", "Hud", "Hud"], "Hud Health | X", 5, screen[0])
UI.AddSliderInt(["Visuals", "Hud", "Hud"], "Hud Health | Y", 5, screen[1])
UI.AddCheckbox(["Visuals", "Hud", "Hud"], "Enable other")
Convar.SetInt("cl_draw_only_deathnotices", 1)

function outLine(x, y, w, h, size1, size2, color) {
    Render.Line(x - 2, y - 2, x + w - 2, y - 2, color)
    Render.Line(x - 2, y - 2, x - 2, y + h - 2, color)

    Render.Line(x + size1 - w + 1, y - 2, x + size1 + 1 , y - 2, color)
    Render.Line(x + size1 + 1, y - 2, x + size1 + 1, y + h - 2, color)

    Render.Line(x - 2, y + size2 + 1, x + w - 2, y + size2 + 1, color)
    Render.Line(x - 2, y + size2 + 1, x - 2, y + size2 - h + 1, color)

    Render.Line(x + size1 - w + 1, y + size2 + 1, x + size1 + 1, y + size2 + 1, color)
    Render.Line(x + size1 + 1, y + size2 + 1, x + size1 + 1, y + size2 - h + 1, color)
}

var Render_StringShadow = function(x, y, centered, text, color, font) {
    Render.String(x - 1, y - 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x + 1, y - 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x - 1, y + 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x + 1, y + 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x, y, centered, text, color, font)
}

function health() {
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;
    var health = Entity.GetProp(local, "CPlayerResource", "m_iHealth");
    var font2 = Render.GetFont("Verdanab.ttf", 12, true)
    var font = Render.GetFont("OnetapFont Regular.ttf", 18, true)
    var x = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | X"])
    var y = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | Y"])
    var pos_h = [x, y]

    Render.FilledRect(pos_h[0] - 2, pos_h[1] - 2, 204, 24, [55, 55, 55, 155])
    outLine(pos_h[0], pos_h[1], 8, 8, 200, 20, [255, 255, 255, 255])
    Render.GradientRect(pos_h[0], pos_h[1], 2 * health, 20, 1, [0, 0, 0, 255], [170, 170, 170, 255])
    Render.String(pos_h[0] + 5, pos_h[1] + 2, 0, "N", [255, 255, 255, 255], font)
    Render.String(pos_h[0] + 198 - Render.TextSize(health.toString(), font2)[0], pos_h[1] + 2, 0, health.toString(), [255, 255, 255, 255], font2)
}

function armor() {
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;
    var armor = Entity.GetProp(local, 'CCSPlayerResource', 'm_iArmor');
    var font = Render.GetFont("Undefeated.ttf", 11, true)
    var x = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | X"])
    var y = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | Y"])

    if(armor > 0) {
        var pos_a = [x, y + 25]

        outLine(pos_a[0], pos_a[1] + 1, 4, 4, 0.8 * armor - 3, 11, [255, 255, 255, 255])
        Render.GradientRect(pos_a[0] - 1, pos_a[1], 0.8 * armor - 1, 13, 1, [0, 0, 0, 125], [0, 0, 0, 160])
        Render.String(pos_a[0] + 2, pos_a[1], 0, 'p', [255, 255, 255, 255], font)
    }
}

var timer = Globals.Curtime()
var period = Convar.GetFloat("mp_freezetime")
var roundTime = Entity.GetProp(Entity.GetGameRulesProxy(), "CCSGameRulesProxy", "m_iRoundTime") + period + 0.2
var color = [255, 255, 255, 255]
var enemy_cache = 0; var playedRound = 0;
var tRoundsCache = 0; var ctRoundsCache = 0;
var our = 0; var en = 0;
var enemyLength = 0; var localTeamLength = 0;

function round_start() {
    var enemies = Entity.GetEnemies();
    var players = Entity.GetPlayers()
    enemyLength = enemies.length
    localTeamLength = players.length - enemies.length
    playedRound = 0
    roundTime = Entity.GetProp(Entity.GetGameRulesProxy(), "CCSGameRulesProxy", "m_iRoundTime") + period + 0.2
    color = [255, 255, 255, 255]
}
function bomb_planted() {
    roundTime = Convar.GetFloat("mp_c4timer")
    color = [255, 81, 61, 255]
}
function round_end() {
    playedRound = Entity.GetProp(Entity.GetGameRulesProxy(), "CCSGameRulesProxy", "m_iMatchStats_RoundResults")

    if(playedRound == 1) ctRoundsCache++
    if(playedRound == 2) ctRoundsCache++
    if(playedRound == 3) ctRoundsCache++
    if(playedRound == 4) ctRoundsCache++
    if(playedRound == 5) tRoundsCache++
    if(playedRound == 6) tRoundsCache++
    if(playedRound == 7) tRoundsCache++
}
function getAlive() {
    var userid = Event.GetInt("userid")
    var attacker = Event.GetInt("attacker")
    var local = Entity.GetLocalPlayer()
    var teamAttacker = Entity.GetProp(attacker, "CCSPlayer", "m_iTeamNum")
    var localTeam = Entity.GetProp(Entity.GetLocalPlayer(), "CCSPlayer", "m_iTeamNum")
   
    if(attacker == userid && attacker == local + 1 ) { localTeamLength--; return}
    if(teamAttacker == localTeam) { localTeamLength--; return }
    if(teamAttacker !== localTeam) { enemyLength--; return }
}
var screen = Render.GetScreenSize()

function rounds() {
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;
    var minutes = Math.floor(Math.floor(roundTime) / 60)
    var seconds = (Math.floor(roundTime) % 60) < 10 ? "0" + (Math.floor(roundTime) % 60) : (Math.floor(roundTime) % 60)
    var enemies = Entity.GetEnemies();
    var localTeam = localTeamLength; var enemyTeam = enemyLength
    var team = Entity.GetProp(Entity.GetLocalPlayer(), "CCSPlayer", "m_iTeamNum")
    var teams = { 1: "Spectator", 2: "Terrorist", 3: "Counter-Terrorist" }
    var font = Render.GetFont("Verdanab.ttf", 17, true)
    var font2 = Render.GetFont("Verdanab.ttf", 9, true)

    for(var i in enemies) { enemies.length == 0 ? enemy_cache : enemy_cache = enemies[i] }

    Render.GradientRect((screen[0] / 2) + 24, screen[1] - 33, 26, 28, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) - 49, screen[1] - 33, 26, 28, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) - 20, screen[1] - 33, 41, 14, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) - 20, screen[1] - 18, 20.5, 14, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) + 1, screen[1] - 18, 20.5, 14, 1, [0, 0, 0, 125], [0, 0, 0, 160])

    if(team == 2) { our = tRoundsCache; en = ctRoundsCache }
    if(team == 3) { our = ctRoundsCache; en = tRoundsCache }

    for(var i in teams) {
        if(team == i) {
            Render_StringShadow((screen[0] / 2) - 42, screen[1] - 31, 0, localTeam.toString(), [255, 255, 255, 255], font)
            Render_StringShadow((screen[0] / 2) + 31, screen[1] - 31, 0, enemyTeam.toString(), [255, 255, 255, 255], font)
            Render_StringShadow((screen[0] / 2) - 13, screen[1] - 18, 0, our.toString(), [255, 255, 255, 255], font2)
            Render_StringShadow((screen[0] / 2) + 8, screen[1] - 18, 0, en.toString(), [255, 255, 255, 255], font2)
        }
    }

    Render_StringShadow((screen[0] / 2) - 10, screen[1] - 33, 0, minutes + ":" + seconds, color, font2)

    outLine((screen[0] / 2) - 48, screen[1] - 32, 4, 4, 97, 26, [255, 255, 255, 255])

    if(timer + 1 < Globals.Curtime()) {
        roundTime--
        timer = Globals.Curtime()
    }
}

function other() {
    if(!UI.GetValue(["Visuals", "Hud", "Hud", "Enable other"])) return;
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;

    var font = Render.GetFont("OnetapFont Regular.ttf", 20, true)
    var font2 = Render.GetFont("Verdanab.ttf", 9, true)
    var money = Entity.GetProp(local, "CCSPlayer", "m_iAccount");
    var weapons = Entity.GetWeapons(Entity.GetLocalPlayer())
    for(var i in weapons) {
        if(Entity.GetName(weapons[i]) == "c4 explosive") Render_StringShadow(10, 32, 0, "O", [255, 255, 255, 255], font)
    }
    Render_StringShadow(10, 10, 0, "$" + money, [147, 255, 120, 255], font2)
}

const mainWeapons = ['ak 47', 'aug', 'awp', 'famas', 'g3sg1', 'galil ar', 'm4a1 s', 'm4a4', 'scar 20', 'sg 553', 'ssg 08', 'mac 10', 'mp5 sd', 'mp7', 'mp9', 'pp bizon', 'p90', 'ump 45', 'mag 7', 'nova', 'sawed off','xm1014']
const pistols = ['cz75 auto', 'desert eagle', 'dual berettas', 'five seven', 'glock 18', 'p2000', 'p250', 'r8 revolver', 'tec 9', 'usp s']
const knifes = ['nomad knife', 'skeleton knife', 'survival knife', 'paracord knife', 'classic knife', 'bayonet', 'bowie knife', 'butterfly knife', 'falchion knife', 'flip knife', 'gut knife', 'huntsman knife', 'karambit', 'm9 bayonet', 'navaja knife', 'shadow daggers', 'stiletto knife', 'talon knife', 'ursus knife']
const grenades = ['high explosive grenade', 'incendiary grenade', 'decoy grenade', 'smoke grenade', 'flashbang', 'molotov']
const mainWeaponsIcons = {'ssg 08': 'a', 'xm1014': 'b', 'sawed off': 'c', 'mag 7': 'd', 'nova': 'e', 'negev': 'f', 'm249': 'g', 'mac 10': 'K', 'ump 45': 'L', 'pp bizon': 'M', 'mp7': 'N', 'mp9': 'O', 'p90': 'P', 'galil ar': 'Q', 'famas': 'R', 'm4a4': 'S', 'm4a1 s': 'T', 'aug': 'U', 'sg 553': 'V', 'ak 47': 'W', 'g3sg1': 'X', 'scar 20': 'Y', 'awp': 'Z' }
const pistolsIcons = {'desert eagle': 'A', 'dual berettas': 'B', 'five seven': 'C', 'glock 18': 'D', 'p2000': 'E', 'p250': 'F', 'usp s': 'G', 'tec 9': 'H', 'cz75 auto': 'I', 'r8 revolver': 'J'}
const knifesIcons = {'knife': 'G', 'bayonet': '1', 'flip knife': '2', 'gut knife': '3', 'karambit': '4', 'm9 bayonet': '5', 'huntsman knife': '6', 'bowie knife': '7', 'butterfly knife': '8', 'shadow daggers': '9', 'falchion knife': '0'}
const grenadesIcons = {'high explosive grenade': 'j', 'incendiary grenade': 'n', 'decoy grenade': 'm', 'smoke grenade': 'k', 'flashbang': 'i', 'molotov': 'l'}

function GetWeaponOut() {
    if (Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer())) == 'zeus x27') knifes.push('zeus x27')
    set = [mainWeapons, pistols, knifes, grenades]
    for (var s in set) {
        inverseColor(set[s], Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer())))
    }
}

var indext;
function inverseColor(arr, obj) {
    function inc() {
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] == obj) return true;
        }
    }

    if (arr == mainWeapons) index = 0;
    if (arr == pistols) index = 1;
    if (arr == knifes) index = 2;
    if (arr == grenades) index = 3;
    if (inc()) {
        indext = index
    }
}

function weapons() {
    var local = Entity.GetLocalPlayer()
    var mainWeaponIcon; var pistolIcon; var knifeIcon; var gGrenades = []
    var playerWeapons = Entity.GetWeapons(Entity.GetLocalPlayer())
    var curammo = Entity.GetProp(Entity.GetWeapon(local),"CBaseCombatWeapon" ,"m_iClip1");
    curammo = curammo < 0 ? 0 : curammo
    var restammo = Entity.GetProp(Entity.GetWeapon(local),"CBaseCombatWeapon" ,"m_iPrimaryReserveAmmoCount");
    var font = Render.GetFont("Undefeated.ttf", 18, true)
    var font1 = Render.GetFont("Verdanab.ttf", 13, true)
    var font2 = Render.GetFont("Verdanab.ttf", 11, true)
    var font3 = Render.GetFont("OnetapFont Regular.ttf", 26, true)
    var poses = {
        mainWeapon: [screen[0] - 100, screen[1] - 160],
        pistolWeapon: [screen[0] - 100, screen[1] - 130],
        knifeWeapon: [screen[0] - 100, screen[1] - 100],
        grenadeWeapon: [screen[0] - 100, screen[1] - 70],
        ammoWeapon: [screen[0] - 100, screen[1] - 40]
    }

    for (var inc in playerWeapons) {
        for (var m in mainWeapons) {
            if (Entity.GetName(playerWeapons[inc]).includes(mainWeapons[m])) {
                mainWeaponIcon = mainWeaponsIcons[mainWeapons[m]]
                Render.GradientRect(poses.mainWeapon[0], poses.mainWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
                Render.String(poses.mainWeapon[0] + 5, poses.mainWeapon[1] + 4, 0, mainWeaponIcon, [255, 255, 255, 255], font)
                Render.FilledRect(poses.mainWeapon[0] + 70, poses.mainWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.mainWeapon[0] + 74, poses.mainWeapon[1] + 5, 0, "1", [0, 0, 0, 255], font2)
                if(indext == 0) outLine(poses.mainWeapon[0], poses.mainWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }
        for (var p in pistols) {
            if (Entity.GetName(playerWeapons[inc]).includes(pistols[p])) {
                pistolIcon = pistolsIcons[pistols[p]]
                Render.GradientRect(poses.pistolWeapon[0], poses.pistolWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
                Render.String(poses.pistolWeapon[0] + 5, poses.pistolWeapon[1] + 4, 0, pistolIcon, [255, 255, 255, 255], font)
                Render.FilledRect(poses.pistolWeapon[0] + 70, poses.pistolWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.pistolWeapon[0] + 74, poses.pistolWeapon[1] + 5, 0, "2", [0, 0, 0, 255], font2)
                if(indext == 1) outLine(poses.pistolWeapon[0], poses.pistolWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }    
        for (var k in knifes) {
            if(Entity.GetName(playerWeapons[inc]).includes(knifes[k])) {
                knifeIcon = knifesIcons[knifes[k]]
                Render.GradientRect(poses.knifeWeapon[0], poses.knifeWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
                Render.String(poses.knifeWeapon[0] + 5, poses.knifeWeapon[1] + 4, 0, knifeIcon, [255, 255, 255, 255], font)
                Render.FilledRect(poses.knifeWeapon[0] + 70, poses.knifeWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.knifeWeapon[0] + 74, poses.knifeWeapon[1] + 5, 0, "3", [0, 0, 0, 255], font2)
                if(indext == 2) outLine(poses.knifeWeapon[0], poses.knifeWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }
        for (var g in grenades) {
            if(Entity.GetName(playerWeapons[inc]).includes(grenades[g])) {
                gGrenades.push(grenades[g])
                Render.GradientRect(poses.grenadeWeapon[0], poses.grenadeWeapon[1], 90, 25, 1, [0, 0, 0, 75], [0, 0, 0, 110])
                for (var gr in gGrenades) {
                    grenadeIcon = grenadesIcons[gGrenades[gr]]
                    Render.String(poses.grenadeWeapon[0] + 12 + 15 * gr, poses.grenadeWeapon[1] + 4, 1, grenadeIcon, [255, 255, 255, 255], font)
                }
                Render.FilledRect(poses.grenadeWeapon[0] + 70, poses.grenadeWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.grenadeWeapon[0] + 74, poses.grenadeWeapon[1] + 5, 0, "4", [0, 0, 0, 255], font2)
                if(indext == 3) outLine(poses.grenadeWeapon[0], poses.grenadeWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }
    }

    Render.GradientRect(poses.ammoWeapon[0], poses.ammoWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.String(poses.ammoWeapon[0] + 24, poses.ammoWeapon[1] + 3, 0, curammo + " | " + restammo, [255, 255, 255, 255], font1)
    Render.String(poses.ammoWeapon[0] + 8, poses.ammoWeapon[1] - 2, 0, "K", [255, 255, 255, 255], font3)
}

function unload() {
    Convar.SetInt("cl_draw_only_deathnotices", 0)
}

Cheat.RegisterCallback("Draw", "health");
Cheat.RegisterCallback("Draw", "armor");
Cheat.RegisterCallback("Draw", "rounds");
Cheat.RegisterCallback("Draw", "other");
Cheat.RegisterCallback("Draw", "weapons")

Cheat.RegisterCallback("player_death", "getAlive")
Cheat.RegisterCallback("round_start", "round_start")
Cheat.RegisterCallback("bomb_planted", "bomb_planted")
Cheat.RegisterCallback("round_end", "round_end")
Cheat.RegisterCallback("CreateMove", "GetWeaponOut")
Cheat.RegisterCallback("Unload", "unload")
[/i][/s][/i][/i]
 

Вложения

  • verdanab.zip
    159.2 KB · Просмотры: 74
  • 258
  • 140
Завтра сделаю чекбокс, чтобы можно было отключать элементы которые вам не нужны.
 
  • 431
  • 94
Дисклеймер:
Раунды и время правильно работают только в начале игры, тоесть если вы подсоеденились в какой-то момент игры кроме первого раунда, они пойду по пизде.
Худ довольно баганутый, всё пофиксить я не могу, поэтому да.
Вообще делал я его исключительно для опыта в джс.

Шрифты внизу
(Ватермарк и кейбинды в худ не входят)

hud.js:
var screen = Render.GetScreenSize();
UI.AddSubTab(["Visuals", "SUBTAB_MGR"], "Hud")
UI.AddSliderInt(["Visuals", "Hud", "Hud"], "Hud Health | X", 5, screen[0])
UI.AddSliderInt(["Visuals", "Hud", "Hud"], "Hud Health | Y", 5, screen[1])
UI.AddCheckbox(["Visuals", "Hud", "Hud"], "Enable other")
Convar.SetInt("cl_draw_only_deathnotices", 1)

function outLine(x, y, w, h, size1, size2, color) {
    Render.Line(x - 2, y - 2, x + w - 2, y - 2, color)
    Render.Line(x - 2, y - 2, x - 2, y + h - 2, color)

    Render.Line(x + size1 - w + 1, y - 2, x + size1 + 1 , y - 2, color)
    Render.Line(x + size1 + 1, y - 2, x + size1 + 1, y + h - 2, color)

    Render.Line(x - 2, y + size2 + 1, x + w - 2, y + size2 + 1, color)
    Render.Line(x - 2, y + size2 + 1, x - 2, y + size2 - h + 1, color)

    Render.Line(x + size1 - w + 1, y + size2 + 1, x + size1 + 1, y + size2 + 1, color)
    Render.Line(x + size1 + 1, y + size2 + 1, x + size1 + 1, y + size2 - h + 1, color)
}

var Render_StringShadow = function(x, y, centered, text, color, font) {
    Render.String(x - 1, y - 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x + 1, y - 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x - 1, y + 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x + 1, y + 1, centered, text, [0, 0, 0, 255], font)
    Render.String(x, y, centered, text, color, font)
}

function health() {
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;
    var health = Entity.GetProp(local, "CPlayerResource", "m_iHealth");
    var font2 = Render.GetFont("Verdanab.ttf", 12, true)
    var font = Render.GetFont("OnetapFont Regular.ttf", 18, true)
    var x = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | X"])
    var y = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | Y"])
    var pos_h = [x, y]

    Render.FilledRect(pos_h[0] - 2, pos_h[1] - 2, 204, 24, [55, 55, 55, 155])
    outLine(pos_h[0], pos_h[1], 8, 8, 200, 20, [255, 255, 255, 255])
    Render.GradientRect(pos_h[0], pos_h[1], 2 * health, 20, 1, [0, 0, 0, 255], [170, 170, 170, 255])
    Render.String(pos_h[0] + 5, pos_h[1] + 2, 0, "N", [255, 255, 255, 255], font)
    Render.String(pos_h[0] + 198 - Render.TextSize(health.toString(), font2)[0], pos_h[1] + 2, 0, health.toString(), [255, 255, 255, 255], font2)
}

function armor() {
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;
    var armor = Entity.GetProp(local, 'CCSPlayerResource', 'm_iArmor');
    var font = Render.GetFont("Undefeated.ttf", 11, true)
    var x = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | X"])
    var y = UI.GetValue(["Visuals", "Hud", "Hud", "Hud Health | Y"])

    if(armor > 0) {
        var pos_a = [x, y + 25]

        outLine(pos_a[0], pos_a[1] + 1, 4, 4, 0.8 * armor - 3, 11, [255, 255, 255, 255])
        Render.GradientRect(pos_a[0] - 1, pos_a[1], 0.8 * armor - 1, 13, 1, [0, 0, 0, 125], [0, 0, 0, 160])
        Render.String(pos_a[0] + 2, pos_a[1], 0, 'p', [255, 255, 255, 255], font)
    }
}

var timer = Globals.Curtime()
var period = Convar.GetFloat("mp_freezetime")
var roundTime = Entity.GetProp(Entity.GetGameRulesProxy(), "CCSGameRulesProxy", "m_iRoundTime") + period + 0.2
var color = [255, 255, 255, 255]
var enemy_cache = 0; var playedRound = 0;
var tRoundsCache = 0; var ctRoundsCache = 0;
var our = 0; var en = 0;
var enemyLength = 0; var localTeamLength = 0;

function round_start() {
    var enemies = Entity.GetEnemies();
    var players = Entity.GetPlayers()
    enemyLength = enemies.length
    localTeamLength = players.length - enemies.length
    playedRound = 0
    roundTime = Entity.GetProp(Entity.GetGameRulesProxy(), "CCSGameRulesProxy", "m_iRoundTime") + period + 0.2
    color = [255, 255, 255, 255]
}
function bomb_planted() {
    roundTime = Convar.GetFloat("mp_c4timer")
    color = [255, 81, 61, 255]
}
function round_end() {
    playedRound = Entity.GetProp(Entity.GetGameRulesProxy(), "CCSGameRulesProxy", "m_iMatchStats_RoundResults")

    if(playedRound == 1) ctRoundsCache++
    if(playedRound == 2) ctRoundsCache++
    if(playedRound == 3) ctRoundsCache++
    if(playedRound == 4) ctRoundsCache++
    if(playedRound == 5) tRoundsCache++
    if(playedRound == 6) tRoundsCache++
    if(playedRound == 7) tRoundsCache++
}
function getAlive() {
    var userid = Event.GetInt("userid")
    var attacker = Event.GetInt("attacker")
    var local = Entity.GetLocalPlayer()
    var teamAttacker = Entity.GetProp(attacker, "CCSPlayer", "m_iTeamNum")
    var localTeam = Entity.GetProp(Entity.GetLocalPlayer(), "CCSPlayer", "m_iTeamNum")
  
    if(attacker == userid && attacker == local + 1 ) { localTeamLength--; return}
    if(teamAttacker == localTeam) { localTeamLength--; return }
    if(teamAttacker !== localTeam) { enemyLength--; return }
}
var screen = Render.GetScreenSize()

function rounds() {
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;
    var minutes = Math.floor(Math.floor(roundTime) / 60)
    var seconds = (Math.floor(roundTime) % 60) < 10 ? "0" + (Math.floor(roundTime) % 60) : (Math.floor(roundTime) % 60)
    var enemies = Entity.GetEnemies();
    var localTeam = localTeamLength; var enemyTeam = enemyLength
    var team = Entity.GetProp(Entity.GetLocalPlayer(), "CCSPlayer", "m_iTeamNum")
    var teams = { 1: "Spectator", 2: "Terrorist", 3: "Counter-Terrorist" }
    var font = Render.GetFont("Verdanab.ttf", 17, true)
    var font2 = Render.GetFont("Verdanab.ttf", 9, true)

    for(var i in enemies) { enemies.length == 0 ? enemy_cache : enemy_cache = enemies[i] }

    Render.GradientRect((screen[0] / 2) + 24, screen[1] - 33, 26, 28, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) - 49, screen[1] - 33, 26, 28, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) - 20, screen[1] - 33, 41, 14, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) - 20, screen[1] - 18, 20.5, 14, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.GradientRect((screen[0] / 2) + 1, screen[1] - 18, 20.5, 14, 1, [0, 0, 0, 125], [0, 0, 0, 160])

    if(team == 2) { our = tRoundsCache; en = ctRoundsCache }
    if(team == 3) { our = ctRoundsCache; en = tRoundsCache }

    for(var i in teams) {
        if(team == i) {
            Render_StringShadow((screen[0] / 2) - 42, screen[1] - 31, 0, localTeam.toString(), [255, 255, 255, 255], font)
            Render_StringShadow((screen[0] / 2) + 31, screen[1] - 31, 0, enemyTeam.toString(), [255, 255, 255, 255], font)
            Render_StringShadow((screen[0] / 2) - 13, screen[1] - 18, 0, our.toString(), [255, 255, 255, 255], font2)
            Render_StringShadow((screen[0] / 2) + 8, screen[1] - 18, 0, en.toString(), [255, 255, 255, 255], font2)
        }
    }

    Render_StringShadow((screen[0] / 2) - 10, screen[1] - 33, 0, minutes + ":" + seconds, color, font2)

    outLine((screen[0] / 2) - 48, screen[1] - 32, 4, 4, 97, 26, [255, 255, 255, 255])

    if(timer + 1 < Globals.Curtime()) {
        roundTime--
        timer = Globals.Curtime()
    }
}

function other() {
    if(!UI.GetValue(["Visuals", "Hud", "Hud", "Enable other"])) return;
    var local = Entity.GetLocalPlayer();
    if(!Entity.IsAlive(local)) return;

    var font = Render.GetFont("OnetapFont Regular.ttf", 20, true)
    var font2 = Render.GetFont("Verdanab.ttf", 9, true)
    var money = Entity.GetProp(local, "CCSPlayer", "m_iAccount");
    var weapons = Entity.GetWeapons(Entity.GetLocalPlayer())
    for(var i in weapons) {
        if(Entity.GetName(weapons[i]) == "c4 explosive") Render_StringShadow(10, 32, 0, "O", [255, 255, 255, 255], font)
    }
    Render_StringShadow(10, 10, 0, "$" + money, [147, 255, 120, 255], font2)
}

const mainWeapons = ['ak 47', 'aug', 'awp', 'famas', 'g3sg1', 'galil ar', 'm4a1 s', 'm4a4', 'scar 20', 'sg 553', 'ssg 08', 'mac 10', 'mp5 sd', 'mp7', 'mp9', 'pp bizon', 'p90', 'ump 45', 'mag 7', 'nova', 'sawed off','xm1014']
const pistols = ['cz75 auto', 'desert eagle', 'dual berettas', 'five seven', 'glock 18', 'p2000', 'p250', 'r8 revolver', 'tec 9', 'usp s']
const knifes = ['nomad knife', 'skeleton knife', 'survival knife', 'paracord knife', 'classic knife', 'bayonet', 'bowie knife', 'butterfly knife', 'falchion knife', 'flip knife', 'gut knife', 'huntsman knife', 'karambit', 'm9 bayonet', 'navaja knife', 'shadow daggers', 'stiletto knife', 'talon knife', 'ursus knife']
const grenades = ['high explosive grenade', 'incendiary grenade', 'decoy grenade', 'smoke grenade', 'flashbang', 'molotov']
const mainWeaponsIcons = {'ssg 08': 'a', 'xm1014': 'b', 'sawed off': 'c', 'mag 7': 'd', 'nova': 'e', 'negev': 'f', 'm249': 'g', 'mac 10': 'K', 'ump 45': 'L', 'pp bizon': 'M', 'mp7': 'N', 'mp9': 'O', 'p90': 'P', 'galil ar': 'Q', 'famas': 'R', 'm4a4': 'S', 'm4a1 s': 'T', 'aug': 'U', 'sg 553': 'V', 'ak 47': 'W', 'g3sg1': 'X', 'scar 20': 'Y', 'awp': 'Z' }
const pistolsIcons = {'desert eagle': 'A', 'dual berettas': 'B', 'five seven': 'C', 'glock 18': 'D', 'p2000': 'E', 'p250': 'F', 'usp s': 'G', 'tec 9': 'H', 'cz75 auto': 'I', 'r8 revolver': 'J'}
const knifesIcons = {'knife': 'G', 'bayonet': '1', 'flip knife': '2', 'gut knife': '3', 'karambit': '4', 'm9 bayonet': '5', 'huntsman knife': '6', 'bowie knife': '7', 'butterfly knife': '8', 'shadow daggers': '9', 'falchion knife': '0'}
const grenadesIcons = {'high explosive grenade': 'j', 'incendiary grenade': 'n', 'decoy grenade': 'm', 'smoke grenade': 'k', 'flashbang': 'i', 'molotov': 'l'}

function GetWeaponOut() {
    if (Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer())) == 'zeus x27') knifes.push('zeus x27')
    set = [mainWeapons, pistols, knifes, grenades]
    for (var s in set) {
        inverseColor(set[s], Entity.GetName(Entity.GetWeapon(Entity.GetLocalPlayer())))
    }
}

var indext;
function inverseColor(arr, obj) {
    function inc() {
        for (var i = 0; i < arr.length; i++) {
            if (arr[i] == obj) return true;
        }
    }

    if (arr == mainWeapons) index = 0;
    if (arr == pistols) index = 1;
    if (arr == knifes) index = 2;
    if (arr == grenades) index = 3;
    if (inc()) {
        indext = index
    }
}

function weapons() {
    var local = Entity.GetLocalPlayer()
    var mainWeaponIcon; var pistolIcon; var knifeIcon; var gGrenades = []
    var playerWeapons = Entity.GetWeapons(Entity.GetLocalPlayer())
    var curammo = Entity.GetProp(Entity.GetWeapon(local),"CBaseCombatWeapon" ,"m_iClip1");
    curammo = curammo < 0 ? 0 : curammo
    var restammo = Entity.GetProp(Entity.GetWeapon(local),"CBaseCombatWeapon" ,"m_iPrimaryReserveAmmoCount");
    var font = Render.GetFont("Undefeated.ttf", 18, true)
    var font1 = Render.GetFont("Verdanab.ttf", 13, true)
    var font2 = Render.GetFont("Verdanab.ttf", 11, true)
    var font3 = Render.GetFont("OnetapFont Regular.ttf", 26, true)
    var poses = {
        mainWeapon: [screen[0] - 100, screen[1] - 160],
        pistolWeapon: [screen[0] - 100, screen[1] - 130],
        knifeWeapon: [screen[0] - 100, screen[1] - 100],
        grenadeWeapon: [screen[0] - 100, screen[1] - 70],
        ammoWeapon: [screen[0] - 100, screen[1] - 40]
    }

    for (var inc in playerWeapons) {
        for (var m in mainWeapons) {
            if (Entity.GetName(playerWeapons[inc]).includes(mainWeapons[m])) {
                mainWeaponIcon = mainWeaponsIcons[mainWeapons[m]]
                Render.GradientRect(poses.mainWeapon[0], poses.mainWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
                Render.String(poses.mainWeapon[0] + 5, poses.mainWeapon[1] + 4, 0, mainWeaponIcon, [255, 255, 255, 255], font)
                Render.FilledRect(poses.mainWeapon[0] + 70, poses.mainWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.mainWeapon[0] + 74, poses.mainWeapon[1] + 5, 0, "1", [0, 0, 0, 255], font2)
                if(indext == 0) outLine(poses.mainWeapon[0], poses.mainWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }
        for (var p in pistols) {
            if (Entity.GetName(playerWeapons[inc]).includes(pistols[p])) {
                pistolIcon = pistolsIcons[pistols[p]]
                Render.GradientRect(poses.pistolWeapon[0], poses.pistolWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
                Render.String(poses.pistolWeapon[0] + 5, poses.pistolWeapon[1] + 4, 0, pistolIcon, [255, 255, 255, 255], font)
                Render.FilledRect(poses.pistolWeapon[0] + 70, poses.pistolWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.pistolWeapon[0] + 74, poses.pistolWeapon[1] + 5, 0, "2", [0, 0, 0, 255], font2)
                if(indext == 1) outLine(poses.pistolWeapon[0], poses.pistolWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }   
        for (var k in knifes) {
            if(Entity.GetName(playerWeapons[inc]).includes(knifes[k])) {
                knifeIcon = knifesIcons[knifes[k]]
                Render.GradientRect(poses.knifeWeapon[0], poses.knifeWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
                Render.String(poses.knifeWeapon[0] + 5, poses.knifeWeapon[1] + 4, 0, knifeIcon, [255, 255, 255, 255], font)
                Render.FilledRect(poses.knifeWeapon[0] + 70, poses.knifeWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.knifeWeapon[0] + 74, poses.knifeWeapon[1] + 5, 0, "3", [0, 0, 0, 255], font2)
                if(indext == 2) outLine(poses.knifeWeapon[0], poses.knifeWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }
        for (var g in grenades) {
            if(Entity.GetName(playerWeapons[inc]).includes(grenades[g])) {
                gGrenades.push(grenades[g])
                Render.GradientRect(poses.grenadeWeapon[0], poses.grenadeWeapon[1], 90, 25, 1, [0, 0, 0, 75], [0, 0, 0, 110])
                for (var gr in gGrenades) {
                    grenadeIcon = grenadesIcons[gGrenades[gr]]
                    Render.String(poses.grenadeWeapon[0] + 12 + 15 * gr, poses.grenadeWeapon[1] + 4, 1, grenadeIcon, [255, 255, 255, 255], font)
                }
                Render.FilledRect(poses.grenadeWeapon[0] + 70, poses.grenadeWeapon[1] + 5, 15, 15, [255, 255, 255, 255])
                Render.String(poses.grenadeWeapon[0] + 74, poses.grenadeWeapon[1] + 5, 0, "4", [0, 0, 0, 255], font2)
                if(indext == 3) outLine(poses.grenadeWeapon[0], poses.grenadeWeapon[1], 8, 10, 90, 25, [255, 255, 255, 255])
            }
        }
    }

    Render.GradientRect(poses.ammoWeapon[0], poses.ammoWeapon[1], 90, 25, 1, [0, 0, 0, 125], [0, 0, 0, 160])
    Render.String(poses.ammoWeapon[0] + 24, poses.ammoWeapon[1] + 3, 0, curammo + " | " + restammo, [255, 255, 255, 255], font1)
    Render.String(poses.ammoWeapon[0] + 8, poses.ammoWeapon[1] - 2, 0, "K", [255, 255, 255, 255], font3)
}

function unload() {
    Convar.SetInt("cl_draw_only_deathnotices", 0)
}

Cheat.RegisterCallback("Draw", "health");
Cheat.RegisterCallback("Draw", "armor");
Cheat.RegisterCallback("Draw", "rounds");
Cheat.RegisterCallback("Draw", "other");
Cheat.RegisterCallback("Draw", "weapons")

Cheat.RegisterCallback("player_death", "getAlive")
Cheat.RegisterCallback("round_start", "round_start")
Cheat.RegisterCallback("bomb_planted", "bomb_planted")
Cheat.RegisterCallback("round_end", "round_end")
Cheat.RegisterCallback("CreateMove", "GetWeaponOut")
Cheat.RegisterCallback("Unload", "unload")
[/i][/s][/i][/i]


Работа хорошая , но код засран слегка.
 
Сверху Снизу