Hey:)
I'm remaking some DarkRP code. I'm making it so when you look at someone, depending on the size of their name
the box will change size to how long their name is.
I want it to be a minimum of 45 so that the health text can fit in there, but also I'm trying to make it so, if their name is longer than the default size,
It automatically, makes the box wider. This is the code so far.
[LUA]
draw.RoundedBox(8, pos.x - 2, pos.y - 10, string.len(ply:Nick())*45, 55, Color(75, 75, 75, 135))
draw.SimpleTextOutlined(ply:Nick(),"TargetID",pos.x + 1,pos.y + 1,Color(255,255,255,200),TEXT_ALIGN_LEFT,TEXT_ALIGN_LEFT,2, Color(0,0,0,200))
draw.SimpleTextOutlined(HealthStat,"TargetID",pos.x + 1,pos.y + 21,HealthColor,TEXT_ALIGN_LEFT,TEXT_ALIGN_LEFT,2, Color(0,0,0,200))
[/LUA]
At the moment, the size glitches and goes all weird. It either goes right to the end of the screen, or it goes really small.
Thanks so much:)
All help is appreciated.
Hey
Thank you so much! :)
But how would I make it so it starts at the width of 45 and then if the text width is any wider than 45 then the box would go to the size of the text?
after you get w and h just do a check
if w <= 45 then w = 45 end
w = math.max( w, 45 )
Sorry, you need to Log In to post a reply to this thread.