Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function initFonts()
- surface.CreateFont( "Money", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- size = 30,
- weight = 600,
- } )
- surface.CreateFont( "ObvodkaHealth", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- size = 14,
- weight = 700
- } )
- surface.CreateFont( "ObvodkaArmor", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- size = 14,
- weight = 700
- } )
- surface.CreateFont( "Lockdown", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 17,
- weight = 1000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- surface.CreateFont( "Salary", {
- font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 20,
- weight = 600,
- } )
- surface.CreateFont( "Nick", {
- font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = true,
- size = 30,
- weight = 300,
- antialias = true,
- italic = false,
- symbol = false,
- } )
- surface.CreateFont( "Job", {
- font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = true,
- size = 20,
- weight = 600,
- italic = false,
- symbol = false,
- } )
- surface.CreateFont( "Health", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 14,
- weight = 1000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- surface.CreateFont( "HealthText", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 11,
- weight = 1000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- surface.CreateFont( "Wanted", {
- font = "Roboto", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 40,
- weight = 1000,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- end
- initFonts()
- timer.Simple( .1, initFonts )
- function drawOutlinedText(text, font, x, y, color, align)
- draw.SimpleText( text, "Obvodka" .. font, x-1, y-1, color_black, align )
- draw.SimpleText( text, font, x, y, color, align )
- end
- local gaybars = 0
- function nullGayBars()
- gaybars = 0
- end
- function drawGayBar(round, val, x, y, w, h, color, text)
- draw.RoundedBox( 0, x, y + gaybars, w, h, Color(255,255,255) )
- draw.RoundedBox( 0, x, y + gaybars, w * val, h, color )
- if text then
- surface.SetFont("Health")
- local tw,th = surface.GetTextSize(text)
- --local align = tw >= w * val and TEXT_ALIGN_RIGHT or TEXT_ALIGN_CENTER
- --local align = w * val <= tw * 0.5 and TEXT_ALIGN_LEFT or align
- local align = TEXT_ALIGN_CENTER
- draw.DrawText(text, "Health", x + w * 0.5, y + gaybars, Color(0,0,0), align)
- end
- gaybars = gaybars + h + 2
- end
- function InitializeHUD()
- local smoothHealth = 100
- local smoothArmor = 100
- function MainHUD()
- local Money = LocalPlayer():getDarkRPVar("money") or 0
- local Name = LocalPlayer():Nick()
- local Job = LocalPlayer():getDarkRPVar("job") or "Данные загружаются" .. string.rep(".", CurTime()%3)
- local Hunger = LocalPlayer():getDarkRPVar("Energy") or 0
- surface.SetFont("Nick")
- local NameW, NameH = surface.GetTextSize(Name)
- surface.SetFont("Job")
- local JobW, JobH = surface.GetTextSize(Job)
- local NameX, NameY = 14, ScrH() - 100
- draw.SimpleText( Name, "Nick", NameX, NameY, color_white, TEXT_ALIGN_LEFT )
- draw.SimpleText( Job, "Job", NameX + 2, NameY + NameH - 2, team.GetColor(LocalPlayer():Team()), TEXT_ALIGN_LEFT )
- smoothHealth = Lerp(FrameTime()*2, smoothHealth, LocalPlayer():Health())
- smoothArmor = Lerp(FrameTime()*2, smoothArmor, LocalPlayer():Armor())
- nullGayBars()
- drawGayBar( 0, math.Clamp(smoothHealth, 0, 100)/100, 15, ScrH() - 45, 300, 14, Color(200,50,50), "Здоровье: " .. LocalPlayer():Health() .. "%" )
- drawGayBar( 0, math.Clamp(smoothArmor, 0, 100)/100, 15, ScrH() - 45, 300, 14, Color(0,54,200), "Броня: " .. LocalPlayer():Armor() .. "%" )
- drawGayBar( 0, math.Clamp(Hunger, 0, 100)/100, 15, ScrH() - 45, 300, 3, Color(255,120,0))
- draw.SimpleText( "AlexandriaRP", "Nick", ScrW() - 105, ScrH() - 40, color_white, TEXT_ALIGN_CENTER )
- draw.SimpleText( DarkRP.formatMoney( Money or 0 ), "Money", 320, ScrH() - 70, color_white, TEXT_ALIGN_LEFT )
- draw.SimpleText( DarkRP.formatMoney( LocalPlayer():getDarkRPVar("salary") or 0 ) .. "/час", "Salary", 322, ScrH() - 40, color_white, TEXT_ALIGN_LEFT )
- end
- hook.Add("HUDPaint", "MainHUD", MainHUD)
- local ammo_alpha = 0
- local ammo_text = ""
- function LerpAmmo()
- if ammo_alpha > 0 then
- ammo_alpha = Lerp(FrameTime()*10, ammo_alpha, 0)
- end
- end
- function AmmoHUD()
- local weapon = LocalPlayer():GetActiveWeapon()
- if weapon and IsValid( weapon ) then
- local clip = weapon:Clip1()
- local ammo = LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType())
- if ammo and clip >= 0 and not (clip == -1 or clip <= 0 and ammo <= 0) then
- ammo_text = clip .. " / " .. ammo
- ammo_alpha = 255
- else LerpAmmo() end
- else LerpAmmo() end
- draw.SimpleText( ammo_text, "Nick", ScrW() - 195, ScrH() - 40, Color(255,255,255,ammo_alpha), TEXT_ALIGN_RIGHT )
- draw.RoundedBox( 0, ScrW()-185, ScrH()-40, 2, 30, Color(255,120,0,ammo_alpha) )
- end
- hook.Add("HUDPaint", "AmmoHUD", AmmoHUD)
- function AgendaHUD()
- local agenda = LocalPlayer():getAgendaTable()
- if not agenda then return end
- draw.RoundedBox( 0, 5, 5, 350, 150, Color(255,0,0) )
- surface.SetDrawColor( color_gray )
- surface.DrawOutlinedRect( 5, 5, 350, 150 )
- draw.RoundedBox( 0, 5, 5, 350, 40, color_white )
- surface.SetDrawColor( color_gray )
- surface.DrawOutlinedRect( 5, 5, 350, 40 )
- draw.DrawText( agenda.Title, "Job", 175, 10, color_black, TEXT_ALIGN_CENTER )
- local text = LocalPlayer():getDarkRPVar("agenda") or ""
- text = text:gsub("//", "\n"):gsub("\\n", "\n")
- text = DarkRP.textWrap(text, "DarkRPHUD1", 300)
- draw.DrawText(text, "Зарплата", 10, 50, color_black )
- end
- hook.Add("HUDPaint", "Agenda", AgendaHUD)
- function LockdownHUD()
- if GetGlobalBool("DarkRP_LockDown") then
- draw.SimpleText( "Начался ком. час! Возвращайтесь домой!", "Lockdown", 170, ScrH() - 150, color_white, TEXT_ALIGN_CENTER )
- end
- end
- hook.Add("HUDPaint", "Lockdown", LockdownHUD)
- function hidehud(name)
- for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "DarkRP_HUD", "DarkRP_Hungermod", "CHudSecondaryAmmo", "DarkRP_LocalPlayerHUD"})do
- if name == v then return false end
- end
- end
- hook.Add("HUDShouldDraw", "hide", hidehud)
- end
- InitializeHUD()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement