• How to use draw.DrawText??
    2 replies, posted
I want print draw.DrawText after 5 seconds draw.DrawText remove [CODE]function DrawBox(player, command, arguments) draw.DrawText( "Hello there!", "TargetID", ScrW() * 0.5, ScrH() * 0.25, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER ) end concommand.Add( "zcore_tes1t", DrawBox )[/CODE] not work I don't know why please help me
I can barely understand your post. This is all I can tell you: Use print to print And [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/timer/Simple]timer.Simple[/url] for the timer
if your intent is to draw some text on the screen then stop drawing after five seconds, [lua] local DrawTime 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 ) end end ) concommand.Add( "zcore_tes1t", function() DrawTime = RealTime() end ) [/lua] 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 [url=http://wiki.garrysmod.com/page/Render_Order]other hooks[/url] too. pick one you'd like, i'd recommend HUDPaint for this. even if your calling draw.DrawText [i]was[/i] 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 [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cam/Start3D2D]cam.Start3D2D[/url] and vice versa with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/cam/Start3D]cam.Start3D[/url]
Sorry, you need to Log In to post a reply to this thread.