so if i add like money to my hud
and i want a green backround but if i have a lot of money then the background is not in the money the background is to short
then make it longer hurry
so i wanna add a rectangle backround on my text of this
local money = LocalPlayer():getDarkRPVar("money") or 0
draw.SimpleText( money, "Money", ScrW() - 535, ScrH() - 63, Color( 0, 255, 0 ), TEXT_ALIGN_CENTER )
but when pretend i add background of me having $500 the box will be to small for the amount of $5,000,000
and the rectangle is lined up with the text no matter what
No limits ay?
wym?
Can you include the code you are currently working with?
include("hud_config.lua")
if SERVER then
resource.AddFile("resource/fonts/impact.otf")
return
end
surface.CreateFont( "Name", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 18,
weight = 800,
blursize = 0,
scanlines = 0,
antialias = false,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false,
} )
surface.CreateFont( "Job", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 16,
weight = 800,
blursize = 0,
scanlines = 0,
antialias = false,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false,
} )
surface.CreateFont( "Armor", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 11,
weight = 800,
blursize = 0,
scanlines = 0,
antialias = false,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false,
} )
surface.CreateFont( "Health", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 13,
weight = 800,
blursize = 0,
scanlines = 0,
antialias = false,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false,
} )
surface.CreateFont( "Money", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 16,
weight = 800,
blursize = 0,
scanlines = 0,
antialias = false,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = true,
outline = false,
} )
surface.CreateFont( "AmmoWeapon", {
font = "impact", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = true,
symbol = false,
rotary = false,
shadow = true,
additive = true,
outline = true,
} )
surface.CreateFont( "Ammo", {
font = "impact", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = true,
symbol = false,
rotary = false,
shadow = true,
additive = true,
outline = true,
} )
local hideHUDElements = {
["DarkRP_LocalPlayerHUD"] = true,
}
-- this is the code that actually disables the drawing.
hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name)
if hideHUDElements[name] then return false end
end)
function hidehud(name)
for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "CHudWeapon"})do
if name == v then return false end
end
end
hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)
hook.Add("HUDPaint" , "DrawMyHud" , function()
local health = LocalPlayer():Health()
local armor = LocalPlayer():Armor()
local steamid = LocalPlayer():SteamID()
local group = LocalPlayer():GetUserGroup()
local ammo1 = LocalPlayer():GetActiveWeapon():Clip1()
local ammo2 = LocalPlayer():GetActiveWeapon():Clip2()
local weapon = LocalPlayer():GetActiveWeapon():GetClass()
local name = LocalPlayer():Nick() or ""
local job = LocalPlayer():getDarkRPVar("job") or ""
local money = LocalPlayer():getDarkRPVar("money") or 0
local salary = LocalPlayer():getDarkRPVar("salary") or 0
local currentTeamColor = team.GetColor( LocalPlayer():Team() )
draw.RoundedBox( 3, ScrW() - 780, ScrH() - 65, 280, 65, TOGConfig.Base ) -- BASE
draw.SimpleText( name, "Name", ScrW() - 765, ScrH() - 65, TOGConfig.Name, TEXT_ALIGN_LEFT ) -- PLAYERS NAME -- PLAYERS NAME
draw.RoundedBox( 3, ScrW() - 764, ScrH() - 45, 250, 10, TOGConfig.HealthBackGround) -- BACKROUND HEALTH BOX
draw.RoundedBox( 3, ScrW() - 764, ScrH() - 45, health * 2.5, 10, TOGConfig.HealthBox ) -- HEALTH BOX
draw.RoundedBox( 3, ScrW() - 764, ScrH() - 32, 250, 10, TOGConfig.ArmorBackGround) -- BACKROUND ARMOR BOX
draw.RoundedBox( 3, ScrW() - 764, ScrH() - 32, armor * 2.5, 10, TOGConfig.ArmorBox ) -- ARMOR BOX
draw.SimpleText( health, "Health", ScrW() - 630, ScrH() - 47, TOGConfig.HealthNumber, TEXT_ALIGN_CENTER )
draw.SimpleText( "HP", "Health", ScrW() - 650, ScrH() - 47, TOGConfig.HPWord, TEXT_ALIGN_CENTER )
draw.SimpleText( armor, "Health", ScrW() - 630, ScrH() - 33, TOGConfig.ArmorNumber, TEXT_ALIGN_CENTER )
draw.SimpleText( "Armor", "Armor", ScrW() - 650, ScrH() - 32, TOGConfig.ArmorText, TEXT_ALIGN_CENTER )
draw.SimpleText( job, "Job", ScrW() - 725, ScrH() - 20, TOGConfig.JobText, TEXT_ALIGN_CENTER )
draw.SimpleText( money, "Money", ScrW() - 535, ScrH() - 63, TOGConfig.MoneyAmount, TEXT_ALIGN_CENTER )
draw.SimpleText( "$", "Money", ScrW() - 565, ScrH() - 63, TOGConfig.MoneySymbol, TEXT_ALIGN_CENTER )
draw.SimpleText( "$", "Money", ScrW() - 550, ScrH() - 20, TOGConfig.MoneySymbol, TEXT_ALIGN_CENTER )
draw.SimpleText( salary, "Money", ScrW() - 535, ScrH() - 20, TOGConfig.SalaryAmount, TEXT_ALIGN_CENTER )
draw.SimpleText( "+", "Money", ScrW() - 560, ScrH() - 20, TOGConfig.PlusSymbol, TEXT_ALIGN_CENTER )
draw.SimpleText( websitename, "Money", ScrW() - 630, ScrH() - 660, TOGConfig.Websitename, TEXT_ALIGN_CENTER )
draw.RoundedBox( 0, ScrW() - 270, ScrH() - 47, 250, 46, Color( 30,30,30,200 ) ) -- Ammo BLack
draw.RoundedBox( 0, ScrW() - 270, ScrH() - 47, 20, 46, Color( 30,30,30,220 ) ) -- Ammo GRAY
draw.SimpleText( weapon, "AmmoWeapon", ScrW() - 248, ScrH() - 40, Color( 200, 200, 200 ), TEXT_ALIGN_LEFT ) -- prim weapon
draw.SimpleText( ammo1, "Ammo", ScrW() - 238, ScrH() - 20, Color( 200, 200, 200 ), TEXT_ALIGN_LEFT ) -- ammo prim
draw.SimpleText( ammo2, "Ammo", ScrW() - 210, ScrH() - 20, Color( 200, 200, 200 ), TEXT_ALIGN_LEFT ) -- ammo prim
draw.SimpleText( "/", "Ammo", ScrW() - 220, ScrH() - 20, Color( 200, 200, 200 ), TEXT_ALIGN_LEFT ) -- ammo prim
end)
Sorry, you need to Log In to post a reply to this thread.