Загрузка данных
-- HUD_kdm1eHvH.lua
-- Положи в lua/autorun/client/HUD_kdm1eHvH.lua
local MAP_SIZE = 200
local MAP_MARGIN = 20
local WORLD_SIZE = 16384
local PANEL_GAP = 10
-- ============ Отключение HUD DarkRP ============
hook.Add("InitPostEntity", "OverrideDarkRPHUD", function()
timer.Simple(2, function()
if not GAMEMODE then return end
GAMEMODE.HUDPaint = function() end
GAMEMODE.HUDPaintBackground = function() end
end)
end)
-- ============ Шрифты ============
surface.CreateFont("hud_logo_big", {
font = "Montserrat", size = 32, weight = 900, extended = true
})
surface.CreateFont("hud_logo_small", {
font = "Montserrat", size = 14, weight = 600, extended = true
})
surface.CreateFont("hud_label", {
font = "Montserrat", size = 15, weight = 600, extended = true
})
surface.CreateFont("hud_value", {
font = "Montserrat", size = 20, weight = 800, extended = true
})
surface.CreateFont("hud_hp", {
font = "Montserrat", size = 14, weight = 800, extended = true
})
surface.CreateFont("hud_ammo_big", {
font = "Montserrat", size = 36, weight = 900, extended = true
})
surface.CreateFont("hud_ammo_small", {
font = "Montserrat", size = 16, weight = 600, extended = true
})
-- ============ Цвета ============
local ACCENT = Color(220, 40, 40)
local ACCENT_DARK = Color(140, 20, 20)
local BG = Color(12, 12, 18, 230)
local BG_LIGHT = Color(24, 24, 32, 235)
local TEXT = Color(235, 235, 235)
local TEXT_DIM = Color(150, 150, 160)
local TEXT_BRIGHT = Color(255, 255, 255)
-- ============ Миникарта ============
local function DrawMinimap(x, y, w, h)
-- Тень
surface.SetDrawColor(0, 0, 0, 150)
surface.DrawRect(x + 3, y + 3, w, h)
-- Фон
surface.SetDrawColor(BG)
surface.DrawRect(x, y, w, h)
-- Верхняя красная полоса
surface.SetDrawColor(ACCENT)
surface.DrawRect(x, y, w, 3)
-- Рамка
surface.SetDrawColor(60, 60, 80, 200)
surface.DrawOutlinedRect(x, y, w, h, 1)
local scaleX = w / WORLD_SIZE
local scaleY = h / WORLD_SIZE
local lp = LocalPlayer()
for _, ply in ipairs(player.GetAll()) do
if not IsValid(ply) then continue end
local pos = ply:GetPos()
local px = x + (pos.x + WORLD_SIZE / 2) * scaleX
local py = y + (WORLD_SIZE / 2 - pos.y) * scaleY
if px < x or px > x + w or py < y or py > y + h then continue end
if ply == lp then
local ang = lp:EyeAngles().yaw
local rad = math.rad(ang)
local dx = math.sin(rad)
local dy = -math.cos(rad)
local px_dir = -dy
local py_dir = dx
local size = 6
local tipX = px + dx * size
local tipY = py + dy * size
local leftX = px - dx * size * 0.5 + px_dir * size * 0.6
local leftY = py - dy * size * 0.5 + py_dir * size * 0.6
local rightX = px - dx * size * 0.5 - px_dir * size * 0.6
local rightY = py - dy * size * 0.5 - py_dir * size * 0.6
surface.SetDrawColor(80, 255, 120)
surface.DrawPoly({
{ x = tipX, y = tipY },
{ x = leftX, y = leftY },
{ x = rightX, y = rightY },
})
elseif ply:Team() == lp:Team() then
surface.SetDrawColor(100, 170, 255)
surface.DrawRect(px - 2, py - 2, 4, 4)
else
surface.SetDrawColor(255, 70, 70)
surface.DrawRect(px - 2, py - 2, 4, 4)
end
end
end
-- ============ Полоска HP ============
local function DrawHealthBar(x, y, w, h, hp, maxhp)
local frac = math.Clamp(hp / maxhp, 0, 1)
surface.SetDrawColor(0, 0, 0, 200)
surface.DrawRect(x, y, w, h)
local r = math.Round(255 * (1 - frac))
local g = math.Round(220 * frac)
surface.SetDrawColor(r, g, 40, 240)
surface.DrawRect(x + 1, y + 1, (w - 2) * frac, h - 2)
surface.SetDrawColor(255, 255, 255, 70)
surface.DrawOutlinedRect(x, y, w, h, 1)
draw.SimpleText(
math.max(0, math.floor(hp)) .. " HP",
"hud_hp",
x + w / 2, y + h / 2,
Color(255, 255, 255),
TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER
)
end
-- ============ HUD патронов ============
local function DrawAmmoHUD()
local ply = LocalPlayer()
local wep = ply:GetActiveWeapon()
if not IsValid(wep) then return end
local clip = wep:Clip1()
local reserve = ply:GetAmmoCount(wep:GetPrimaryAmmoType())
if clip < 0 and reserve < 0 then return end
local boxW, boxH = 200, 90
local boxX = ScrW() - boxW - MAP_MARGIN
local boxY = ScrH() - boxH - MAP_MARGIN
-- Тень
surface.SetDrawColor(0, 0, 0, 150)
surface.DrawRect(boxX + 3, boxY + 3, boxW, boxH)
-- Фон
surface.SetDrawColor(BG)
surface.DrawRect(boxX, boxY, boxW, boxH)
-- Красная полоса сверху
surface.SetDrawColor(ACCENT)
surface.DrawRect(boxX, boxY, boxW, 3)
-- Рамка
surface.SetDrawColor(60, 60, 80, 200)
surface.DrawOutlinedRect(boxX, boxY, boxW, boxH, 1)
-- Название оружия
draw.SimpleText(
wep:GetPrintName() or wep:GetClass(),
"hud_ammo_small",
boxX + boxW / 2, boxY + 12,
TEXT_DIM,
TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP
)
-- Обойма (крупно)
draw.SimpleText(
tostring(clip),
"hud_ammo_big",
boxX + boxW / 2 - 25, boxY + 38,
TEXT_BRIGHT,
TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP
)
-- Слэш
draw.SimpleText(
"/",
"hud_ammo_big",
boxX + boxW / 2 + 8, boxY + 42,
Color(100, 100, 110),
TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP
)
-- Запас
draw.SimpleText(
tostring(reserve),
"hud_ammo_big",
boxX + boxW / 2 + 42, boxY + 38,
Color(200, 200, 200),
TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP
)
end
-- ============ Логотип справа сверху ============
local function DrawLogo()
local x = ScrW() - MAP_MARGIN
local y = MAP_MARGIN
-- kdm1e (белый)
local t1 = "kdm1e"
local t2 = "HvH"
surface.SetFont("hud_logo_big")
local w1 = surface.GetTextSize(t1)
local w2 = surface.GetTextSize(t2)
local totalW = w1 + w2
-- Тень под текстом
draw.SimpleText(t1, "hud_logo_big", x - totalW + 2, y + 2, Color(0, 0, 0, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(t2, "hud_logo_big", x - totalW + w1 + 2, y + 2, Color(0, 0, 0, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
-- Основной текст
draw.SimpleText(t1, "hud_logo_big", x - totalW, y, TEXT_BRIGHT, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(t2, "hud_logo_big", x - totalW + w1, y, ACCENT, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
-- Подпись Beta - Test (меньше и ниже)
surface.SetFont("hud_logo_small")
local subW = surface.GetTextSize("Beta - Test")
draw.SimpleText(
"Beta - Test",
"hud_logo_small",
x - subW, y + 38,
Color(150, 150, 160),
TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP
)
end
-- ============ Основной HUD ============
hook.Add("HUDPaint", "MyCustomHUD", function()
local ply = LocalPlayer()
if not IsValid(ply) then return end
local mapX = MAP_MARGIN
local mapY = ScrH() - MAP_SIZE - MAP_MARGIN
DrawMinimap(mapX, mapY, MAP_SIZE, MAP_SIZE)
-- Инфо-панель справа от карты
local boxX = mapX + MAP_SIZE + PANEL_GAP
local boxY = mapY
local boxW = 240
local boxH = MAP_SIZE
-- Тень
surface.SetDrawColor(0, 0, 0, 150)
surface.DrawRect(boxX + 3, boxY + 3, boxW, boxH)
-- Фон
surface.SetDrawColor(BG)
surface.DrawRect(boxX, boxY, boxW, boxH)
-- Красная полоса
surface.SetDrawColor(ACCENT)
surface.DrawRect(boxX, boxY, boxW, 3)
-- Рамка
surface.SetDrawColor(60, 60, 80, 200)
surface.DrawOutlinedRect(boxX, boxY, boxW, boxH, 1)
-- Ник
draw.SimpleText("НИК", "hud_label", boxX + 14, boxY + 14, TEXT_DIM, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(ply:Nick(), "hud_value", boxX + 14, boxY + 34, TEXT_BRIGHT, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
-- Разделитель
surface.SetDrawColor(255, 255, 255, 25)
surface.DrawRect(boxX + 12, boxY + 68, boxW - 24, 1)
-- Убийства
draw.SimpleText("УБИЙСТВА", "hud_label", boxX + 14, boxY + 80, TEXT_DIM, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
draw.SimpleText(
tostring(ply:GetNWInt("PersistentKills", ply:Frags())),
"hud_value",
boxX + 14, boxY + 100,
ACCENT,
TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP
)
-- Разделитель
surface.SetDrawColor(255, 255, 255, 25)
surface.DrawRect(boxX + 12, boxY + 134, boxW - 24, 1)
-- Здоровье
draw.SimpleText("ЗДОРОВЬЕ", "hud_label", boxX + 14, boxY + 146, TEXT_DIM, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
DrawHealthBar(boxX + 14, boxY + 166, boxW - 28, 20, ply:Health(), ply:GetMaxHealth())
-- HUD патронов
DrawAmmoHUD()
-- Логотип справа сверху
DrawLogo()
end)
-- ============ Скрываем стандартный HUD GMod ============
hook.Add("HUDShouldDraw", "HideDefaultHUD", function(name)
if name == "CHudHealth" then return false end
if name == "CHudBattery" then return false end
if name == "CHudAmmo" then return false end
if name == "CHudSecondaryAmmo" then return false end
end)
print("[kdm1eHvH] HUD загружен")