Advertisement
Guest User

Untitled

a guest
Aug 14th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.10 KB | None | 0 0
  1. local function ButtonPaint( panel, str )
  2.          
  3.     panel:SetText( "" ) -- Can't find the varible that holds the text, so I'm just going to go this different way.
  4.          
  5.     panel.Paint = function()
  6.          
  7.         draw.RoundedBox( 4, 0, 0, panel:GetWide(), panel:GetTall(), Color( 40, 40, 40, 255 ) )
  8.         draw.RoundedBox( 4, 6, 1, panel:GetWide() - 12, panel:GetTall() - 2, panel.newcol or Color( 60, 60, 60, 255 ) )
  9.         draw.SimpleText( str, "MenuLarge", panel:GetWide() / 2, panel:GetTall() / 2, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  10.              
  11.     end
  12.          
  13.     panel.OnCursorEntered = function()
  14.          
  15.         panel.newcol = Color( 100, 100, 100, 255 )
  16.         surface.PlaySound( "Friends/friend_join.wav" )
  17.              
  18.     end
  19.     panel.OnCursorExited = function() panel.newcol = false end
  20.          
  21. end
  22.      
  23. local function Menu()
  24.          
  25.     local Frame = vgui.Create( "DFrame" )
  26.     Frame:SetSize( 150, 97 )
  27.     // Frame:SetPos( ScrW() / 2 - Frame:GetWide() / 2, ScrH() / 2 - Frame:GetTall() / 2 )
  28.     Frame:Center() -- Thank you C-Unit, I did not know that this existed.
  29.     Frame:SetTitle( "Some title" )
  30.     Frame:ShowCloseButton( false )
  31.     Frame:MakePopup( true )
  32.     Frame:ParentToHUD()
  33.     Frame.Paint = function()
  34.              
  35.         draw.RoundedBox( 4, 0, 0, Frame:GetWide(), Frame:GetTall(), Color( 40, 40, 40, 255 ) )
  36.         draw.RoundedBox( 4, 1, 22, Frame:GetWide() - 2, Frame:GetTall() - 23, Color( 90, 90, 90, 255 ) )
  37.              
  38.         for i = 1, 20 do
  39.                  
  40.             local val = 50 + ( i * 2 )
  41.             surface.SetDrawColor( val, val, val, 255 )
  42.             surface.DrawRect( 1, Frame:GetTall() - ( ( i * 2 ) + 1 ), Frame:GetWide() - 2, 2 )
  43.                  
  44.         end
  45.              
  46.     end
  47.          
  48.     local Login = vgui.Create( "DButton", Frame )
  49.     Login:SetPos( 5, 27 )
  50.     Login:SetSize( Frame:GetWide() - 10, 30 )
  51.     Login.DoClick = function()  end -- Some login function here.
  52.     ButtonPaint( Login, "Login" )
  53.          
  54.     local Register = vgui.Create( "DButton", Frame )
  55.     Register:SetPos( 5, 62 )
  56.     Register:SetSize( Frame:GetWide() - 10, 30 )
  57.     Register.DoClick = function() RunConsoleCommand( "vb4_registrer" )  end
  58.     ButtonPaint( Register, "Register" )
  59.          
  60. end
  61. concommand.Add( "Test_Menu", Menu ) -- Just a simple command to test the menu, do the way C-Unit did by hooking it on Initialize when done testing.
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. AND
  80.  
  81. print("Lodaed vb client")
  82.  
  83. concommand.Add("vb4_register", function( p, c, a )
  84.     local DFrame1 = vgui.Create('DFrame')
  85.     DFrame1:SetSize(300, 300)
  86.     DFrame1:SetPos(0, 0)
  87.     DFrame1:SetTitle('Forum Registeration')
  88.     DFrame1:SetSizable(true)
  89.     DFrame1:SetDeleteOnClose(false)
  90.     DFrame1:MakePopup()
  91.  
  92.     local DTextEntry1 = vgui.Create('DTextEntry', DFrame1)
  93.     DTextEntry1:SetSize(100, 20)
  94.     DTextEntry1:SetPos(5, 50)
  95.     DTextEntry1:SetText('')
  96.  
  97.     local DLabel1 = vgui.Create('DLabel', DFrame1)
  98.     DLabel1:SetPos(8, 30)
  99.     DLabel1:SetText('Username:')
  100.     DLabel1:SizeToContents()
  101.  
  102.     local DTextEntry2 = vgui.Create('DTextEntry', DFrame1)
  103.     DTextEntry2:SetSize(100, 20)
  104.     DTextEntry2:SetPos(5, 100)
  105.     DTextEntry2:SetText('')
  106.  
  107.     local DLabel2 = vgui.Create('DLabel', DFrame1)
  108.     DLabel2:SetPos(8, 80)
  109.     DLabel2:SetText('Password:')
  110.     DLabel2:SizeToContents()
  111.  
  112.     local DLabel3 = vgui.Create('DLabel', DFrame1)
  113.     DLabel3:SetPos(8, 130)
  114.     DLabel3:SetText('Email:')
  115.     DLabel3:SizeToContents()
  116.  
  117.     local DTextEntry3 = vgui.Create('DTextEntry', DFrame1)
  118.     DTextEntry3:SetSize(100, 20)
  119.     DTextEntry3:SetPos(5, 150)
  120.     DTextEntry3:SetText('')
  121.  
  122.     // This is if you want a logo right of your username, password, and email.
  123.     /*
  124.     local DPanel1 = vgui.Create('DImage', DFrame1)
  125.     DPanel1:SetSize(296, 272)
  126.     DPanel1:SetPos(1, 25)
  127.     Dpanel1:SetMaterial( ) // Place some image here
  128.     */
  129.    
  130.     local DButton1 = vgui.Create('DButton', DFrame1)
  131.     DButton1:SetSize(70, 25)
  132.     DButton1:SetPos(115, 271)
  133.     DButton1:SetText('Submit')
  134.     DButton1.DoClick = function()
  135.         p:Register( DTextEntry1:GetValue(), DTextEntry2:GetValue(), DTextEntry3:GetValue() )
  136.     end
  137. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement