Just a quick question, what is wrong with this code? I get no errors client or serverside, but my GUI refuses to appear.
[lua]
PANEL = {}
local width = ScrW()
local height = ScrH()
local wid5 = ScrW() * 0.2
local hei5 = ScrH() * 0.2
hudColors = {
mainBord = Color(100, 100, 100, 255),
mainFill = Color(51, 51, 51, 255)
}
function PANEL:Init()
self:SetSize(width, height);
self:Center()
self:SetVisible(true)
end
function PANEL:Paint()
surface.SetDrawColor(hudColors.mainFill)
surface.DrawRect(height, 0, wid5, hei5)
surface.DrawRect(height, wid5, wid5, hei5)
surface.DrawRect(height, wid5 * 2, wid5, hei5)
surface.DrawRect(height, wid5 * 3, wid5, hei5)
surface.DrawRect(height, wid5 * 4, wid5, hei5)
end
vgui.Register("HUD", PANEL)
[/lua]
snip
[QUOTE=BoowmanTech;40669554]What is the error ?[/QUOTE]
um...
[QUOTE=LilSumac;40669460]Just a quick question, what is wrong with this code? [b]I get no errors client or serverside[/b], but my GUI refuses to appear.[/QUOTE]
Anyways OP, you'll have to call it using vgui.Create
[QUOTE=Derek_SM;40669567]um...
Anyways OP, you'll have to call it using vgui.Create[/QUOTE]
Just now I saw that he said he has no error.
HUD = vgui.Create("HUD")
Put that somewhere in clientside code after you register it.
[QUOTE=bobbleheadbob;40671213]HUD = vgui.Create("HUD")
Put that somewhere in clientside code after you register it.[/QUOTE]
[I]After[/I] I register it? I'll try that out, thanks.
Sorry, you need to Log In to post a reply to this thread.