• Temporary hud on players screen
    10 replies, posted
Hey How do you put something on the players screen like a hud? And how do you change what you posted on the screen? And last, how do you remove what you posted on the players screen?
[code] local shouldDraw = true -- set it to false when you no longer want to draw. hook.Add("HUDPaint", "NameYourHook", function() if (shouldDraw) then -- Paint your HUD end end) [/code] And then you draw stuff with these: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:draw]Library: draw[/url] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Category:surface]Library: surface[/url]
So i just paint in the function what i want it to the screen, and if the boolean is false it disappears?
[QUOTE=TheEvilDirect;47658259]So i just paint in the function what i want it to the screen, and if the boolean is false it disappears?[/QUOTE] Yes, HUDPaint is called every frame.
When i make a the hudpaint function inside of cl_init.lua. There doesnt appear any boxes(Made a simple box to test). And im not getting any errors
Your code?
[LUA] hook.Add("HUDPaint", "NameYourHook", function() surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(0,0,205,101) end) [/LUA]
Whats the full path to the file? It might not be getting loaded
I placed the cl init beside my init file. And the init file is being loaded
[QUOTE=TheEvilDirect;47665010]I placed the cl init beside my init file. And the init file is being loaded[/QUOTE] where is your init file? is this for an entity? lua/autorun/ = put files that should be on server and client(and you can use IF( SERVER ) ) etc lua/autorun/server = server only lua/autorun/client = client only
Unless you're using an image use surface.DrawRect(), otherwise you need to set your material first.
Sorry, you need to Log In to post a reply to this thread.