• HUD Problem
    1 replies, posted
Hi, I've been making a DarkRP hud. The problem is if the players name is too long it overlaps over the next section of the HUD (I'm doing a long straight hud) How can I make it so when the text becomes longer, the rest of the hud moves with it. Code: [CODE]local function DrawHUD() LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {} v1 = LocalPlayer().DarkRPVars.money if not v1 then v1 = "" end v2 = LocalPlayer().DarkRPVars.salary if not v2 then v2 = "" end draw.RoundedBox(1, 25, ScrH() - 50, 600, 30, Color(25,25,25,200)) surface.SetDrawColor(255,255,255) surface.SetTexture(surface.GetTextureID("gui/silkicons/user")) surface.DrawTexturedRect(1 + 30,ScrH() - 45,16,16) surface.SetTexture(surface.GetTextureID("gui/silkicons/money")) surface.DrawTexturedRect(1 + 250,ScrH() - 45,16,16) draw.SimpleText(LocalPlayer():Nick(),"TargetID", 1 + 60,ScrH() - 27, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText("$" .. v2,"TargetID", 1 + 150,ScrH() - 27, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) draw.SimpleText("$" .. v1,"TargetID", 25 + 30,ScrH() - 145, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) Scrw, Scrh = ScrW(), ScrH() RelativeX, RelativeY = 0, Scrh DoActualHUD() GunLicense() Agenda() JobHelp() DrawVoiceChat() LockDown() Arrested() AdminTell() end[/CODE]
[lua]local width = surface.GetTextSize(text or "")[/lua]
Sorry, you need to Log In to post a reply to this thread.