Guest User

Fuck you Gumble

a guest
May 3rd, 2016
1,626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.66 KB | None | 0 0
  1. net.Receive("sendRightClickMenu", function()
  2.     local spellsTable = net.ReadTable()
  3.     local wandweapon = LocalPlayer():GetActiveWeapon()
  4.  
  5.             if not wandweapon.Window then
  6.                 wandweapon.Favourite = {}
  7.                 local spells = hp_mstick.GetMagic()
  8.                 local i = 0
  9.                 for k, v in pairs(spells) do
  10.                     if file.Exists("harry_potter/" .. v.name .. ".txt", "DATA") then
  11.                         table.insert(wandweapon.Favourite, v.name)
  12.                     end
  13.                 end
  14.            
  15.                 wandweapon.Window = vgui.Create("DFrame")
  16.                 wandweapon.Window:SetPos(ScrW()*0.75 , ScrH()*0.45)
  17.                 wandweapon.Window:SetSize(300, 390)
  18.                 wandweapon.Window:SetTitle(" ")
  19.                 wandweapon.Window:ShowCloseButton(false)
  20.                
  21.                 local alph = 0
  22.                 for k, v in pairs(spells) do
  23.                     spellsTable[i] = spells[k]["name"]
  24.                     i = i + 1
  25.                 end
  26.                 wandweapon.Window:MakePopup()
  27.                 wandweapon.Window.Paint = function()
  28.                     if wandweapon.Window and IsValid(wandweapon.Window) then
  29.                         if alph < 200 then alph = alph + 3 end
  30.                         local w = wandweapon.Window:GetWide()
  31.                         local t = wandweapon.Window:GetTall()                  
  32.                         draw.RoundedBox(0, 0, 0, w, t, Color(0, 0, 0, alph))
  33.                     end
  34.                 end            
  35.  
  36.                 local btn = vgui.Create("DButton", wandweapon.Window)
  37.                 btn:SetPos(255, 10)
  38.                 btn:SetSize(40, 20)
  39.                 btn:SetText("X")
  40.                 btn:SetFont("MagicStickFont2")
  41.                 btn:SetColor(Color(255, 255, 255))
  42.                 btn.DoClick = function()
  43.                     if wandweapon.Window and IsValid(wandweapon.Window) then wandweapon.Window:Close() wandweapon.Window = nil else chat_error_hp("Window is not valid!") end
  44.                 end
  45.  
  46.                 btn.Paint = function()
  47.                     local w = btn:GetWide()
  48.                     local t = btn:GetTall()
  49.                     draw.RoundedBox(0, 0, 0, w, t, Color(255, 100, 100, alph * 0.7))
  50.                 end
  51.  
  52.                 local mg = vgui.Create("DListView", wandweapon.Window)
  53.                 mg:SetPos(12.5, 35)
  54.                 mg:SetSize(275, 330)
  55.                 mg:AddColumn("Spell name")
  56.                 mg.Paint = function()
  57.                     local w = mg:GetWide()
  58.                     local t = mg:GetTall()
  59.                     draw.RoundedBox(0, 0, 0, w, t, Color(200, 250, 255, alph * 0.5))
  60.                 end
  61.  
  62.                
  63.  
  64.                 local lab = vgui.Create("DLabel", wandweapon.Window)
  65.                 lab:SetPos(125, 365)
  66.                 lab:SetText("SPELLS")
  67.                 lab:SetFont("Trebuchet24")
  68.                 lab:SizeToContents()           
  69.  
  70.                 for k, v in pairs(spellsTable) do
  71.                     mg:AddLine(v, "")
  72.                 end        
  73.  
  74.                 mg.OnClickLine = function(parent, line, isselected)
  75.                     wandweapon.Window:Close()
  76.                     wandweapon.Window = nil
  77.                    
  78.                     if not wandweapon.Weapon or not wandweapon then return end
  79.                    
  80.                     net.Start("setMagicTypeHP")
  81.                         net.WriteEntity(wandweapon)
  82.                         net.WriteString(line:GetValue(1))
  83.                     net.SendToServer()
  84.                 end
  85.                     if not wandweapon.Weapon or not wandweapon then return end
  86.             end
  87. end)
Advertisement
Add Comment
Please, Sign In to add comment