Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- surface.CreateFont( "Big", {
- font = "Bebas Neue Bold",
- size = 20,
- weight = 500,
- antialias = true
- })
- surface.CreateFont( "Medium", {
- font = "Bebas Neue Bold",
- size = 18,
- weight = 500,
- antialias = true
- })
- surface.CreateFont( "Small", {
- font = "Bebas Neue Bold",
- size = 17,
- weight = 500,
- antialias = true
- })
- -- Ammo box fonts
- surface.CreateFont( "Weapon Name", {
- font = "Bebas Neue Bold",
- size = 20,
- weight = 500,
- antialias = true
- })
- surface.CreateFont( "Ammo", {
- font = "Bebas Neue Bold",
- size = 55,
- weight = 500,
- antialias = true
- })
- -- Time font
- surface.CreateFont( "Time", {
- font = "Bebas Neue Bold",
- size = 60,
- weight = 500,
- antialias = true
- })
- local ply = LocalPlayer()
- local blurry = Material( "pp/blurscreen" )
- local function richhudBlur( x, y, w, h, layers, density, alpha )
- surface.SetDrawColor( 255, 255, 255, alpha )
- surface.SetMaterial( blurry )
- for i = 1, layers do
- blurry:SetFloat( "$blur", ( i / layers ) * density )
- blurry:Recompute()
- render.UpdateScreenEffectTexture()
- render.SetScissorRect( x, y, x + w, y + h, true )
- surface.DrawTexturedRect( 0, 0, ScrW(), ScrH() )
- render.SetScissorRect( 0, 0, 0, 0, false )
- end
- end
- function richHud()
- -- Variables
- local scrw, scrh = ScrW(), ScrH()
- local x, y = 10, scrh - 185
- local w, h = 400, 175
- -- Background
- if ( config.EnableBlur == true ) then
- richhudBlur( x, y, w, h, config.BlurLayers, config.BlurDensity, 255 )
- elseif ( config.EnableBlur == false ) then
- draw.RoundedBox( 0, x, y, w, h, config.BackgroundColor )
- end
- if ( config.EnableBlur == true ) then
- richhudBlur( x + w, y + 70, 75, h - 70, config.BlurLayers, config.BlurDensity, 255 )
- elseif ( config.EnableBlur == false ) then
- draw.RoundedBox( 0, x, y, w, h, config.BackgroundColor )
- end
- -- Time
- if ( config.EnableTimeBlur == true ) and ( config.ShowTime == true ) then
- richhudBlur( scrw / 2 - 100, 10, 200, 55, config.BlurLayers, config.BlurDensity, 255 )
- elseif ( config.EnableTimeBlur == false ) and ( config.ShowTime == true ) then
- draw.RoundedBox( 0, scrw / 2 - 100, 10, 200, 55, config.TimeBackgroundColor )
- end
- -- Time outline
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( scrw / 2 - 100, 10, scrw / 2 + 100, 10 )
- surface.DrawLine( scrw / 2 - 100, 10, scrw / 2 - 100, 65 )
- surface.DrawLine( scrw / 2 - 100, 65, scrw / 2 + 100, 65 )
- surface.DrawLine( scrw / 2 + 100, 10, scrw / 2 + 100, 65 )
- -- Time
- draw.DrawText( os.date( "%I:%M:%S %p" ), "Time", scrw / 2, 10, color_white, TEXT_ALIGN_CENTER)
- -- Outline
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( x, y, w + x, y )
- surface.DrawLine( x, y, x, y + h )
- surface.DrawLine( x, y + h, x + w, y + h )
- surface.DrawLine( x + w, y, x + w, y + 71 )
- surface.DrawLine( x + w, y + 70, x + w + 75, y + 70 )
- surface.DrawLine( x + w + 75, y + 70, x + w + 75, y + h )
- surface.DrawLine( x + w + 75, y + h, x + w, y + h )
- -- Player model background
- draw.RoundedBox( 0, x + 5, y + 5, 60, 60, config.PlayerModelBackgroundColor )
- -- Line to separate information
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( x, y + 70, x + w, y + 70 )
- -- Name
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( x + 65, y + 30, x + w, y + 30 )
- draw.DrawText( ply:Name(), "Big", x + w / 2 + ( 65 / 2 - 5 ), y + 10, config.TextColor, TEXT_ALIGN_CENTER )
- -- Money + salary
- local moneyIcon = Material( "materials/richhud/money.png", "unlitgeneric" )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( moneyIcon )
- surface.DrawTexturedRect( x + 65, y + 33, 35, 35 )
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( x + 95, y + 50, x + 250, y + 50 )
- draw.DrawText( DarkRP.formatMoney( ply:getDarkRPVar( "money" ) ), "Medium", x + 100, y + 34, config.TextColor, TEXT_ALIGN_LEFT )
- local salaryIcon = Material( "materials/richhud/salary.png", "unlitgeneric" )
- surface.SetMaterial( salaryIcon )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.DrawTexturedRect( x + 105, y + 55, 10, 10 )
- draw.DrawText( DarkRP.formatMoney( ply:getDarkRPVar( "salary" ) ), "Medium", x + 120, y + 52, config.TextColor, TEXT_ALIGN_LEFT )
- -- Job
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( x + 275, y + 50, x + 400, y + 50 )
- draw.DrawText( "Job", "Medium", x + 335, y + 34, config.TextColor, TEXT_ALIGN_CENTER )
- draw.DrawText( ply:getDarkRPVar( "job" ), "Medium", x + 335, y + 52, config.TextColor, TEXT_ALIGN_CENTER )
- if ply:Alive() then
- -- Health and armor
- if ( config.EnableHungerMod == false ) then
- hbx, hby = x + 5, y + 85
- abx, aby = x + 5, y + 140
- elseif ( config.EnableHungerMod == true ) then
- hbx, hby = x + 5, y + 80
- abx, aby = x + 5, y + 145
- end
- -- Health
- draw.RoundedBox( 0, hbx, hby, w - 10, 20, config.HealthBarBackgroundColor )
- draw.RoundedBox( 0, hbx, hby, (w - 10) * ply:Health() / 100, 20, config.HealthBarColor )
- draw.RoundedBox( 0, hbx, hby, (w - 10) * ply:Health() / 100, 10, Color( 200, 200, 200, 40 ) )
- local healthIcon = Material( "materials/richhud/health.png", "unlitgeneric" )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( healthIcon )
- surface.DrawTexturedRect( hbx + ( w - 10 ) / 2 - 18, hby - 8, 35, 35 )
- draw.DrawText( ply:Health(), "Small", hbx + ( w - 10 ) / 2 - 1, hby, config.TextColor, TEXT_ALIGN_CENTER )
- -- Armor
- draw.RoundedBox( 0, abx, aby, w - 10, 20, config.ArmorBarBackgroundColor )
- draw.RoundedBox( 0, abx, aby, (w - 10) * ply:Armor() / 100, 20, config.ArmorBarColor )
- draw.RoundedBox( 0, abx, aby, (w - 10) * ply:Armor() / 100, 10, Color( 200, 200, 200, 30 ) )
- local armorIcon = Material( "materials/richhud/armor.png", "noclamp smooth" )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( armorIcon )
- surface.DrawTexturedRect( abx + ( w - 10 ) / 2 - 18, aby - 8, 35, 35 )
- draw.DrawText( ply:Armor(), "Small", abx + ( w - 10 ) / 2 - 1, aby, config.TextColor, TEXT_ALIGN_CENTER )
- -- Hunger
- if ( config.EnableHungerMod == true ) then
- hbx, hby = x + 5, y + 145
- draw.RoundedBox( 0, hbx, hby, w - 10, 20, config.FoodBarBackgroundColor )
- draw.RoundedBox( 0, hbx, hby, (w - 10) * ply:getDarkRPVar( "Energy" ) / 100, 20, config.FoodBarColor )
- local foodIcon = Material( "materials/richhud/hunger.png", "noclamp smooth" )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( foodIcon )
- surface.DrawTexturedRect( hbx + ( w - 10 ) / 2 - 18, hby - 8, 35, 35 )
- draw.DrawText( ply:getDarkRPVar( "Energy" ), "Small", hbx + ( w - 10 ) / 2 - 1, hby + 5, config.TextColor, TEXT_ALIGN_CENTER )
- end
- else
- deadIcon = Material( "materials/richhud/dead.png", "noclamp smooth" )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( deadIcon )
- surface.DrawTexturedRect( hbx + ( w - 10 ) / 2 - 35, hby + 5 , 65, 65 )
- end
- -- Wanted (on hud)
- if ( ply:getDarkRPVar( "wanted" ) ) then
- wc = Color(255, 255, 255, 255)
- elseif !( ply:getDarkRPVar( "wanted" ) ) then
- wc = Color(255, 255, 255, 100)
- end
- wantedstarIcon = Material( "materials/richhud/wantedstar.png", "noclamp smooth" )
- surface.SetDrawColor( wc )
- surface.SetMaterial( wantedstarIcon )
- surface.DrawTexturedRect( x + w + 10, y + 70, 50, 50 )
- -- License
- if ( ply:getDarkRPVar( "HasGunlicense" ) ) then
- lc = Color( 255, 255, 255, 255 )
- elseif !( ply:getDarkRPVar( "HasGunlicense" ) ) then
- lc = Color( 255, 255, 255, 50 )
- end
- licensedIcon = Material( "materials/richhud/license.png" )
- surface.SetDrawColor( lc )
- surface.SetMaterial( licensedIcon )
- surface.DrawTexturedRect( x + w + 7, y + 125, 45, 45 )
- -- Wanted ( in midde of screen )
- if ( ply:getDarkRPVar( "wanted" ) ) then
- wantedIcon = Material( "materials/richhud/wanted.png", "noclamp smooth" )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( wantedIcon )
- surface.DrawTexturedRect( scrw / 2 - 50, 100, 100, 100 )
- local wantedText = DarkRP.getPhrase("wanted", tostring(LocalPlayer():getDarkRPVar("wantedReason")))
- draw.DrawText( wantedText, "Big", scrw / 2, 200, Color( 255, 0, 0, 255 ), TEXT_ALIGN_CENTER )
- end
- -- Ammo
- if (ply:GetActiveWeapon():IsValid()) then
- if ( config.EnableBlur == true ) then
- richhudBlur( scrw - 210, scrh - 110, 200, 100, config.BlurLayers, config.BlurDensity, 255 )
- elseif ( config.EnableBlur == false ) then
- draw.RoundedBox( 0, scrw - 210, scrh - 110, 200, 100, config.BackgroundColor )
- end
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( scrw - 210, scrh - 110, scrw - 10, scrh - 110 )
- surface.DrawLine( scrw - 210, scrh - 110, scrw - 210, scrh - 10 )
- surface.DrawLine( scrw - 210, scrh - 10, scrw - 10, scrh - 10 )
- surface.DrawLine( scrw - 10, scrh - 110, scrw - 10, scrh - 10 )
- ammoIcon = Material( "materials/richhud/ammo.png" )
- draw.SimpleText(ply:GetActiveWeapon():GetPrintName(), "Weapon Name", scrw - 105, scrh - 93, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER)
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( scrw - 210, scrh - 75, scrw - 10, scrh - 75 )
- if (ply:GetActiveWeapon():Clip1() != -1) then
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( ammoIcon )
- surface.DrawTexturedRect( scrw - 200, scrh - 100, 25, 25 )
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( scrw - 105, scrh - 75, scrw - 105, scrh - 10 )
- draw.SimpleText(ply:GetActiveWeapon():Clip1(), "Ammo", scrw - 160, scrh - 65, config.TextColor, TEXT_ALIGN_CENTER)
- draw.SimpleText(ply:GetAmmoCount(ply:GetActiveWeapon():GetPrimaryAmmoType()), "Ammo", scrw - 60, scrh - 65, config.TextColor, TEXT_ALIGN_CENTER)
- end
- end
- end
- -- Agenda
- local agendaText
- local function Agenda()
- local agenda = LocalPlayer():getAgendaTable()
- if not agenda then return end
- agendaText = agendaText or DarkRP.textWrap((LocalPlayer():getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
- if ( config.EnableAgendaBlur == true ) then
- richhudBlur( 5, 30, 350, 100, config.BlurLayers, config.BlurDensity, 255 )
- richhudBlur( 5, 5, 350, 23, config.BlurLayers, config.BlurDensity, 255)
- elseif ( config.EnableAgendaBlur == false ) then
- draw.RoundedBox( 0, 5, 30, 350, 100, config.AgendaBackgroundColor )
- draw.RoundedBox( 0, 5, 5, 350, 23, config.AgendaBackgroundColor )
- end
- surface.SetDrawColor( config.OutlineColor )
- surface.DrawLine( 5, 5, 355, 5 )
- surface.DrawLine( 5, 5, 5, 28 )
- surface.DrawLine( 5, 28, 355, 28 )
- surface.DrawLine( 355, 5, 355, 28 )
- surface.DrawLine( 5, 30, 355, 30 )
- surface.DrawLine( 5, 30, 5, 130 )
- surface.DrawLine( 5, 130, 355, 130 )
- surface.DrawLine( 355, 30, 355, 130 )
- draw.DrawText( agenda.Title, "Medium", 180, 10, config.TextColor, TEXT_ALIGN_CENTER )
- draw.DrawText( string.lower( agenda.Title ), "Medium", 180, 10, config.TextColor, 1 )
- draw.DrawNonParsedText( string.lower( agendaText ), "Medium", 20, 40, config.TextColor, 0)
- end
- hook.Add("DarkRPVarChanged", "richAgendaHud", function(ply, var, _, new)
- if ply ~= LocalPlayer() then return end
- if var == "agenda" and new then
- agendaText = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\\n", "\n"), "Medium", 440)
- else
- agendaText = nil
- end
- end)
- local Arrested = function() end
- usermessage.Hook("GotArrested", function(msg)
- local StartArrested = CurTime()
- local ArrestedUntil = msg:ReadFloat()
- Arrested = function()
- if CurTime() - StartArrested <= ArrestedUntil and LocalPlayer():getDarkRPVar("Arrested") then
- --==== Background ====--
- draw.RoundedBox( 0, 10, ScrH() / 2, 225, 30, Color( 25, 25, 25, 230 ) )
- draw.DrawText( string.lower( DarkRP.getPhrase( "youre_arrested", math.ceil( ArrestedUntil - ( CurTime() - StartArrested ) ) ) ), "Medium", 17, ScrH() / 2 + 7, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT )
- elseif not LocalPlayer():getDarkRPVar("Arrested") then
- Arrested = function() end
- end
- end
- end)
- local function overHead()
- local ply = LocalPlayer()
- for id, ply in pairs(ents.FindByClass( "Player" )) do
- if ply == LocalPlayer() then continue end
- if (ply:GetPos():Distance(LocalPlayer():GetPos()) < 175) then
- if ply:Alive() then
- local plyName = tostring(ply:Nick())
- local plyPos = ply:GetPos() + Vector(0, 0, 75)
- local health = ply:Health()
- local plyJob = ply:getDarkRPVar("job")
- local plyDistant = math.floor((ply:GetPos():Distance( plyPos )) / 40 )
- local plyScreenpos = plyPos:ToScreen()
- -- Overhead background
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ) - 20, 125, 30, Color( 0, 0, 0, 230 ) )
- if GAMEMODE.Config.showHealth then
- -- Health bar
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ) + 20, 125, 10, Color( 125, 100, 100, 230 ) )
- -- Armor bar
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ) + 35, 125, 10, Color( 100, 100, 125, 230 ) )
- -- Health
- local plyHealth = ply:Health() or 0
- local writeHealth = ply:Health() or 0
- if plyHealth <= 0 then plyHealth = 0 end
- if plyHealth > 100 then plyHealth = 100 end
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ) + 20, (125) * plyHealth / 100, 10, Color( 255, 0, 0, 255 ) )
- draw.DrawText( writeHealth, "Big", tonumber( plyScreenpos.x ) + 5, tonumber( plyScreenpos.y ) + 17, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
- -- Armor
- local plyArmor = ply:Armor() or 0
- local writeArmor = ply:Armor() or 0
- if plyArmor <= 0 then plyArmor = 0 end
- if plyArmor > 100 then plyArmor = 100 end
- if plyArmor > 0 then
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ) + 35, (125) * plyArmor / 100, 10, Color( 0, 0, 255, 255 ) )
- end
- draw.DrawText( writeArmor, "Big", tonumber( plyScreenpos.x ) + 5, tonumber( plyScreenpos.y ) + 32, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
- end
- if ( ply:getDarkRPVar( "wanted" ) ) then
- draw.DrawText( "Wanted by the police!", "Big", tonumber( plyScreenpos.x ) + 5, tonumber( plyScreenpos.y ) - 100, Color( 255, 0, 0, 255 ), TEXT_ALIGN_CENTER )
- end
- -- Player job BOX
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ), 125, 15, Color( 25, 25, 25, 230 ) )
- -- Player job TEXT
- draw.DrawText( plyJob, "Medium", tonumber( plyScreenpos.x ) + 5, tonumber( plyScreenpos.y ) - 3, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
- -- Player name BOX
- draw.RoundedBox( 1, tonumber( plyScreenpos.x ) - 55, tonumber( plyScreenpos.y ) - 20, 125, 15, Color( 25, 25, 25, 230 ) )
- -- Player name TEXT
- draw.DrawText( plyName, "Medium", tonumber( plyScreenpos.x ) + 5, tonumber( plyScreenpos.y ) - 20, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
- end
- end
- end
- end
- hook.Add( "InitPostEntity", "playermodel", function()
- local PlayerModel = vgui.Create( "DModelPanel" )
- PlayerModel:SetPos( 13, ScrH() - 180 )
- PlayerModel:SetSize( 60, 60 )
- PlayerModel:SetModel( LocalPlayer():GetModel() )
- PlayerModel.Think = function()
- PlayerModel:SetModel( LocalPlayer():GetModel() )
- end
- PlayerModel.LayoutEntity = function()
- return false
- end
- PlayerModel:SetFOV( 30 )
- PlayerModel:SetCamPos( Vector( 40, 0, 62 ) )
- PlayerModel:SetLookAt( Vector( 0, 0, 62 ) )
- PlayerModel.Entity:SetEyeTarget( Vector( 200, 200, 100 ) )
- end )
- function drawHud()
- if ( config.Enable == true ) then
- richHud()
- Agenda()
- overHead()
- Arrested()
- end
- end
- hook.Add( "HUDPaint", "drawit", drawHud )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement