Problem with Cam3d2d

I cannot get this bit of code to function at all… I’ve spent longer than I’m willing to admit trying to find a solution so its time for some help please.
[lua]
function DrawDisplay()
cam.Start3D2D( Vector(0,0,185), Angle( 0, 0, 90 ), 1 )
draw.DrawText( “TEXT”, “ChatFont”, 1, 1, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER )
cam.End3D2D()
end
hook.Add(“HUDPaint”, “DrawShit”, DrawDisplay)
[/lua]

[editline]15th January 2011[/editline]

Only seems to work with “PostPlayerDraw” hook.

Not sure if you got this working, but this works:

[lua]
function DrawDisplay()
cam.Start3D2D(Vector(0, 0, 200), Angle(0, 90, 90), 1)
draw.DrawText(“TEXT”, “ScoreboardText”, 1, 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
cam.End3D2D()
end
hook.Add(“PostDrawOpaqueRenderables”, “DrawShit”, DrawDisplay)
[/lua]

Thanks that seems to do what I want so far.

You may want to avoid being able to see stuff through it:

[lua]
function DrawDisplay()
cam.Start3D2D(Vector(0, 0, 200), Angle(0, 90, 90), 1)
draw.DrawText(“TEXT”, “ScoreboardText”, 1, 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
cam.End3D2D()
end
hook.Add(“PostDrawOpaqueRenderables”, “DrawShit”, DrawDisplay)
[/lua]

Also I’m struggling to figure out how I can use this in an ENT:Draw clientside for an entity made on the server

[lua]
function ENT:Draw()
local pos = self:GetPos()
local ang = self:GetAngles()

ang:RotateAroundAxis(ang:Right(), -90)
ang:RotateAroundAxis(ang:Up(), 90)
cam.Start3D2D(pos, ang, 1)
draw.DrawText(“TEXT”, “ScoreboardText”, 1, 1, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
cam.End3D2D()
end
[/lua]

Should work.

More about where to put that portion that is confusing me, and what needs to be included and what not. The wiki doesn’t really have any information on basic structure…

Just put in it cl_init.lua for the entity and make sure you have AddCSLuaFile(“cl_init.lua”) in init.lua.

attempt to index global ‘ENT’ (a nil value)

[editline]16th January 2011[/editline]

Okay got that part working, but now I’m back to that text not drawing inside of ENT:Draw

[editline]16th January 2011[/editline]

Never mind got everything working, thanks.