- 16
- 3
Все библиотеки есть, до перезапуска компьютера все работало. Помогите решить проблему, ну или скиньте первоисточник, я не могу найти, точно знаю что автор Tema05.
Код:
require "lib.moonloader"
local encoding = require "encoding"
local inicfg = require "inicfg"
local directIni = "moonloader\\Note.ini"
local sampev = require "lib.samp.events"
local imgui = require "imgui"
local fa = require 'fAwesome5'
imgui.ToggleButton = require('imgui_addons').ToggleButton
encoding.default = 'CP1251'
u8 = encoding.UTF8
if not doesFileExist("moonloader\\Note.ini")
then
file = io.open("moonloader\\Note.ini", "a")
for i = 1, 50 do
file:write("[" .. i .. "]\n" .. "name=Заметка №" .. i .. "\ntable=0\ntext1=\ntext2=\ntext3=\ntext4=\ntext5=\n")
end
file:close()
end
local mainIni = inicfg.load(nil, directIni)
function apply_custom_style()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowRounding = 2.0
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.84)
style.ChildWindowRounding = 2.0
style.FrameRounding = 2.0
style.ItemSpacing = imgui.ImVec2(5.0, 4.0)
style.ScrollbarSize = 13.0
style.ScrollbarRounding = 0
style.GrabMinSize = 8.0
style.GrabRounding = 1.0
colors[clr.FrameBg] = ImVec4(0.16, 0.29, 0.48, 0.54)
colors[clr.FrameBgHovered] = ImVec4(0.26, 0.59, 0.98, 0.40)
colors[clr.FrameBgActive] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.TitleBg] = ImVec4(0.04, 0.04, 0.04, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.16, 0.29, 0.48, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.CheckMark] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.SliderGrab] = ImVec4(0.24, 0.52, 0.88, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.Button] = ImVec4(0.26, 0.59, 0.98, 0.40)
colors[clr.ButtonHovered] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.26, 0.59, 0.98, 0.31)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.Separator] = colors[clr.Border]
colors[clr.SeparatorHovered] = ImVec4(0.26, 0.59, 0.98, 0.78)
colors[clr.SeparatorActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
colors[clr.ResizeGripActive] = ImVec4(0.26, 0.59, 0.98, 0.95)
colors[clr.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35)
colors[clr.Text] = ImVec4(1.00, 1.00, 1.00, 1.00)
colors[clr.TextDisabled] = ImVec4(0.50, 0.50, 0.50, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 0.94)
colors[clr.ChildWindowBg] = ImVec4(1.00, 1.00, 1.00, 0.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.ComboBg] = colors[clr.PopupBg]
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.MenuBarBg] = ImVec4(0.14, 0.14, 0.14, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.53)
colors[clr.ScrollbarGrab] = ImVec4(0.31, 0.31, 0.31, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.41, 0.41, 0.41, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.51, 0.51, 0.51, 1.00)
colors[clr.CloseButton] = ImVec4(0.41, 0.41, 0.41, 0.50)
colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
apply_custom_style()
imgui.Process = true
imgui_active = imgui.ImBool(false)
local w, h = getScreenResolution()
local slot = 0
local name = imgui.ImBuffer(20)
local combo = imgui.ImInt(0)
local text1 = imgui.ImBuffer(65536)
local text2 = imgui.ImBuffer(65536)
local text3 = imgui.ImBuffer(65536)
local text4 = imgui.ImBuffer(65536)
local text5 = imgui.ImBuffer(65536)
sampRegisterChatCommand("note", function()
imgui_active.v = not imgui_active.v
imgui.Process = imgui_active.v
end)
local fa_font = nil
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
function imgui.BeforeDrawFrame()
if fa_font == nil
then
local font_config = imgui.ImFontConfig()
font_config.MergeMode = true
fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/lib/fa-solid-900.ttf', 13.0, font_config, fa_glyph_ranges)
end
end
function main()
if not isSampLoaded() or not isSampfuncsLoaded()
then
return
end
while not isSampAvailable() do wait(100) end
sampAddChatMessage("[Note] {FFFFFF}Загружен Автор: {FF9933}Artem_Williams", 0x3399FF)
while true do
wait(0)
end
end
function imgui.OnDrawFrame()
if imgui_active.v
then
imgui.SetNextWindowSize(imgui.ImVec2(750, 500), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2(w / 2, h / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin(fa.ICON_FA_ENVELOPE_OPEN_TEXT .. u8" Заметки", imgui_active, imgui.WindowFlags.NoResize)
imgui.BeginChild("", imgui.ImVec2(150, 464), true)
for i = 1, 50 do
if imgui.Selectable(u8(mainIni[i].name))
then
name.v = u8(mainIni[i].name)
combo.v = mainIni[i].table
text1.v = string.gsub(u8(mainIni[i].text1), "&", "\n")
text2.v = string.gsub(u8(mainIni[i].text2), "&", "\n")
text3.v = string.gsub(u8(mainIni[i].text3), "&", "\n")
text4.v = string.gsub(u8(mainIni[i].text4), "&", "\n")
text5.v = string.gsub(u8(mainIni[i].text5), "&", "\n")
slot = i
end
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild(" ", imgui.ImVec2(579, 464), true)
if slot ~= 0
then
imgui.Text(u8"Название:")
imgui.SameLine()
imgui.PushItemWidth(150)
imgui.InputText(u8"Столбцы:", name)
imgui.SameLine()
imgui.PushItemWidth(40)
imgui.Combo(" ", combo, {"1", "2", "3", "4", "5"})
imgui.PopItemWidth(2)
imgui.SameLine(331)
if imgui.Button(fa.ICON_FA_SAVE .. u8" Сохранить", imgui.ImVec2(125, 20))
then
mainIni[slot].name = u8:decode(name.v)
mainIni[slot].table = combo.v
mainIni[slot].text1 = string.gsub(u8:decode(text1.v), "\n", "&")
mainIni[slot].text2 = string.gsub(u8:decode(text2.v), "\n", "&")
mainIni[slot].text3 = string.gsub(u8:decode(text3.v), "\n", "&")
mainIni[slot].text4 = string.gsub(u8:decode(text4.v), "\n", "&")
mainIni[slot].text5 = string.gsub(u8:decode(text5.v), "\n", "&")
inicfg.save(mainIni, directIni)
sampAddChatMessage('[Note] {FFFFFF}Заметка "' .. u8:decode(name.v) .. '" сохранена.', 0x3399FF)
end
if combo.v == 0 then
imgui.InputTextMultiline(" ", text1, imgui.ImVec2(562, 423))
elseif combo.v == 1 then
imgui.InputTextMultiline(" ", text1, imgui.ImVec2(279, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text2, imgui.ImVec2(279, 423))
elseif combo.v == 2 then
imgui.InputTextMultiline(" ", text1, imgui.ImVec2(184, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text2, imgui.ImVec2(184, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text3, imgui.ImVec2(184, 423))
elseif combo.v == 3 then
imgui.InputTextMultiline(" ", text1, imgui.ImVec2(137, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text2, imgui.ImVec2(137, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text3, imgui.ImVec2(137, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text4, imgui.ImVec2(137, 423))
elseif combo.v == 4 then
imgui.InputTextMultiline(" ", text1, imgui.ImVec2(108, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text2, imgui.ImVec2(108, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text3, imgui.ImVec2(108, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text4, imgui.ImVec2(108, 423))
imgui.SameLine()
imgui.InputTextMultiline(" ", text5, imgui.ImVec2(108, 423))
end
end
imgui.EndChild()
imgui.End()
else
imgui.Process = false
end
end
Вложения
Последнее редактирование: