local font = surface.CreateFont
font(‘Passport’, {
font = ‘Roboto’,
size = ScreenScale(6),
weight = 1000,
extended = true,
})
font(‘Passport.Close’, {
font = ‘Marlett’,
size = ScreenScale(6),
symbol = true,
extended = true,
})
local frame = Color(31,30,46)
local white = Color(240, 240, 240)
local light = Color(39,38,56)
local gray = Color(200, 200, 200)
local dark = Color(200, 200, 200)
local red = Color(240, 70, 70)
local scarlet = Color(220, 70, 70)
local box = draw.RoundedBox
local text = draw.SimpleText
local create = vgui.Create
local PassportMenu
net.Receive(‘Passport’, function()
if IsValid(PassportMenu) then return end
local client = net.ReadEntity()
local names
if DarkRP then
names = client:Nick()
else
names = net.ReadString()
end
local arrest = net.ReadString()
local age = net.ReadString()
local gender = net.ReadString()
local regtime = tonumber(net.ReadString())
regtime = os.date('%d/%m/%Y', regtime)
local sizing = surface.GetTextSize
local background = create('EditablePanel')
PassportMenu = background
background:SetSize(ScrW() * 0.33, ScrH() * 0.4)
background:Center()
background:MakePopup()
function background:Paint(width, height)
box(12, 12, 12, width, height, frame)
end
local title = background:Add('EditablePanel')
title:SetSize(ScrW() * 0.1, background:GetTall() * 0.07)
title:SetPos(ScrW() * 0.01, background:GetTall() * 0.03)
function title:Paint(width, height)
box(8, 0, 0, width, height, light)
text('Паспорт', 'Passport', width * 0.5, height * 0.5, dark, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
end
local close = background:Add('DButton')
close:SetText('')
close:SetSize(background:GetWide() * 0.045, background:GetTall() * 0.07)
close:SetPos(background:GetWide() * 0.925, background:GetTall() * 0.03)
function close:Paint(width, height)
box(8, 0, 0, width, height, close:IsHovered() and red or scarlet)
text('r', 'Passport.Close', width * 0.5, height * 0.5, frame, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
return true
end
function close:DoClick()
background:Remove()
end
local information = background:Add('EditablePanel')
information:SetSize(ScrW() * 0.31, ScrH() * 0.33)
information:SetPos(ScrW() * 0.01, ScrH() * 0.05)
local money = tostring(10000)
if DarkRP then
money = DarkRP.formatMoney(client:getDarkRPVar('money'))
end
local job = team.GetName(client:Team())
if DarkRP and job == 'Unassigned' then
job = GAMEMODE.DefaultTeam
end
if job == 'Unassigned' then
job = 'Гражданин'
end
local door = tostring(math.random(1, 10))
if DarkRP then
door = #client:getDoorData()
end
function information:Paint(width, height)
box(8, 0, 0, width, height, light)
text('Имя и фамилия', 'Passport.Office', width * 0.45, height * 0.08, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
box(6, width * 0.44, height * 0.12, (width * 0.3) , height * 0.075, frame)
text(names, 'Passport.Office', width * 0.46, height * 0.156, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
text('Возраст', 'Passport.Office', width * 0.45, height * 0.25, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
box(6, width * 0.44, height * 0.3, width * 0.3, height * 0.075, frame)
text(age, 'Passport.Office', width * 0.46, height * 0.34, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
text('Пол', 'Passport.Office', width * 0.45, height * 0.43, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
box(6, width * 0.44, height * 0.48, (width * 0.3), height * 0.075, frame)
text(gender, 'Passport.Office', width * 0.46, height * 0.515, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
text('Специальность', 'Passport.Office', width * 0.45, height * 0.61, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
box(6, width * 0.44, height * 0.66, (width * 0.3), height * 0.075, frame)
text(job, 'Passport.Office', width * 0.46, height * 0.695, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)--]]
text('Дата регистрации', 'Passport.Office', width * 0.055, height * 0.6, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
-- box(6, width * 0.44, height * 0.12, (width * 0.04) + sizing(regtime), height * 0.075, frame)
text(regtime, 'Passport.Office', width * 0.09, height * 0.65, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
text('Судимость', 'Passport.Office', width * 0.45, height * 0.8, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
box(6, width * 0.44, height * 0.85, (width * 0.3), height * 0.075, frame)
text(arrest .. " раз(а)", 'Passport.Office', width * 0.465, height * 0.89, dark, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
end
local Avatar = vgui.Create( "AvatarImage", information )
Avatar:SetSize( 128, 128 )
Avatar:SetPos( ScrW() * 0.02, ScrH() * 0.05 )
Avatar:SetPlayer( LocalPlayer(), 128 )
end)
Имеется вот такой код, как сделать так чтобы при открытии его, показывалась картинка какая либо именно в этом аддоне, а при закрытии исчезала