93 строки
Без EOL
1,8 КиБ
Lua
93 строки
Без EOL
1,8 КиБ
Lua
|
|
local FRAME
|
|
|
|
function permanent.OpenMenu()
|
|
|
|
if IsValid(FRAME) then
|
|
|
|
FRAME:Remove()
|
|
|
|
end
|
|
|
|
FRAME = vgui.Create("DFrame")
|
|
FRAME:SetSize(720, 480)
|
|
FRAME:Center()
|
|
FRAME:MakePopup()
|
|
FRAME:SetSizable(false)
|
|
FRAME:SetTitle("Permanent")
|
|
FRAME:SetIcon("icon16/world.png")
|
|
|
|
local LIST = vgui.Create("DListView", FRAME)
|
|
LIST:Dock(FILL)
|
|
LIST:SetMultiSelect(false)
|
|
LIST:AddColumn("ID")
|
|
LIST:AddColumn("Class")
|
|
LIST:AddColumn("Creator")
|
|
LIST:AddColumn("Time")
|
|
|
|
LIST.OnRowSelected = function(panel, index, row)
|
|
|
|
local MENU = DermaMenu()
|
|
|
|
MENU:AddOption("Copy ID", function()
|
|
|
|
SetClipboardText(row:GetColumnText(1))
|
|
|
|
end):SetIcon("icon16/page_copy.png")
|
|
|
|
MENU:AddOption("Copy SteamID", function()
|
|
|
|
SetClipboardText(row:GetColumnText(3))
|
|
|
|
end):SetIcon("icon16/page_copy.png")
|
|
|
|
MENU:AddOption("Remove", function()
|
|
|
|
net.Start("Permanent", true)
|
|
net.WriteUInt(2, 2)
|
|
net.WriteEntity(row.ent)
|
|
net.SendToServer()
|
|
|
|
end):SetIcon("icon16/page_delete.png")
|
|
|
|
MENU:Open()
|
|
|
|
end
|
|
|
|
local function populate()
|
|
|
|
for _, v in ipairs(ents.GetAll()) do
|
|
|
|
if !v:GetNWBool("IsPermanent") then continue end
|
|
|
|
LIST:AddLine(v:GetNWString("Permanent.ID"), v:GetClass(), v:GetNWString("Permanent.Creator"), os.date("%H:%M:%S - %d/%m/%Y", v:GetNWInt("Permanent.Time"))).ent = v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
local BUTTONS = vgui.Create("DPanel", FRAME)
|
|
BUTTONS:Dock(BOTTOM)
|
|
BUTTONS:SetSize(0, 30)
|
|
BUTTONS.Paint = function() end
|
|
|
|
local RESPAWN = vgui.Create("DButton", BUTTONS)
|
|
RESPAWN:Dock(RIGHT)
|
|
RESPAWN:DockMargin(0, 5, 5, 5)
|
|
RESPAWN:SetSize(100, 0)
|
|
RESPAWN:SetText("Respawn")
|
|
RESPAWN:SetIcon("icon16/arrow_refresh.png")
|
|
RESPAWN.DoClick = function()
|
|
|
|
net.Start("Permanent", true)
|
|
net.WriteUInt(3, 2)
|
|
net.SendToServer()
|
|
|
|
LIST:Clear()
|
|
populate()
|
|
|
|
end
|
|
|
|
populate()
|
|
|
|
end |