• draw.RoundedBox random resize
    2 replies, posted
Hey guys, I just started making a DarkRP HUD and some weird shit went down... I wanted the box containing the name of the player to be the size of the players name, so I used surface.getTextSize. It worked fine, however when the user goes to type something into the chatbox it makes the box slightly bigger, longer nicknames seem to make the box resize upon entering the chatbox more than shorter names. Any help would be appreciated. Code: [CODE]local function DrawHUD() -- Money Variables v1 = LocalPlayer().DarkRPVars.money if not v1 then v1 = "" end v2 = LocalPlayer().DarkRPVars.salary if not v2 then v2 = "" end -- More Variables local nicksize = surface.GetTextSize(LocalPlayer():Nick()) // USER // -- User Icon Box draw.RoundedBox(4, 15, ScrH() - 40, 30, 30, Color(4,4,4,255)) -- User Icon surface.SetTexture(surface.GetTextureID("gui/silkicons/user")) surface.SetDrawColor(255,255,255) surface.DrawTexturedRect(22,ScrH() - 34,16,16) -- User Name Box draw.RoundedBox(4, 60, ScrH() - 40, nicksize, 24, Color(4,4,4,255)) surface.SetDrawColor(255,255,255) -- User Name Text draw.SimpleText(LocalPlayer():Nick(),"TargetID", 25 + 45,ScrH() - 21, Color(255,255,255), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP) Scrw, Scrh = ScrW(), ScrH() RelativeX, RelativeY = 0, Scrh GunLicense() Agenda() JobHelp() DrawVoiceChat() LockDown() Arrested() AdminTell() end[/CODE]
You need to set the font before you get the text size.
Worked like a charm. Thank you so much man, that stumped me for hours. <insert speech here about how Wizard of Ass is the best guy ever>
Sorry, you need to Log In to post a reply to this thread.