Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.10 KB | None | 0 0
  1. function Menu()
  2.     local CurrentLevel = 0
  3.     local currentTeam = LocalPlayer():Team()
  4.     local TeamColor, FontColor
  5.  
  6.     if LocalPlayer().CanCustomizeLoadout == false then
  7.         return
  8.     end
  9.  
  10.     --[[if currentTeam == 0 then --fucking scrubs
  11.         TeamColor = Color( 76, 175, 80 )
  12.         FontColor = Color( 255, 255, 255 )
  13.     elseif currentTeam == 1 then --red
  14.         TeamColor = Color( 244, 67, 54 )
  15.         FontColor = Color( 255, 255, 255 )
  16.     elseif currentTeam == 2 then --blue
  17.         TeamColor = Color( 33, 150, 243 )
  18.         FontColor = Color( 255, 255, 255 )
  19.     end]]
  20.  
  21.     if currentTeam == 0 then --???
  22.         TeamColor = Color( 255, 255, 255 )
  23.         FontColor = Color( 0, 0, 0 )
  24.     elseif currentTeam == 1 then --red
  25.         TeamColor = Color( 100, 15, 15 )
  26.         FontColor = Color( 0, 0, 0 )
  27.     elseif currentTeam == 2 then --blue
  28.         TeamColor = Color( 33, 150, 243, 100 )
  29.         FontColor = Color( 0, 0, 0 )
  30.     elseif currentTeam == 3 then --black/FFA
  31.         TeamColor = Color( 15, 160, 15 )
  32.         FontColor = Color( 0, 0, 0 )
  33.     end
  34.  
  35.     --if main then return end
  36.     main = vgui.Create( "DFrame" )
  37.     main:SetSize( ScrW() - 70, ScrH() - 70 )
  38.     main:SetTitle( "" )
  39.     main:SetVisible( true )
  40.     main:SetDraggable( false )
  41.     main:ShowCloseButton( false )
  42.     main:MakePopup()
  43.     main:Center()
  44.     main.Paint = function()
  45.         Derma_DrawBackgroundBlur( main, CurTime() )
  46.         surface.SetDrawColor( 0, 0, 0, 250 )
  47.         surface.DrawRect( 0, 0, main:GetWide(), main:GetTall() )
  48.     end
  49.  
  50.     local tabs = vgui.Create( "DPanel", main )
  51.     tabs:SetPos( 0, 0 )
  52.     tabs:SetSize( main:GetWide(), 30 )
  53.     tabs.Paint = function()
  54.         surface.SetDrawColor( TeamColor )
  55.         surface.DrawRect( 0, 0, tabs:GetWide(), tabs:GetTall() )
  56.     end
  57.  
  58.     --//Can be found in sv_loadoutmenu.lua
  59.     local roles = { }
  60.     net.Start( "RequestRoles" )
  61.     net.SendToServer()
  62.     net.Receive( "RequestRolesCallback", function()
  63.         r = net.ReadTable()
  64.         roles = r
  65.         AttemptMenu()
  66.     end )
  67.  
  68.     --//Can be found in sv_lvlhandler.lua
  69.     local lvl
  70.     net.Start( "RequestLevel" )
  71.     net.SendToServer()
  72.     net.Receive( "RequestLevelCallback", function()
  73.         l = net.ReadInt( 8 ) or 1
  74.         lvl = l
  75.         AttemptMenu()
  76.     end )
  77.  
  78.     function AttemptMenu()
  79.         if lvl and roles then
  80.             local rbutton = { }
  81.             local role = { }
  82.             for k, v in pairs( roles ) do
  83.                 local teamnumber = LocalPlayer():Team()
  84.        
  85.                 rbutton[ v[ teamnumber ] ] = vgui.Create( "DButton", tabs )
  86.                 rbutton[ v[ teamnumber ] ]:SetSize( tabs:GetWide() / ( #roles + 1 ), tabs:GetTall() )
  87.                 rbutton[ v[ teamnumber ] ]:SetPos( k * ( tabs:GetWide() / ( #roles + 1 ) ) - ( tabs:GetWide() / ( #roles + 1 ) ), 0 )
  88.                 rbutton[ v[ teamnumber ] ]:SetText( "" )
  89.                 rbutton[ v[ teamnumber ] ].Paint = function()
  90.                     if lvl >= k then
  91.                         draw.SimpleText( v[ teamnumber ], "Exo 2 Tab", rbutton[ v[ teamnumber ] ]:GetWide() / 2, rbutton[ v[ teamnumber ] ]:GetTall() / 2, FontColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  92.                     else
  93.                         draw.SimpleText( "Locked", "Exo 2 Tab", rbutton[ v[ teamnumber ] ]:GetWide() / 2, rbutton[ v[ teamnumber ] ]:GetTall() / 2, FontColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  94.                     end
  95.                 end
  96.                 rbutton[ v[ teamnumber ] ].DoClick = function()
  97.                     print( "rbutton.DoClick called" )
  98.                     if lvl >= k then
  99.                         tabs:SetActiveTab( role )
  100.                         LocalPlayer():EmitSound( "buttons/button22.wav" ) --shouldn't this be surface.PlaySound?
  101.                         print( "Setting active tab # " )
  102.                     end
  103.                 end
  104.  
  105.                 role[ v[ teamnumber ] ] = vgui.Create( "DPanel", main )
  106.                 role[ v[ teamnumber ] ]:SetSize( main:GetWide(), main:GetTall() - tabs:GetTall() )
  107.                 role[ v[ teamnumber ] ]:SetPos( 0, tabs:GetTall() )
  108.                 role[ v[ teamnumber ] ].Paint = function()
  109.                
  110.                 tabs:AddSheet( "Level", role[ v[ teamnumber ] ] )
  111.                 end
  112.             end
  113.         end
  114.     end
  115.  
  116.     local spawn = vgui.Create( "DButton", tabs )
  117.     spawn:SetSize( tabs:GetWide() / ( #roles + 1 ), tabs:GetTall() )
  118.     spawn:SetPos( tabs:GetWide() - spawn:GetWide() )
  119.     spawn:SetText( "Redeploy" )
  120.     spawn.DoClick = function()
  121.         main:Close()
  122.     end
  123.    
  124.  
  125.     end
  126.  
  127.     --[[local rbutton1 = vgui.Create( "DButton", tabs )
  128.     rbutton1:SetSize( tabs:GetWide() / 9, tabs:GetTall() )
  129.     rbutton1:SetPos( 0, 0 )
  130.     rbutton1.Paint = function()
  131.         draw.SimpleText( "insert_role_name_here", "insert_font_here", primariesbutton:GetWide() / 2, primariesbutton:GetTall() / 2, FontColor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  132.         return true
  133.     end
  134.     rbutton1.DoClick = function()
  135.         choose:SetActiveTab( role1 )
  136.         LocalPlayer():EmitSound( "buttons/button22.wav" )
  137.         --ClearInfo()
  138.         hint:SetVisible( false )
  139.     end
  140.     local rbutton2 = vgui.Create( "DButton", tabs )
  141.  
  142.     local rbutton3 = vgui.Create( "DButton", tabs )
  143.     local rbutton4 = vgui.Create( "DButton", tabs )
  144.     local rbutton5 = vgui.Create( "DButton", tabs )
  145.     local rbutton6 = vgui.Create( "DButton", tabs )
  146.     local rbutton7 = vgui.Create( "DButton", tabs )
  147.     local rbutton8 = vgui.Create( "DButton", tabs )
  148.  
  149.     local pages = vgui.Create( "DPropertySheet", main )
  150.     pages:SetPos( 0, tabs:GetTall() )
  151.     pages:SetSize( main:GetWide() , main:GetTall() / 10 )
  152.     pages.Paint = function() end
  153.  
  154.     local role1 = vgui.Create( "DPanel", pages )
  155.  
  156.     pages:AddSheet( "Level1", role1 )
  157.     pages:AddSheet( "Level2", role2 )
  158.     pages:AddSheet( "Level3", role3 )
  159.     pages:AddSheet( "Level4", role4 )
  160.     pages:AddSheet( "Level5", role5 )
  161.     pages:AddSheet( "Level6", role6 )
  162.     pages:AddSheet( "Level7", role7 )
  163.     pages:AddSheet( "Level8", role8 )]]
  164.  
  165.     --[[ --This is option 1 with 1 column and 3 jutting rows, kinda like "|=" but with 1 more row
  166.     --Role and player information column
  167.     local col = vgui.Create( "DPanel", main )
  168.     col:SetPos( 0, 0 )
  169.     col:SetSize( main:GetWide() / 4, main:GetTall() )
  170.     col.Paint = function()
  171.         surface.SetDrawColor( TeamColor )
  172.         surface.DrawOutlinedRect( 0, 0, col:GetWide(), col:GetTall() )
  173.     end
  174.  
  175.     local spawn = vgui.Create( "DButton", col )
  176.     spawn:SetSize( col:GetWide() - 20, col:GetTall() / 8 )
  177.     spawn:SetPos( 10, col:GetTall() - spawn:GetTall() - 10 )
  178.     spawn:SetText( "Redeploy" )
  179.     spawn.DoClick = function()
  180.         main:Close()
  181.     end
  182.  
  183.     --Primary weapon list, attachment list, and gun information
  184.     local row1 = vgui.Create( "DPanel", main )
  185.     row1:SetPos( col:GetWide(), 0 )
  186.     row1:SetSize( main:GetWide() - col:GetWide(), main:GetTall() / 3.0 )
  187.     row1.Paint = function()
  188.         surface.SetDrawColor( TeamColor )
  189.         surface.DrawOutlinedRect( 0, 0, row1:GetWide(), row1:GetTall() )
  190.     end
  191.  
  192.     --Secondary weapon list, attachment list, and gun information
  193.     local row2 = vgui.Create( "DPanel", main )
  194.     row2:SetPos( col:GetWide(), row1:GetTall() )
  195.     row2:SetSize( main:GetWide() - col:GetWide(), main:GetTall() / 3.0 + 2 )
  196.     row2.Paint = function()
  197.         surface.SetDrawColor( TeamColor )
  198.         surface.DrawOutlinedRect( 0, 0, row2:GetWide(), row2:GetTall() )
  199.     end
  200.  
  201.     --Equipment list and model, nothing else, should I add something else?
  202.     local row3 = vgui.Create( "DPanel", main )
  203.     row3:SetPos( col:GetWide(), row1:GetTall() + row2:GetTall() )
  204.     row3:SetSize( main:GetWide() - col:GetWide(), main:GetTall() / 3.0 )
  205.     row3.Paint = function()
  206.         surface.SetDrawColor( TeamColor )
  207.         surface.DrawOutlinedRect( 0, 0, row3:GetWide(), row3:GetTall() )
  208.     end]]
  209. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement