• draw.RoundedBox not working
    7 replies, posted
I'm working on creating a gamemode and cannot seem to get draw.RoundedBox to work. Here is my code: [lua] if SERVER then hook.Add( "ShowTeam", "TeamSelect", function( ply ) ply:ConCommand( "teamselect" ) end) else function TeamSelect() local W = ScrW() - 120 local H = ScrH() - 240 local PosW = W / 2 local PosH = H / 2 draw.RoundedBox( 8, 100, 50, 100, 23, Color( 39, 174, 96, 155 ) ) end concommand.Add( "teamselect", TeamSelect ) end [/lua] No errors or anything, it just ignores the code.
That's not how it works. [editline]2nd January 2014[/editline] You either gotta use HUDPaint hook to draw stuff, or what better in this case, create a panel and override it's PANEL:Paint hook
[QUOTE=Robotboy655;43388727]That's not how it works. [editline]2nd January 2014[/editline] You either gotta use HUDPaint hook to draw stuff, or what better in this case, create a panel and override it's PANEL:Paint hook[/QUOTE] How exactly would I do this? Sorry, I haven't really done HUDs.
Right, I get that part. How would I make it draw when a player presses F2 is what I don't get.
You create a panel using "local a = vgui.Create("DFrame")" panel and do "function a:Paint( w,h ) /*draw here*/ end". Don't forget to set size and position of that frame, as well as a:MakePopup(). See wiki for any further questions about these functions.
Sorry, you need to Log In to post a reply to this thread.