• HUD help.
    7 replies, posted
[B][U]Solved by: TheDivinity[/U][/B] Here is a picture explaining what's wrong with my hud. [IMG]http://i.imgur.com/omXQ2jn.png[/IMG] Basically, when I change my job name to something long, the box overlaps the second box (Salary). Here is the hud function that you will need: [lua]local function MyHUD() local newtime = string.ToMinutesSeconds(CurTime()) local ply = LocalPlayer() local hp,ar = ply:Health(),ply:Armor() local slujba = LocalPlayer().DarkRPVars.job or "Unemployed" local salar = LocalPlayer().DarkRPVars.salary or "NONE" local bani = LocalPlayer().DarkRPVars.money or "NONE" local hr = LocalPlayer().DarkRPVars.Energy surface.SetFont( "TargetID" ) local _text = "Job: " .. slujba local _w, _h = surface.GetTextSize( _text ) local ts = surface.GetTextSize('your text here') LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {} LocalPlayer().DarkRPVars.Energy = LocalPlayer().DarkRPVars.Energy or 0 if (ply:Alive()) then draw.RoundedBoxEx(0, 0, 0, ScrW(), 20, Color(50, 50, 50, 200)) draw.RoundedBoxEx(0, 0, 20, ScrW(), 1, Color(255, 255, 255, 50)) surface.SetFont( "TargetID" ) surface.SetDrawColor(255,255,255,255) draw.RoundedBox(0, 10, 0, _w + 6, _h + 6, Color(0, 0, 0, 255)) draw.SimpleText("Job: "..slujba,"TargetID",13,ScrH() - 766) surface.SetFont( "TargetID" ) surface.SetDrawColor(255,255,255,255) draw.RoundedBox(0, 99, 0, _w + 6, _h + 6, Color(0, 0, 0, 255)) draw.SimpleText("Salary: $"..salar,"TargetID",100,ScrH() - 766) --BEYOND HERE IS STILL BEING WORKED ON! surface.SetDrawColor(255,255,255,255) draw.SimpleText("Wallet: $"..bani,"TargetID",650,ScrH() - 766) surface.SetDrawColor(255,255,255,255) draw.SimpleText("Time Played: "..newtime,"TargetID",1050,ScrH() - 766) surface.SetDrawColor(0,0,0,255) draw.SimpleText("Health: "..hp,"TargetID",850,ScrH() - 766) if (hr > 0) then draw.SimpleText("Hunger: "..hr,"TargetID",320,ScrH() - 766) end[/lua] Hopefully one of you can help me, it would be greatly appreciated.
I have no idea how to make huds, but I would suggest making either a box that expands in size with text or a box large enough to fit the longest named job
[QUOTE=Humility;41741674]I have no idea how to make huds, but I would suggest making either a box that expands in size with text or a box large enough to fit the longest named job[/QUOTE] I already did make a box that adjusts to the given text size, I just need it so it doesn't overlap onto the other boxes.
Change the position of the Salary box/text?
You need to change the X position of the Salary box/text based on the length of the job box/text.
[CODE]surface.SetFont( "TargetID" ) surface.SetDrawColor(255,255,255,255) draw.RoundedBox(0, 99, 0, _w + 7, _h + 6, Color(0, 0, 0, 255)) draw.SimpleText("Salary: $"..salar,"TargetID",100,ScrH() - 766)[/CODE] Trai Thet
[QUOTE=AirBlack;41745299][CODE]surface.SetFont( "TargetID" ) surface.SetDrawColor(255,255,255,255) draw.RoundedBox(0, 99, 0, _w + 7, _h + 6, Color(0, 0, 0, 255)) draw.SimpleText("Salary: $"..salar,"TargetID",100,ScrH() - 766)[/CODE] Trai Thet[/QUOTE] That didn't work. It ended up being one glitchy disaster.
It's been more than a day and nobody has figured this out. I need this fixed to startup my server. I'm trying to make it so the first box pushes the second box to the right, instead of the first box overlapping the second box.
Sorry, you need to Log In to post a reply to this thread.