Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- net.Receive("sendRightClickMenu", function()
- local spellsTable = net.ReadTable()
- local wandweapon = LocalPlayer():GetActiveWeapon()
- if not wandweapon.Window then
- wandweapon.Favourite = {}
- local spells = hp_mstick.GetMagic()
- local i = 0
- for k, v in pairs(spells) do
- if file.Exists("harry_potter/" .. v.name .. ".txt", "DATA") then
- table.insert(wandweapon.Favourite, v.name)
- end
- end
- wandweapon.Window = vgui.Create("DFrame")
- wandweapon.Window:SetPos(ScrW()*0.75 , ScrH()*0.45)
- wandweapon.Window:SetSize(300, 390)
- wandweapon.Window:SetTitle(" ")
- wandweapon.Window:ShowCloseButton(false)
- local alph = 0
- for k, v in pairs(spells) do
- spellsTable[i] = spells[k]["name"]
- i = i + 1
- end
- wandweapon.Window:MakePopup()
- wandweapon.Window.Paint = function()
- if wandweapon.Window and IsValid(wandweapon.Window) then
- if alph < 200 then alph = alph + 3 end
- local w = wandweapon.Window:GetWide()
- local t = wandweapon.Window:GetTall()
- draw.RoundedBox(0, 0, 0, w, t, Color(0, 0, 0, alph))
- end
- end
- local btn = vgui.Create("DButton", wandweapon.Window)
- btn:SetPos(255, 10)
- btn:SetSize(40, 20)
- btn:SetText("X")
- btn:SetFont("MagicStickFont2")
- btn:SetColor(Color(255, 255, 255))
- btn.DoClick = function()
- if wandweapon.Window and IsValid(wandweapon.Window) then wandweapon.Window:Close() wandweapon.Window = nil else chat_error_hp("Window is not valid!") end
- end
- btn.Paint = function()
- local w = btn:GetWide()
- local t = btn:GetTall()
- draw.RoundedBox(0, 0, 0, w, t, Color(255, 100, 100, alph * 0.7))
- end
- local mg = vgui.Create("DListView", wandweapon.Window)
- mg:SetPos(12.5, 35)
- mg:SetSize(275, 330)
- mg:AddColumn("Spell name")
- mg.Paint = function()
- local w = mg:GetWide()
- local t = mg:GetTall()
- draw.RoundedBox(0, 0, 0, w, t, Color(200, 250, 255, alph * 0.5))
- end
- local lab = vgui.Create("DLabel", wandweapon.Window)
- lab:SetPos(125, 365)
- lab:SetText("SPELLS")
- lab:SetFont("Trebuchet24")
- lab:SizeToContents()
- for k, v in pairs(spellsTable) do
- mg:AddLine(v, "")
- end
- mg.OnClickLine = function(parent, line, isselected)
- wandweapon.Window:Close()
- wandweapon.Window = nil
- if not wandweapon.Weapon or not wandweapon then return end
- net.Start("setMagicTypeHP")
- net.WriteEntity(wandweapon)
- net.WriteString(line:GetValue(1))
- net.SendToServer()
- end
- if not wandweapon.Weapon or not wandweapon then return end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment