Кидать в autorun/client
Сначала создадим конвары, чтобы это был наш мини-конфиг
CreateClientConVar( "PictureX", 0, true, false)
CreateClientConVar( "PictureY", 0, true, false )
CreateClientConVar( "PictureH", 256, true, false )
CreateClientConVar( "PictureW", 256, true, false)
CreateClientConVar( "PictureValue", 1, true, false)
CreateClientConVar( "EnablePicture", 0, true, true)
Далее делаем саму настройку
hook.Add( "PopulateToolMenu", "Settings", function()
spawnmenu.AddToolMenuOption("Options", "Название открываемой штуки", " ", "Настройки", " ", " ", function( Panel )
Panel:CheckBox("Включаем", "EnablePicture")
Panel:NumSlider("Y", "PictureY", 0, ScrH())
Panel:NumSlider("X", "PictureX", 0, ScrW())
Panel:NumSlider("Weight", "PictureW", 0, ScrW())
Panel:NumSlider("Height", "PictureH", 0, ScrH())
Panel:NumberWang("Картинка", "PictureValue", 1, 2)
end)
end)
Далее материалы
http.Fetch("https://brokencore.club/data/avatars/l/0/892.jpg?1640973596",function(Draw)
file.Write("derose.png",Draw)
end)
http.Fetch("https://brokencore.club/data/avatars/l/0/1.jpg?1630497965",function(Draw)
file.Write("rolzzandik.png",Draw)
end)
local Materials={}
Materials[1]=Material("data/rolzzandik.jpg")
Materials[2]=Material("data/derose.jpg")
Начинаем рисовать
hook.Add( "HUDPaint", "PicturePaint", function()
local EnablePicture = GetConVar( "EnablePicture" ):GetInt()
local x = GetConVar("PictureX"):GetInt()
local y = GetConVar("PictureY"):GetInt()
local weight = GetConVar("PictureW"):GetInt()
local height = GetConVar("PictureH"):GetInt()
local text = GetConVar("PictureValue"):GetInt()
if EnablePicture == 1 then
surface.SetDrawColor(255,255,255,255)
surface.SetMaterial(Materials[text])
surface.DrawTexturedRect(x,y,weight,height)
end
end)
Исходник:
CreateClientConVar("PictureX", 0, true, false)
CreateClientConVar("PictureY", 0, true, false )
CreateClientConVar("PictureH", 256, true, false )
CreateClientConVar("PictureW", 256, true, false)
CreateClientConVar("PictureValue", 1, true, false)
CreateClientConVar("EnablePicture", 0, true, true)
hook.Add( "PopulateToolMenu", "Settings", function()
spawnmenu.AddToolMenuOption("Options", "Название открываемой штуки", " ", "Настройки", " ", " ", function( Panel )
Panel:CheckBox("Включаем", "EnablePicture")
Panel:NumSlider("Y", "PictureY", 0, ScrH())
Panel:NumSlider("X", "PictureX", 0, ScrW())
Panel:NumSlider("Weight", "PictureW", 0, ScrW())
Panel:NumSlider("Height", "PictureH", 0, ScrH())
Panel:NumberWang("Картинка", "PictureValue", 1, 2)
end)
end)
http.Fetch("[URL]https://brokencore.club/data/avatars/l/0/892.jpg?1640973596[/URL]",function(Draw)
file.Write("derose.png",Draw)
end)
http.Fetch("[URL]https://brokencore.club/data/avatars/l/0/1.jpg?1630497965[/URL]",function(Draw)
file.Write("rolzzandik.png",Draw)
end)
local Materials={}
Materials[1]=Material("data/rolzzandik.jpg")
Materials[2]=Material("data/derose.jpg")
hook.Add( "HUDPaint", "PicturePaint", function()
local EnablePicture = GetConVar( "EnablePicture" ):GetInt()
local x = GetConVar("PictureX"):GetInt()
local y = GetConVar("PictureY"):GetInt()
local weight = GetConVar("PictureW"):GetInt()
local height = GetConVar("PictureH"):GetInt()
local text = GetConVar("PictureValue"):GetInt()
if EnablePicture == 1 then
surface.SetDrawColor(255,255,255,255)
surface.SetMaterial(Materials[text])
surface.DrawTexturedRect(x,y,weight,height)
end
end)
Вложения
Последнее редактирование: