text above a sent?

hello guys , how do i make a text above a sent? , i mean like if i spawn a sent it will appear a text above it like sent_ball , if you guys know how to make this please tell me :slight_smile:

//Thanks

and english is not my first language so just respect it :slight_smile:

[editline]07:59PM[/editline]

http://img297.imageshack.us/img297/6879/showo.jpg

[lua]
function ShowClass()

local trace = { }
trace.start = LocalPlayer():EyePos();
trace.endpos = trace.start + LocalPlayer():GetAimVector() * 150;
trace.filter = LocalPlayer();

if( tr.Entity:IsValid() ) then

local pos = tr.Entity:GetPos():ToScreen();

draw.DrawText( tr.Entity:GetClass(), “ChatFont”, pos.x, pos.y, Color( 255, 255, 255, 255 ) );

end

end
hook.Add( “HUDPaint”, “ShowClass”, ShowClass );
[/lua]

Basicly, when the player looks at an object in the trace, draw it’s class on it.

do i put this is a lua file or in the sent file?

Clientside lua file

Would look better in 3d2d.

That will error if you aren’t looking at anything because trace.Entity will be nil and you are calling a method on it. You need to check for nil before you check if it is valid, **[G.ValidEntity

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.ValidEntity)** does this for you.

going to try that

[editline]08:40PM[/editline]

didnt work :frowning:

Please post what didn’t work about it(Error’s or w/e)

Though like |FlapJack| said, it would look better in 3d3d, if you want to do that take a look at this:

**[Cam.Start3D2D

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Cam.Start3D2D)**

Its fixed naw!