I am trying to set custom HUD for my server. It's already done, but there's a problem. The hud is very buggy on different resolutions. The problem is the text is unaligned with the numerical value (this value is aligned perfectly with all resolutions), so I decided to use \n for the text and the numerical value, since one is on top of another. The problem is I don't know how to. Here's the code:
Code:
[CODE] -- Draw health
local health = math.max(0, client:Health())
local health_y = y + margin
local healthtext = string.format("\n HEALTH")
PaintBar(x + margin, health_y - (margin*6), bar_width + (margin*10), (margin*12), health_colors, health)
PaintBar(x + (margin*50), health_y - (margin*4), bar_width + (margin*15), (margin*10), health_colors, health)
ShadowedText(tostring(health) healthtext, "LargeText", width - (margin*9), health_y + margin, Color(255, 255, 255, 255), TEXT_ALIGN_RIGHT, TEXT_ALIGN_RIGHT)
if ttt_health_label:GetBool() then
local health_status = util.HealthToString(health)
draw.SimpleText(L[health_status], "TabLarge", x + margin*2, health_y + bar_height/2, COLOR_WHITE, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
end[/CODE]
in local health =, I tried "string.format("\n HEALTH") + math.max(0, client:Health())", and I got a LUA error in server console saying attempt to perform arithmetic on a string value, which is true, but I need to know how to combine them.
And yes, this is for TTT.
Please, someone help.. this problem has been killing me all day :suicide:
Bump? Still can't figure it out.
In order to to get the fix this try using
[lua]
local w = ScrW()
local h = ScrH()
[/lua]
I can't see all your code but I'm assuming your using set numerical values for x and y. Which will give you the 'set' position (I don't know how else to word it). So people with monitors 1024x720 won't have the 'value' 1920. But a resolution 1920x1200 will have the value 1920 on width (x), but not on height. (y)
Sorry, you need to Log In to post a reply to this thread.