• Can someone modify my HUD?
    3 replies, posted
I have this hud but I want the background to be solid light gray and have a sky blue line around the edge. Here is the code for it, along with a picture of what it looks like now. [lua] /*--------------------------------------------------------------------------- HUD ConVars ---------------------------------------------------------------------------*/ local ConVars = {} local HUDWidth local HUDHeight local function ReloadConVars() ConVars = { background = {0,0,0,100}, Healthbackground = {0,0,0,200}, Healthforeground = {140,0,0,180}, HealthText = {255,255,255,200}, Job1 = {0,0,150,200}, Job2 = {0,0,0,255}, salary1 = {0,150,0,200}, salary2 = {0,0,0,255} } for name, Colour in pairs(ConVars) do ConVars[name] = {} for num, rgb in SortedPairs(Colour) do local CVar = GetConVar(name..num) or CreateClientConVar(name..num, rgb, true, false) table.insert(ConVars[name], CVar:GetInt()) if not cvars.GetConVarCallbacks(name..num, false) then cvars.AddChangeCallback(name..num, function() timer.Simple(0,ReloadConVars) end) end end ConVars[name] = Color(unpack(ConVars[name])) end HUDWidth = (GetConVar("HudW") or CreateClientConVar("HudW", 240, true, false)):GetInt() HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt() if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end) cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end) end end ReloadConVars() local function formatNumber(n) if (!n) then return 0 end if n >= 1e14 then return tostring(n) end n = tostring(n) sep = sep or "," local dp = string.find(n, "%.") or #n+1 for i=dp-4, 1, -3 do n = n:sub(1, i) .. sep .. n:sub(i+1) end return n end local Scrw, Scrh, RelativeX, RelativeY /*--------------------------------------------------------------------------- HUD Seperate Elements ---------------------------------------------------------------------------*/ local hudwidth = 512 local hudheight = 40 local hudypos = ScrH() - hudheight local Health = 0 local Armor = 0 local function DrawPlayerInfo() local midx = ScrW() / 2 draw.RoundedBox( 6, midx - (hudwidth / 2), hudypos, hudwidth, hudheight, Color( 0, 0, 0, 150 ) ) Health = (Health == LocalPlayer():Health() and Health) or Lerp(0.1, Health, LocalPlayer():Health()) local hwid = math.Clamp( Health, 0, 100 ) * (((hudwidth / 2) - 5) / 100) hwid = hwid > 4 and hwid or 4 draw.RoundedBox( 4, //midx - hwid, hudypos + 5, midx - hwid, (hudypos + hudheight) - 20, hwid, 15, Color( 150, 0, 0, 255 ) ) draw.SimpleText( "Health " .. tostring( math.Round( Health ) ) .. "%", "ScoreboardText", //midx - (hudwidth / 4), hudypos + 12, midx - (hudwidth / 4), (hudypos + hudheight) - 13, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) Armor = (Armor == LocalPlayer():Armor() and Armor) or Lerp(0.1, Armor, LocalPlayer():Armor()) local awid = math.Clamp( Armor, 0, 100 ) * (((hudwidth / 2) - 5) / 100) awid = awid > 4 and awid or 4 draw.RoundedBox( 4, //midx, hudypos + 5, midx, (hudypos + hudheight) - 20, awid, 15, Color( 0, 0, 200, 255 ) ) draw.SimpleText( "Armor " .. tostring( math.Round( Armor ) ) .. "%", "ScoreboardText", //midx + (hudwidth / 4), hudypos + 12, midx + (hudwidth / 4), (hudypos + hudheight) - 13, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( LANGUAGE.job .. (LocalPlayer().DarkRPVars.job or ""), "ScoreboardText", //midx - (hudwidth / 4), hudypos + 30, midx - (hudwidth / 4), hudypos + 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( LANGUAGE.salary .. CUR .. (LocalPlayer().DarkRPVars.salary or 0), "ScoreboardText", //midx, hudypos + 30, midx, hudypos + 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) draw.SimpleText( LANGUAGE.wallet .. CUR .. (formatNumber(LocalPlayer().DarkRPVars.money) or 0), "ScoreboardText", //midx + (hudwidth / 4), hudypos + 30, midx + (hudwidth / 4), hudypos + 10, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER ) end /* local Health = 0 local function DrawHealth() Health = (Health == LocalPlayer():Health() and Health) or Lerp(0.1, Health, LocalPlayer():Health()) local DrawHealth = Health / GetConVarNumber("startinghealth") local Border = math.Min(6, math.pow(2, math.Round(3*DrawHealth))) draw.RoundedBox(Border, RelativeX + 4, RelativeY - 30, HUDWidth - 8, 20, ConVars.Healthbackground) draw.RoundedBox(Border, RelativeX + 5, RelativeY - 29, (HUDWidth - 9) * DrawHealth, 18, ConVars.Healthforeground) draw.DrawText(math.Max(0, math.Round(Health)), "TargetID", RelativeX + 4 + (HUDWidth - 8)/2, RelativeY - 32, ConVars.HealthText, 1) end local function DrawInfo() local Salary = LANGUAGE.salary .. CUR .. (LocalPlayer().DarkRPVars.salary or 0) local JobWallet = LANGUAGE.job .. (LocalPlayer().DarkRPVars.job or "") .. "\n".. LANGUAGE.wallet .. CUR .. (formatNumber(LocalPlayer().DarkRPVars.money) or 0) draw.DrawText(Salary, "TargetID", RelativeX + 5, RelativeY - HUDHeight + 6, ConVars.salary1, 0) draw.DrawText(Salary, "TargetID", RelativeX + 4, RelativeY - HUDHeight + 5, ConVars.salary2, 0) surface.SetFont("TargetID") local w, h = surface.GetTextSize(Salary) draw.DrawText(JobWallet, "TargetID", RelativeX + 5, RelativeY - HUDHeight + h + 6, ConVars.Job1, 0) draw.DrawText(JobWallet, "TargetID", RelativeX + 4, RelativeY - HUDHeight + h + 5, ConVars.Job2, 0) end*/ local Page = surface.GetTextureID("gui/silkicons/page") local function GunLicense() if LocalPlayer().DarkRPVars.HasGunlicense then local QuadTable = {} QuadTable.texture = Page QuadTable.color = Color( 255, 255, 255, 100 ) QuadTable.x = RelativeX + HUDWidth + 31 QuadTable.y = ScrH() - 32 QuadTable.w = 32 QuadTable.h = 32 draw.TexturedQuad(QuadTable) end end local function JobHelp() local Helps = {"Cop", "Mayor", "Admin", "Boss"} for k,v in pairs(Helps) do if LocalPlayer().DarkRPVars["help"..v] then draw.RoundedBox(10, 10, 10, 590, 194, Color(0, 0, 0, 255)) draw.RoundedBox(10, 12, 12, 586, 190, Color(51, 58, 51, 200)) draw.RoundedBox(10, 12, 12, 586, 20, Color(0, 0, 70, 200)) draw.DrawText(v.." Help", "ScoreboardText", 30, 12, Color(255,0,0,255),0) draw.DrawText(string.format(LANGUAGE[v:lower().."help"], GetConVarNumber("jailtimer")), "ScoreboardText", 30, 35, Color(255,255,255,255),0) end end end local function Agenda() local DrawAgenda, AgendaManager = DarkRPAgendas[LocalPlayer():Team()], LocalPlayer():Team() if not DrawAgenda then for k,v in pairs(DarkRPAgendas) do if table.HasValue(v.Listeners, LocalPlayer():Team()) then DrawAgenda, AgendaManager = DarkRPAgendas[k], k break end end end if DrawAgenda then draw.RoundedBox(10, 10, 10, 460, 110, Color(0, 0, 0, 155)) draw.RoundedBox(10, 12, 12, 456, 106, Color(51, 58, 51,100)) draw.RoundedBox(10, 12, 12, 456, 20, Color(0, 0, 70, 100)) draw.DrawText(DrawAgenda.Title, "ScoreboardText", 30, 12, Color(255,0,0,255),0) local AgendaText = "" for k,v in pairs(team.GetPlayers(AgendaManager)) do AgendaText = AgendaText .. (v.DarkRPVars.agenda or "") end draw.DrawText(string.gsub(string.gsub(AgendaText, "//", "\n"), "\\n", "\n"), "ScoreboardText", 30, 35, Color(255,255,255,255),0) end end local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl") local function DrawVoiceChat() if LocalPlayer().DRPIsTalking then local chbxX, chboxY = chat.GetChatBoxPos() local Rotating = math.sin(CurTime()*3) local backwards = 0 if Rotating < 0 then Rotating = 1-(1+Rotating) backwards = 180 end surface.SetTexture(VoiceChatTexture)
U must lern 2 lua
Haha, I got it done by a person so it's all good, I know some lua but not enough.
[QUOTE=shadowz67xx;37096465]Haha, I got it done by a person so it's all good, I know some lua but not enough.[/QUOTE] Hope you didn't pay, this HUD is straight off garrysmod.org
Sorry, you need to Log In to post a reply to this thread.