Hello.
After installing a custom HUD and removing the default HUD (since it was displaying over this HUD) for DarkRP, the text that displays when you look at a door has also disappeared. I have a funny feeling some other things are broken also, but, I'll start off with troubleshooting this.
Here's the code:
[CODE]//DarkRP Public HUD
//Version 2.3
//Made by [IЯAF]Alberto
surface.CreateFont( "DarkRPPublicHUD1", {
font = "Coolvetica",
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false
})
surface.CreateFont( "DarkRPPublicHUD2", {
font = "Coolvetica",
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false
})
surface.CreateFont( "DarkRPPublicHUD3", {
font = "Coolvetica",
size = 50,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false
})
surface.CreateFont( "DarkRPPublicHUD4", {
font = "Coolvetica",
size = 28,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false
})
local function darkrphud()
--Maybe if you want you can use the DarkRP HUD values, or they can be useless.
local enabletopmessage = false --Enable(true)or disable(false) the message at the top right of the screen. Disabled by default.
local topmessage = "Insert your text here!" --A message at the top right of the screen, to indicate the server/clan name or the server/clan webpage. Whatever you want.
local topmsgbgcolor = Color(0,50,255,255)--Top message background color
local topmsgcolor = Color(255,255,255,255)--Top message text color
local Hpfrac = math.Clamp(LocalPlayer():Health(),0,100) / 100-- This is the thing to make the HUD go from green to red
local mainbgcolor = Color(0,0,0,150) --The color of the background of the main group of HUD(health, etc)
local ammobgcolor = Color(0,0,0,150) --The color of the background of the ammo group of HUD(ammo clip, etc)
local healthbg = Color(0,0,0,150) --Health bar background color
local healthcolor = Color(180*(1 - Hpfrac),180*Hpfrac,0,255)--The health bar foreground color
local hptextcolor = Color(255*(1 - Hpfrac),255*Hpfrac,0,255)--The health text color
local hpiconcolor = Color(255*(1 - Hpfrac),255*Hpfrac,0,255)--The health icon color
local extrabg = Color(0,0,0,150) --Extra bar background color
local hpextracolor = Color(0,180,180,255) -- the health bar color when it's over 100HP
local hptxtextracolor = Color(0,255,255,255) -- the health text color when it's over 100HP
local extravalue = LocalPlayer():Armor()--The extra bar value, armor bar by default
local extracolor = Color(100,100,100,255)--The extra bar color, grey by default
local extratextcolor = Color(200,200,200,255)--The extra value text color, light grey by default
local moneycolor = Color(0,255,0,255)--The color of the money indicator
local salarycolor = Color(0,255,0,255)--The color of the salary indicator
local jobcolor = Color(255,255,255,255)--The color of the job indicator
local jobbg = team.GetColor(LocalPlayer():Team())--The color of the job indicator background
local namecolor = Color(255,255,255,255)--The color of the name indicator
local ammocolor = Color(255,255,0,255)
if LocalPlayer():GetActiveWeapon().Primary != nil then
if (LocalPlayer():GetActiveWeapon():Clip1()*100)/LocalPlayer():GetActiveWeapon().Primary.ClipSize > 25 then
ammocolor = Color(255,255,0,255)--Ammo clip text color
else
ammocolor = Color(255,0,0,255)--Ammo clip text color when is less that 25% of clip capacity
end
end
local ammocolor2 = Color(255,255,0,255)--Extra ammo text color
local hptexture = Material("icon16/heart.png")--Health icon
local extratexture = Material("icon16/shield.png")--Extra bar icon, armor bar by default
local moneytexture = Material("icon16/money.png")--Money icon
local salarytexture = Material("icon16/money_add.png")--Salary icon
local jobtexture = Material("icon16/user_suit.png")--Job icon
local nametexture = Material("icon16/user.png")--Name icon
local licensetex = Material("icon16/page.png")
local mainposx = 10 --The X position of the main group of HUD (health, etc)
local mainposy = ScrH() - 70 --The Y position of the main group of HUD (health, etc)
local ammoposx = ScrW() - 210 --The X position of the ammo group of HUD (ammo clip, etc)
local ammoposy = ScrH() - 70 --The Y position of the ammo group of HUD (ammo clip, etc)
/*-------------------------------------------------------------------------
Here begins the HUD function, just edit if you're advanced!
--------------------------------------------------------------------------*/
local client = LocalPlayer()
LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
local rpname = (client.DarkRPVars.rpname or "")
local money = (client.DarkRPVars.money or 0)
local salary = (client.DarkRPVars.salary or 0)
local job = (client.DarkRPVars.job or "")
if enabletopmessage == true then
--Top message
surface.SetFont("DarkRPPublicHUD2")
local tmsgspace = surface.GetTextSize(topmessage)
draw.RoundedBox(8, ScrW() - tmsgspace - 13, 5, tmsgspace + 8, 25, topmsgbgcolor)
draw.SimpleText(topmessage,"DarkRPPublicHUD2", ScrW() - tmsgspace - 10, 5, topmsgcolor)
end
--Main background
if extravalue > 0 then
draw.RoundedBox(8, mainposx, mainposy, 240, 51, mainbgcolor)
else
draw.RoundedBox(8, mainposx, mainposy, 240, 30, mainbgcolor)
end
--Health bar
draw.RoundedBox(6, mainposx + 30, mainposy + 5, 200, 20, healthbg)--health bar background
if client:Health() > 100 then
draw.RoundedBox(6, mainposx + 30, mainposy + 5, 200, 20, hpextracolor)--health bar color
draw.RoundedBox(4, mainposx + 30, mainposy + 5, 200, 8, Color(255,255,255,40))--Health bar bright
draw.SimpleText(client:Health(), "DarkRPPublicHUD4", mainposx + 127, mainposy + 3, hptxtextracolor, 1, 0)
elseif client:Health() > 0 then
draw.RoundedBox(6, mainposx + 30, mainposy + 5, (client:Health()*200)/100, 20, healthcolor)--health bar color
draw.RoundedBox(4, mainposx + 30, mainposy + 5, (client:Health()*200)/100, 8, Color(255,255,255,40))--Health bar bright
draw.SimpleText(client:Health(), "DarkRPPublicHUD4", mainposx + 127, mainposy + 3, hptextcolor, 1, 0)
else
draw.SimpleText("0", "DarkRPPublicHUD4", mainposx + 127, mainposy + 3, hptextcolor, 1, 0)
end
--Health icon
surface.SetMaterial(hptexture)
if client:Health() > 100 then
surface.SetDrawColor(hptxtextracolor)
else
surface.SetDrawColor(hpiconcolor)
end
surface.DrawTexturedRect(mainposx+7,mainposy+7,18,18)
--Extra bar
if extravalue > 0 then
draw.RoundedBox(8, mainposx + 30, mainposy + 28, 200, 18, healthbg)--extra bar bar background
if extravalue > 100 then
draw.RoundedBox(6, mainposx + 30, mainposy + 28, 200, 18, extracolor)--extra bar foreground
draw.RoundedBox(4, mainposx + 30, mainposy + 28, 200, 8, Color(255,255,255,40))--extra bar bright
draw.SimpleText(extravalue, "DarkRPPublicHUD1", mainposx + 127, mainposy + 26, extratextcolor, 1, 0)--extra text
elseif extravalue > 0 then
draw.RoundedBox(6, mainposx + 30, mainposy + 28, (extravalue*200)/100, 18, extracolor)--extra bar foreground
draw.RoundedBox(4, mainposx + 30, mainposy + 28, (extravalue*20
What did you do to remove the old HUD?
First of all, if things start to mess up without you modifying them, report it to FPtje instead.
Secondly, [url]http://facepunch.com/showthread.php?t=1249475[/url]
Does the hud work? because i have seen this code and tried this out and it seems to give a error in console.
Sorry, you need to Log In to post a reply to this thread.