• HUD Problem
    11 replies, posted
So I made a HUD and I loaded it to my server, I can see it fine but other people can't. The only see part of it, They don't see salary, wallet, job, or the health bar but I see it fine. They don't get any errors so I have no clue whats wrong, any help would be greatly appreciated. [LUA] function Hud() local client = LocalPlayer() -- local SELF = LocalPlayer() local HUDwidth = CreateClientConVar("HudWidth", 190, true, false) local HUDHeight = CreateClientConVar("HudHeight", 10, true, false) local money = SELF.DarkRPVars.money or 0 local job = SELF.DarkRPVars.job or "" local salary = SELF.DarkRPVars.salary or 0 local hx = 13 -- 9 org makes it go to the right more local hy = ScrH() - (HUDHeight:GetInt() + 20) local hw = HUDwidth:GetInt() local hh = HUDHeight:GetInt() if !client:Alive() then return end -- The backround gray and black local scale = 3; draw.RoundedBox( 0, 0, 0, 1275, 56, Color( 153, 153, 153, 255 ) ) draw.RoundedBox( 0, 2, 2, 1275, 25, Color( 81, 81, 81, 255 ) ) draw.RoundedBox( 0, 2, 27, 1275, 25, Color( 44, 44, 44, 255 ) ) draw.RoundedBox( 0, 10, 10, 210, 30, Color( 0, 0, 0, 255 ) ) -- Ca draw.SimpleText("CA", "ChatFont", 12, 15, Color(255, 255, 255, 255), 0, 0) draw.RoundedBox( 0, 230, 10, 100, 30, Color( 0, 0, 0, 255 ) ) -- Rank draw.SimpleText("Rank:", "Trebuchet20", 232, 15, Color(255, 250, 28, 255), 0, 0) draw.RoundedBox( 0, 340, 10, 200, 30, Color( 0, 0, 0, 255 ) ) -- Health backround bar draw.RoundedBox(1, 950, 8, 300, 30, Color( 255, 0, 0, 125 ) ) -- Draw it first so the real health abr will overlap draw.RoundedBox(0, 950, 10, math.Clamp(LocalPlayer():Health(), 0, 100) * scale, 15, Color(255, 105, 105, 255)) draw.RoundedBox(0, 950, 20, math.Clamp(LocalPlayer():Health(), 0, 100) * scale, 16, Color(255, 0, 0, 255)) draw.SimpleText(client:Health() .. "%", "Trebuchet20", 1075, 12, Color(255, 255, 255, 255), 0, 0) -- Rp name and stuff draw.SimpleText("Rp Name:", "Trebuchet20", 342, 15, Color(255, 255, 255, 255), 0, 0) draw.SimpleText(LocalPlayer():Nick() .. "", "Trebuchet20", 413, 15, Color(255, 255, 255, 255), 0, 0) -- Job draw.RoundedBox( 0, 550, 10, 125, 30, Color( 0, 0, 0, 255 ) ) draw.SimpleText(LANGUAGE.job .. job .. "", "Trebuchet20", hx + 538, hy - 980, Color( 255, 255, 255, 255), 0) -- Salary draw.RoundedBox( 0, 690, 10, 100, 30, Color( 0, 0, 0, 255 ) ) draw.SimpleText(LANGUAGE.salary .. CUR .. salary, "Trebuchet20", hx + 680, hy - 980, Color( 48, 109, 55, 255), 0) -- Wallet draw.RoundedBox( 0, 805, 10, 125, 30, Color( 0, 0, 0, 255 ) ) draw.SimpleText(LANGUAGE.wallet .. CUR .. money, "Trebuchet20", hx + 794, hy - 980, Color( 0, 200, 0, 255), 0) local ply = LocalPlayer() if ply:Health() < 40 then draw.SimpleText("Warning Low Health!", "ChatFont", 10, 60, Color(255, 0, 0, 255), 0, 0) end local ply = LocalPlayer() if ply:IsAdmin() then draw.SimpleText("Admin", "Trebuchet20", 272, 15, Color(255, 250, 28, 255), 0, 0) else draw.SimpleText("Guest", "Trebuchet20", 272, 15, Color(255, 250, 28, 255), 0, 0) end end hook.Add("HUDPaint", "Hud", Hud) [/LUA] I should also mention the gamemode is Darkrp
I have that in init.lua [LUA] AddCSLuaFile("cl_init.lua") [/LUA]
I'm having exactly the same problem, I can see my hud, but other people can't.
I had a friend take a picture of what he was seeing and I took a picture of what I was seeing Me [IMG]http://i54.tinypic.com/34ybvnq.jpg[/IMG] My Friend [IMG]http://i54.tinypic.com/3dj69.jpg[/IMG] [editline]7th November 2010[/editline] He has a smaller screen than me so I think that's why the health bar was cut off, but I have no clue why job, salary, and wallet aren't showing up.
Yeh it's your ScrH() and ScrW() problems with x,y = 0,0 and position it out for all screens and then they will see what you see but it will set it to the height and width of there screen. :wink:
[QUOTE=Cubar;25916023]Yeh it's your ScrH() and ScrW() problems with x,y = 0,0 and position it out for all screens and then they will see what you see but it will set it to the height and width of there screen. :wink:[/QUOTE] Um, can you explain a little bit more, I'm not the best at Lua as you can tell by my name.
How will I position it out for all screens?
you need to do maths with SrcW and srcH , they return the size of the player screen Either you can do maths to make it fit all. Or do if's and elseif's.
Ah, okay I figured out what I need to do, thanks for the help!
We'll, I'm clueless right now, my friend told me I was doing it right, But other people still cannot see it I should have figured since I'm still using my screen values. [LUA] function Hud() local client = LocalPlayer() local SELF = LocalPlayer() local HUDwidth = CreateClientConVar("HudWidth", 190, true, false) local HUDHeight = CreateClientConVar("HudHeight", 10, true, false) local money = SELF.DarkRPVars.money or 0 local job = SELF.DarkRPVars.job or "" local salary = SELF.DarkRPVars.salary or 0 local hx = 13 -- 9 org makes it go to the right more local height = ScrH() local width = ScrW() local hy = ScrH() - (HUDHeight:GetInt() + 20) local hw = HUDwidth:GetInt() local hh = HUDHeight:GetInt() local gap = 5 --[[ Atomic Taco: ScrW( ) - gap - width, ScrH( ) - gap - height Atomic Taco: local gap = 5; --]] if !client:Alive() then return end -- The backround gray and black local scale = 3; -- Backround draw.RoundedBox( 0, 0, 0, 1275, 56, Color( 153, 153, 153, 255 ) ) draw.RoundedBox( 0, 2, 2, 1275, 25, Color( 81, 81, 81, 255 ) ) draw.RoundedBox( 0, 2, 27, 1275, 25, Color( 44, 44, 44, 255 ) ) -- Ca draw.RoundedBox( 0, width - 1270, height - 1015, 210, 30, Color( 0, 0, 0, 255 ) ) draw.SimpleText("Catastrophe Roleplay", "ChatFont", 12, 15, Color(255, 255, 255, 255), 0, 0) -- Rank draw.RoundedBox( 0, width - 1050, height - 1015, 100, 30, Color( 0, 0, 0, 255 ) ) draw.SimpleText("Rank:", "Trebuchet20", width - 1048, height - 1010, Color(255, 250, 28, 255), 0, 0) -- Part of Rp name draw.RoundedBox( 0, width - 940, height - 1015, 200, 30, Color( 0, 0, 0, 255 ) ) -- Health backround bar -- ver down how long width draw.RoundedBox(1, width - 330, height - 1017, 300, 30, Color( 255, 0, 0, 125 ) ) -- Draw it first so the real health abr will overlap - done draw.RoundedBox(0, width - 330, height - 1015, math.Clamp(LocalPlayer():Health(), 0, 100) * scale, 15, Color(255, 105, 105, 255)) -- upper heatlh bar - done draw.RoundedBox(0, width - 330, height - 1005, math.Clamp(LocalPlayer():Health(), 0, 100) * scale, 16, Color(255, 0, 0, 255)) -- bottom health bar -- Done draw.SimpleText(client:Health() .. "%", "Trebuchet20", width - 200, height - 1013, Color(255, 255, 255, 255), 0, 0) -- Health text - Done -- Rp name and stuff -- Rp Name: is fine -- Name is fine draw.SimpleText("Rp Name:", "Trebuchet20", width - 935 , height - 1010, Color(255, 255, 255, 255), 0, 0) -- done draw.SimpleText(LocalPlayer():Nick() .. "", "Trebuchet20", width - 860, height - 1010, Color(255, 255, 255, 255), 0, 0) -- Done -- Job -- Text is fine draw.RoundedBox( 0, width - 727, height - 1015, 125, 30, Color( 0, 0, 0, 255 ) ) -- Done draw.SimpleText(LANGUAGE.job .. job .. "", "Trebuchet20", width - 725, height - 1010, Color( 255, 255, 255, 255), 0) -- Done -- Salary -- Text is fine draw.RoundedBox( 0, width - 587, height - 1015, 100, 30, Color( 0, 0, 0, 255 ) ) -- Done draw.SimpleText(LANGUAGE.salary .. CUR .. salary, "Trebuchet20", width - 585, height - 1010, Color( 48, 109, 55, 255), 0) -- Done -- Wallet -- Text is fine draw.RoundedBox( 0, width - 477, height - 1015, 125, 30, Color( 0, 0, 0, 255 ) ) -- Done draw.SimpleText(LANGUAGE.wallet .. CUR .. money, "Trebuchet20", width - 475, height - 1010, Color( 0, 200, 0, 255), 0) -- Done local ply = LocalPlayer() if ply:Health() < 40 then draw.SimpleText("Warning Low Health!", "ChatFont", 10, 60, Color(255, 0, 0, 255), 0, 0) end local ply = LocalPlayer() if ply:IsAdmin() then draw.SimpleText("Admin", "Trebuchet20", width - 1008, height - 1010, Color(255, 250, 28, 255), 0, 0) else draw.SimpleText("Guest", "Trebuchet20", width - 1008, height - 1010, Color(255, 250, 28, 255), 0, 0) end end hook.Add("HUDPaint", "Hud", Hud) [/LUA] If someone could give me and example of how to fix it for all screens or help me out that would be great.
width / 5, height / 3, x = 0, y = 1
Sorry, you need to Log In to post a reply to this thread.