- 76
- 35
- Версия MoonLoader
- .026-beta
Пишу код, мне нужно что-бы скрипт из ini файла брал строку "name" и вводил в эту строчку
Вместо этого ошибка вот такая
[ML] (error) Police-Helper.lua: E:\SAMP\moonloader\Police-Helper.lua:160: ')' expected near '"
Lua:
imgui.Text(u8"Информация: \n\nВаше имя:"..u8(mainIni.config.name).."\nВаша должность:" "\nВаш пол:")
Ваш пол:"'
[ML] (error) Police-Helper.lua: Script died due to an error. (0BEE76B4)
Фулл код вот. Помогите
Lua:
script_name("Police-Helper")
script_author("Jesus_McWood")
script_version("1.0")
require "lib.moonloader"
require "lib.sampfuncs"
require "lib.vkeys"
local tag = "{0000CD}[Police-Helper]"
local main_color = 0x0000CD
local main_color_text = "{0000CD}"
local white_color = "{FFFFFF}"
local imgui = require 'imgui'
local inicfg = require 'inicfg'
local fa = require 'fAwesome5'
local fa_font = nil
local fa_glyph_ranges = imgui.ImGlyphRanges({ fa.min_range, fa.max_range })
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
--Окна имгуи
local main_window_state = imgui.ImBool(false)
local sw, sh = getScreenResolution()
local ImVec2 = imgui.ImVec2
local directIni = "moonloader\\Police-Helper\\settings.ini"
local mainIni = inicfg.load(nil, directIni)
--local stateIni = inicfg.save(mainIni, directIni)
function imgui.BeforeDrawFrame()
if fa_font == nil then
local font_config = imgui.ImFontConfig()
font_config.MergeMode = true
fa_font = imgui.GetIO().Fonts:AddFontFromFileTTF('moonloader/resource/fonts/fa-solid-900.ttf', 20.0, font_config, fa_glyph_ranges)
end
end
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()
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
--wait(12000)
printStringNow("Script by Jesus_McWood", 2000)
sampAddChatMessage(tag .. " {FFFFFF}Скрипт {006400}успешно {FFFFFF}запущен. Автор скрипта: {0000CD}Jesus_McWood", 0x0000CD)
sampAddChatMessage(tag .. " {FFFFFF}Скрипт создан для игроков сервера {0000CD}Grand Role Play.", 0x0000CD)
sampAddChatMessage(tag .. " {FFFFFF}Версия скрипта - {FF0000}1.0. {FFFFFF}Больше скриптов тут - {FF0000}https://scriptscorporated.site/", 0x0000CD)
sampRegisterChatCommand("ph", cmd_ph)
while true do
wait(0)
imgui.Process = main_window_state.v
end
end
function cmd_ph()
main_window_state.v = not main_window_state.v
end
function imgui.OnDrawFrame()
if main_window_state.v then --Главное меню
imgui.SetNextWindowSize(imgui.ImVec2(690, 489))
imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin(u8'Police-Helper | Главное меню', main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoScrollbar)
if imgui.Button(fa.ICON_FA_LIST .. u8" Главная", imgui.ImVec2(130, 80)) then
main_window_state.v = true
end
if imgui.Button(fa.ICON_FA_COG .. u8" Настройки", imgui.ImVec2(130, 80)) then
main_window_state.v = false
--two_window_state.v = not two_window_state.v
end
if imgui.Button(fa.ICON_FA_NEWSPAPER .. u8" Меню новостей", imgui.ImVec2(130, 80)) then
main_window_state.v = false
--three_window_state.v = not three_window_state.v
end
imgui.SameLine(280)
imgui.BeginChild("1", imgui.ImVec2(200, 82), true)
imgui.Text(u8"Информация: \n\nВаше имя:"..u8(mainIni.config.name).."\nВаша должность:" "\nВаш пол:")
imgui.EndChild()
if imgui.Button(fa.ICON_FA_KEYBOARD .. u8" Команды", imgui.ImVec2(130, 80)) then
main_window_state.v = false
--three_window_state.v = not three_window_state.v
end
if imgui.Button(fa.ICON_FA_QUESTION_CIRCLE .. u8" Помощь", imgui.ImVec2(130, 80)) then
main_window_state.v = false
--three_window_state.v = not three_window_state.v
end
imgui.Text(u8"Автор скрипта: Jesus_McWood")
imgui.Text(u8"Версия скрипта: v1.0")
imgui.End()
end
end