if your intent is to draw some text on the screen then stop drawing after five seconds,
hook.Add( “HUDPaint”, “DrawMyText”, function()
if DrawTime and RealTime() - DrawTime <= 5 then
draw.DrawText( “Hello there!”, “TargetID”, ScrW() * 0.5, ScrH() * 0.25, Color( 255, 255, 255 ), TEXT_ALIGN_CENTER )
concommand.Add( “zcore_tes1t”, function()
DrawTime = RealTime()
an explanation for why yours doesn’t work:
drawing things onto the screen needs to be called in a 2D context. HUDPaint provides this context. there are other hooks too. pick one you’d like, i’d recommend HUDPaint for this.
even if your calling draw.DrawText was in a 2D rendering context, it would only be visible for a single frame, which is why you need to hook it.
you can switch from 3D contexts to 2D contexts using
cam.Start3D2D and vice versa with