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:
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!