-- постоянное
local Health = 0 -- здоровье 0
local avka = vgui.Create("AvatarImage", frame) -- аватарка
local icon = Material("icon16/accept.png") -- иконка лицухи
local function hudPaint()
-- базовая х****ня
local x, y = 10, ScrH() - 20
local ply = LocalPlayer()
--визуал
draw.RoundedBox(6, x + 4, y - 25, 150 - 8, 15, Color(0,0,0,200)) -- голод
draw.RoundedBox(6, x + 4, y - 45, 150 - 8, 15, Color(0,0,0,200)) -- броня
draw.RoundedBox(6, x + 4, y - 70, 150 - 8, 20, Color(0,0,0,200)) -- хп
draw.RoundedBox(6, x + 4, y - 5, 230 - 8, 20, Color(255,255,255,100)) -- лицензия бабло зарплата
draw.RoundedBox(1, x + 4, y - 100, 230 - 8, 25, Color(0,0,0,200)) -- название профы
draw.RoundedBox(0, ScrW() - 120, ScrH() - 40, 100, 30, Color (0,0,0,200), ALIGN_RIGHT) -- патроны
--полоска ХП
Health = math.min(100, (Health == ply:Health() and Health) or Lerp(0.1, Health, ply:Health()))
local DrawHealth = math.Min(Health / GAMEMODE.Config.startinghealth, 1)
draw.RoundedBox(6, x + 5, y - 69, (150 - 9) * DrawHealth, 18, Color(140,0,0,180))
--полоска броньки
local armor = ply:Armor()
if armor ~= 0 then
draw.RoundedBox(6, x + 4, y - 45, (150 - 9) * armor / 100, 15, Color(0, 0, 200, 50))
end
-- Попытка сделать голод (!!) может выдавать эроры
local food = LocalPlayer().DarkRPVars.Energy
if not DarkRP.disabledDefaults["modules"]["hungermod"] and food ~= nil then
draw.RoundedBox(6, x + 4, y - 25, (150 - 9) * food / 100, 15, Color(255, 190, 0, 180))
end
-- авка
avka:SetPos(165,ScrH() - 92)
avka:SetSize(64, 64)
avka:SetPlayer( LocalPlayer(), 32 )
-- 🗎 лицуха
if ply:getDarkRPVar("HasGunlicense") then
surface.SetDrawColor(color_white)
surface.SetMaterial(icon)
surface.DrawTexturedRect(20,ScrH() - 22,15,15)
end
-- попытка в ком час
if GetGlobalBool("DarkRP_LockDown") then
draw.RoundedBox(0, ScrW() - 480, 23, 470, 30, Color (math.random(50,70),40,math.random(50,70),180), ALIGN_RIGHT)
draw.DrawText("Внимание! В городе объявлен Комендантский Час.","DarkRPHUD2", ScrW() - 20, 25,Color(255,255,255),TEXT_ALIGN_RIGHT)
end
-- аммобар может выдавать эроры
if IsValid(ply:GetActiveWeapon()) then
draw.DrawText(math.Max(0, math.Round(LocalPlayer():GetActiveWeapon():Clip1())) .. " / " .. math.Max(0, math.Round(LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType()))), "DarkRPHUD2", ScrW() - 110, ScrH() - 37, Color(255, 255, 255, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) -- патроны
else
draw.DrawText("Безоружен", "DarkRPHUD2", ScrW() - 117, ScrH() - 37, Color(255, 255, 255, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)
end
-- дравтексты
draw.DrawText("❤", "DarkRPHUD2", x + 8, y - 73, Color(255, 255, 255, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) -- "Здоровье"
draw.DrawText("ҕроня", "DarkRPHUD2", x + 8, y - 53, Color(255, 255, 255, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) -- "броня"
draw.DrawText("голод", "DarkRPHUD2", x + 8, y - 32, Color(255, 255, 255, 200), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) -- "голод"
draw.DrawText(math.Max(0, math.Round(ply:Health())), "DarkRPHUD2", x + 4 + (250 - 8) / 2, y - 72, Color(255, 255, 255, 200), 1) -- ХП
draw.DrawText("Вас зовут: " .. ply:Nick(), "DarkRPHUD2", 20, ScrH()-145, Color(255, 255, 255, 255), 20) -- ник
draw.DrawText(LocalPlayer().DarkRPVars.job, "DarkRPHUD2", 20, ScrH()-120, Color(255, 255, 255, 255), 20) -- жоба
draw.SimpleText(LocalPlayer().DarkRPVars.money .. " ₽ ", "DarkRPHUD2", 45, ScrH() - 27, Color( 0, 200, 0, 255 ),TEXT_ALIGN_LEFT) -- деньги
draw.SimpleText(" + " .. LocalPlayer().DarkRPVars.salary .. " ₽ ", "DarkRPHUD2", 225, ScrH() - 27, Color( 255, 255, 255, 255 ),TEXT_ALIGN_RIGHT) -- зп
end
hook.Add("HUDPaint", "DarkRP_Mod_HUDPaint", hudPaint)