need help with attaching text to vehicle

Hi!

Im trying to make a digital gauge (for starters, ill move to analog later) for car so that the one driving it could see the speed:

http://shrani.si/f/2l/bk/wDcPQO8/countryside0008.jpg

I have managed to get the velocity of player on HUD:



hook.Add("HUDPaint", "DrawSpeedo", function()
        
    surface.CreateFont("coolvetica", 32, 400, false, false, "douchebag")
    
    surface.SetTextColor(255, 255, 255, 255)
    
    surface.SetTextPos(34, (ScrH()/2)+(ScrH()/4))
    surface.SetFont("douchebag")
    
    local speed = LocalPlayer():GetVelocity()
    local velocity1 = speed * (15/352) * 1.609344
    local velocity2 = speed * (15/352)
    local text = string.format("Velocity: %i kph %i mph", velocity1:Length(), velocity2:Length())
    
    surface.DrawText(text)
end)


Now I want to put that text on car’s digital screen and make it show its speed, not player speed and I need help with that as I am a lua beginner (but I know basic programming stuff - been to college for 1.5 years). I was thinking to maybe add an additional attachment to mark the place where the text will be?
Its probably easy but you know how it is when you dont know all the hooks ‘n’ stuff well yet.

Later I plan also to add odometer, but first things first.

Thanks for any help!

You need cam2d3d.

What is that? I cant find anything on google about it.

gmod wiki.

took 2 secs.

Sorry, when I wrote cam2d3d into google it didnt find anything. Maybe its our localized version of google. Thanks anyway for response!

Edit: Oh man, this is so confusing :S Am I looking at the right thing? http://luabin.overvprojects.nl/?path=/gamemodes/sandbox/entities/weapons/gmod_tool/cl_viewscreen.lua

For Tool Gun Garry used

function SWEP:RenderScreen()
(http://luabin.overvprojects.nl/?path...viewscreen.lua)

what must I use instead of SWEP to draw onto car’s screen?

The car doesn’t have a “screen”. You need to add a function to the “PostDrawOpaqueRenderables” hook that draws the text at the car’s position plus the position of where you want to draw it. (For example, if you add (0, 0, 100) to the car’s pos, it would show up somewhere above it) The 3D drawing is done with **[Cam.Start3D2D

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

But I have read here: http://www.facepunch.com/threads/931152/123 that PostDrawOpaqueRenderables is a gamemode hook not Entity hook :S Is there any example I can follow to achieve my goal? :S