Баг иницфг, помогите решить

Fasmin

Участник
Автор темы
112
2
Версия MoonLoader
.026-beta
1631371229702.png
Не пойму в чем проблема. Код написан полностью правильно, если у кого была такая ошибка, отзовитесь
 
  • Bug
Реакции: Fott

Fasmin

Участник
Автор темы
112
2
А сейчас ты решил без кода отправить?
ну если ты шаришь в луа, то на код, попробуй разберись
lua:
script_name('Helper For Leaders[ORP]')
script_author('Vasek')
require 'lib.moonloader'
local keys = require 'vkeys'
local imgui = require 'imgui'
local enc = require 'encoding'
rkeys = require 'rkeys'
local inicfg = require 'inicfg'
enc.default = 'CP1251'
u8 = enc.UTF8
MWS = imgui.ImBool(false)
two_window = imgui.ImBool(false)
TB = imgui.ImBuffer(256)
local sw, sh = getScreenResolution()
local rw, rh = getScreenResolution()
local directIni = 'moonloader\\l_setting.ini'
local mainIni = inicfg.load(nil, directIni)
local checkBox = imgui.ImBool(false)
local checkBox2 = imgui.ImBool(false)
local select_combo = imgui.ImInt(0)
imgui.HotKey = require('imgui_addons').HotKey
local color = 0xFF8C00
local main_color = 0x5A90CE
arrStrCombo = {u8"5 минут", u8"10 минут", u8"15 минут"}
set_skin = nil

--[[if mainIni.hotkey == nil then
    mainIni.hotkey = {
        KeyMenu = "[18,82]"
    }
end

local tLastKeys = {}

local ActiveClockMenu = {
    v = decodeJson(mainIni.hotkey.KeyMenu)
}
]]
function main()
    if not isSampfuncsLoaded() then end
    repeat wait(0) until isSampAvailable()
    print(script.this.name)
    print("Автор скрипта: " .. table.concat(script.this.authors))
    checkBox.v = tostring(mainIni.config.inv) == "true" and true or false
    checkBox2.v = tostring(mainIni.config.skin) == "true" and true or false
    local _, id = sampGetPlayerIdByCharHandle(ped)
    sampAddChatMessage("[Helper for leaders]: {FFFFFF}loaded", main_color)
    sampRegisterChatCommand('invite', cmd_invite)
    sampRegisterChatCommand('unv', function(arg)
        sampSendChat('/uninvite ' .. arg .. ' Выселен.')
    end)
    sampRegisterChatCommand('lhelp', cmd_OnOff)
   
    --KeyMenu = rkeys.registerHotKey(ActiveClockMenu.v, true, menuKey)
   
    while true do wait(0)
        --if MWS.v == false then imgui.Process = false end
        local _, char = getCharPlayerIsTargeting()
        if _ then
            set_skin = char
        end
        if wasKeyPressed(keys.VK_J) and set_skin ~= nil and not sampIsChatInputActive() and not sampIsDialogActive() then
            if checkBox2.v then
                local _, id = sampGetPlayerIdByCharHandle(set_skin)
                sampSendChat('/me протянул левую руку в сумку висящую на плече', -1)
                    wait(800)
                sampSendChat('/me достал новую майку из сумки', -1)
                    wait(800)
                sampSendChat('/do Майка в руке.', -1)
                    wait(800)
                sampSendChat('/me передал новую майку человеку напротив', -1)
                    wait(800)
                sampSendChat('/setskin ' .. id, -1)
            end
        end
    end
end
-- 308 293
function cmd_OnOff()
    MWS.v = not MWS.v
    imgui.Process = MWS.v
end

--[[function menuKey()
    two_window.v = true
end]]

function imgui.OnDrawFrame()
    if not MWS.v and not two_window.v then
        imgui.Process = false
    end
   
    if MWS.v then
        local _, MyId = sampGetPlayerIdByCharHandle(PLAYER_PED)
        imgui.SetNextWindowSize(imgui.ImVec2(530, 200), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Помощник для лидеров/замов гетто", MWS, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Разработчик Vasek, vk: https://vk.com/vaska3710")
        imgui.Separator()
        if imgui.Button(u8"Информация") then
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Ливнуть игрока через сокращенную команду: /unv id", color)
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Как выдать скин по РП? Ставишь галочку, далее кликаешь на игрока(ПКМ) и нажимаешь J", color)
        end
        imgui.SameLine()
        if imgui.Button(u8"Сменить себе скин") then
            sampSendChat('/setskin ' .. MyId, -1)
        end
        imgui.SameLine()
        if imgui.Button(u8"Заспавнить транспорт") then
            sampSendChat('/ffixcar')
        end
        imgui.SameLine()
        if imgui.Button(u8"Открыть/Закрыть общак") then
            sampSendChat('/wlock')
        end
        if imgui.Button(u8"Настройки") then
            two_window.v = true
        end
        imgui.Separator()
        imgui.Checkbox(u8"Инвайтить игрока с РП отыгровкой", checkBox)
        imgui.Checkbox(u8"Выдавать скин с РП отыгровкой", checkBox2)
        imgui.Separator()
        imgui.Text(u8"Спавн транспорта(Автоматически) каждые:")
        imgui.PushItemWidth(120)
        imgui.Combo(u8"", select_combo, arrStrCombo, #arrStrCombo)
        imgui.SameLine()
        if imgui.Button(th and u8"Остановить" or u8"Активировать") then
            cars = not cars
            if cars then
                th = lua_thread.create(function()
                    while cars do
                        if select_combo.v then
                            if select_combo.v == 0 then
                                sampSendChat('/ffixcar')
                                wait(300000)
                            end
                            if select_combo.v == 1 then
                                sampSendChat('/ffixcar')
                                wait(600000)
                            end
                            if select_combo.v == 2 then
                                sampSendChat('/ffixcar')
                                wait(900000)
                            end
                        end
                    end
                end)
            else
                th:terminate()
                th = nil
            end
        end
        imgui.End()
        mainIni.config.inv = tostring(checkBox.v)
        mainIni.config.skin = tostring(checkBox2.v)
        inicfg.save(mainIni, directIni)
    end
   
    if two_window.v then
        imgui.SetNextWindowPos(imgui.ImVec2(174, 356), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(210, 120), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Настройки", two_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Настройка клавиш")
    --    imgui.SameLine()
        --[[if imgui.HotKey("##1", ActiveClockMenu, tLastKeys, 100) then
            rkeys.changeHotKey(menuKey, ActiveClockMenu.v)
           
            mainIni.hotkey.KeyMenu = encodeJson(ActiveClockMenu.v)
            inicfg.save(mainIni, directIni)
        end]]
        imgui.End()
    end
end

function cmd_invite(arg)
    if checkBox.v then
        if not inv then
            inv = true
            lua_thread.create(function()
                var = string.match(arg, "%d")
                if var == nil or var == "" then
                    sampAddChatMessage("{FF0000}[Ошибка]: {FFFFFF}Введите /invite id", -1)
                else
                    sampSendChat('/me достал банду из кармана')
                        wait(800)
                    sampSendChat('/do Бандана в руке.')
                        wait(800)
                    sampSendChat('/me кинул бандану челоеку напротив')
                        wait(800)
                    sampSendChat("/invite " .. arg)
                end
            end)
            inv = false
        end
    else
        sampSendChat("/invite " .. arg, -1)
    end
end
ini:
[config]
skin=false
inv=false
 

Fasmin

Участник
Автор темы
112
2
в 101 и 102 строчке кода ошибка, ты забыл добавить -1 в конце

Вот так будет правильней:
1:
script_name('Helper For Leaders[ORP]')
script_author('Vasek')
require 'lib.moonloader'
local keys = require 'vkeys'
local imgui = require 'imgui'
local enc = require 'encoding'
rkeys = require 'rkeys'
local inicfg = require 'inicfg'
enc.default = 'CP1251'
u8 = enc.UTF8
MWS = imgui.ImBool(false)
two_window = imgui.ImBool(false)
TB = imgui.ImBuffer(256)
local sw, sh = getScreenResolution()
local rw, rh = getScreenResolution()
local directIni = 'moonloader\\l_setting.ini'
local mainIni = inicfg.load(nil, directIni)
local checkBox = imgui.ImBool(false)
local checkBox2 = imgui.ImBool(false)
local select_combo = imgui.ImInt(0)
imgui.HotKey = require('imgui_addons').HotKey
local color = 0xFF8C00
local main_color = 0x5A90CE
arrStrCombo = {u8"5 минут", u8"10 минут", u8"15 минут"}
set_skin = nil

--[[if mainIni.hotkey == nil then
    mainIni.hotkey = {
        KeyMenu = "[18,82]"
    }
end

local tLastKeys = {}

local ActiveClockMenu = {
    v = decodeJson(mainIni.hotkey.KeyMenu)
}
]]
function main()
    if not isSampfuncsLoaded() then end
    repeat wait(0) until isSampAvailable()
    print(script.this.name)
    print("Автор скрипта: " .. table.concat(script.this.authors))
    checkBox.v = tostring(mainIni.config.inv) == "true" and true or false
    checkBox2.v = tostring(mainIni.config.skin) == "true" and true or false
    local _, id = sampGetPlayerIdByCharHandle(ped)
    sampAddChatMessage("[Helper for leaders]: {FFFFFF}loaded", main_color)
    sampRegisterChatCommand('invite', cmd_invite)
    sampRegisterChatCommand('unv', function(arg)
        sampSendChat('/uninvite ' .. arg .. ' Выселен.')
    end)
    sampRegisterChatCommand('lhelp', cmd_OnOff)
 
    --KeyMenu = rkeys.registerHotKey(ActiveClockMenu.v, true, menuKey)
 
    while true do wait(0)
        --if MWS.v == false then imgui.Process = false end
        local _, char = getCharPlayerIsTargeting()
        if _ then
            set_skin = char
        end
        if wasKeyPressed(keys.VK_J) and set_skin ~= nil and not sampIsChatInputActive() and not sampIsDialogActive() then
            if checkBox2.v then
                local _, id = sampGetPlayerIdByCharHandle(set_skin)
                sampSendChat('/me протянул левую руку в сумку висящую на плече')
                    wait(800)
                sampSendChat('/me достал новую майку из сумки')
                    wait(800)
                sampSendChat('/do Майка в руке.')
                    wait(800)
                sampSendChat('/me передал новую майку человеку напротив')
                    wait(800)
                sampSendChat('/setskin ' .. id)
            end
        end
    end
end
-- 308 293
function cmd_OnOff()
    MWS.v = not MWS.v
    imgui.Process = MWS.v
end

--[[function menuKey()
    two_window.v = true
end]]

function imgui.OnDrawFrame()
    if not MWS.v and not two_window.v then
        imgui.Process = false
    end
 
    if MWS.v then
        local _, MyId = sampGetPlayerIdByCharHandle(PLAYER_PED)
        imgui.SetNextWindowSize(imgui.ImVec2(530, 200), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Помощник для лидеров/замов гетто", MWS, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Разработчик Vasek, vk: https://vk.com/vaska3710")
        imgui.Separator()
        if imgui.Button(u8"Информация") then
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Ливнуть игрока через сокращенную команду: /unv id", -1)
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Как выдать скин по РП? Ставишь галочку, далее кликаешь на игрока(ПКМ) и нажимаешь J", -1)
        end
        imgui.SameLine()
        if imgui.Button(u8"Сменить себе скин") then
            sampSendChat('/setskin ' .. MyId, -1)
        end
        imgui.SameLine()
        if imgui.Button(u8"Заспавнить транспорт") then
            sampSendChat('/ffixcar')
        end
        imgui.SameLine()
        if imgui.Button(u8"Открыть/Закрыть общак") then
            sampSendChat('/wlock')
        end
        if imgui.Button(u8"Настройки") then
            two_window.v = true
        end
        imgui.Separator()
        imgui.Checkbox(u8"Инвайтить игрока с РП отыгровкой", checkBox)
        imgui.Checkbox(u8"Выдавать скин с РП отыгровкой", checkBox2)
        imgui.Separator()
        imgui.Text(u8"Спавн транспорта(Автоматически) каждые:")
        imgui.PushItemWidth(120)
        imgui.Combo(u8"", select_combo, arrStrCombo, #arrStrCombo)
        imgui.SameLine()
        if imgui.Button(th and u8"Остановить" or u8"Активировать") then
            cars = not cars
            if cars then
                th = lua_thread.create(function()
                    while cars do
                        if select_combo.v then
                            if select_combo.v == 0 then
                                sampSendChat('/ffixcar')
                                wait(300000)
                            end
                            if select_combo.v == 1 then
                                sampSendChat('/ffixcar')
                                wait(600000)
                            end
                            if select_combo.v == 2 then
                                sampSendChat('/ffixcar')
                                wait(900000)
                            end
                        end
                    end
                end)
            else
                th:terminate()
                th = nil
            end
        end
        imgui.End()
        mainIni.config.inv = tostring(checkBox.v)
        mainIni.config.skin = tostring(checkBox2.v)
        inicfg.save(mainIni, directIni)
    end
 
    if two_window.v then
        imgui.SetNextWindowPos(imgui.ImVec2(174, 356), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(210, 120), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Настройки", two_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Настройка клавиш")
    --    imgui.SameLine()
        --[[if imgui.HotKey("##1", ActiveClockMenu, tLastKeys, 100) then
            rkeys.changeHotKey(menuKey, ActiveClockMenu.v)
         
            mainIni.hotkey.KeyMenu = encodeJson(ActiveClockMenu.v)
            inicfg.save(mainIni, directIni)
        end]]
        imgui.End()
    end
end

function cmd_invite(arg)
    if checkBox.v then
        if not inv then
            inv = true
            lua_thread.create(function()
                var = string.match(arg, "%d")
                if var == nil or var == "" then
                    sampAddChatMessage("{FF0000}[Ошибка]: {FFFFFF}Введите /invite id", -1)
                else
                    sampSendChat('/me достал банду из кармана')
                        wait(800)
                    sampSendChat('/do Бандана в руке.')
                        wait(800)
                    sampSendChat('/me кинул бандану челоеку напротив')
                        wait(800)
                    sampSendChat("/invite " .. arg)
                end
            end)
            inv = false
        end
    else
        sampSendChat("/invite " .. arg, -1)
    end
end
хвфхфывхфыв гений
 

PanSeek

t.me/dailypanseek
Всефорумный модератор
899
1,744
Типа того?
Lua:
script_name('Helper For Leaders[ORP]')
script_author('Vasek')
--libs
local encoding = require 'encoding'
local inicfg = require 'inicfg'
local keys = require 'vkeys'
local imgui = require 'imgui'
encoding.default = 'CP1251'
u8 = encoding.UTF8
--vars
local arrStrCombo = {u8"5 минут", u8"10 минут", u8"15 минут"}
local color = 0xFF8C00
local main_color = 0x5A90CE
local set_skin = nil
local sw, sh = getScreenResolution()
--cfg
local mainIni = inicfg.load({
    main = {
        invite = false,
        skin = false
    }
}, 'l_setting')
--vars imgui
local MWS = imgui.ImBool(false)
local two_window = imgui.ImBool(false)
local inviteBox = imgui.ImBool(mainIni.main.invite)
local skinBox = imgui.ImBool(mainIni.main.skin)
local TB = imgui.ImBuffer(256)
local select_combo = imgui.ImInt(0)

function main()
    if not isSampfuncsLoaded() then end
    repeat wait(0) until isSampAvailable()
    print(script.this.name)
    print("Автор скрипта: " .. table.concat(script.this.authors))
    if not doesFileExist('moonloader/config/l_setting.ini') then inicfg.save(mainIni, 'l_setting.ini') end

    sampAddChatMessage("[Helper for leaders]: {FFFFFF}loaded", main_color)
    sampRegisterChatCommand('invite', function(arg)
        if inviteBox.v then
            if not inv then
                inv = true
                lua_thread.create(function()
                    local var = string.match(arg, "%d")
                    if var ~= nil then
                        sampSendChat('/me достал банду из кармана'); wait(800)
                        sampSendChat('/do Бандана в руке.'); wait(800)
                        sampSendChat('/me кинул бандану челоеку напротив'); wait(800)
                        sampSendChat("/invite " .. arg)
                    else
                        sampAddChatMessage("{FF0000}[Ошибка]: {FFFFFF}Введите /invite id", -1)
                    end
                end); inv = false
            end
        else
            sampSendChat("/invite " .. arg)
        end
    end)
    sampRegisterChatCommand('unv', function(arg) sampSendChat('/uninvite ' .. arg .. ' Выселен.') end)
    sampRegisterChatCommand('lhelp', function() MWS.v = not MWS.v end)
    
    while true do
        wait(0)
        imgui.Process = MWS.v or two_window.v
        set_skin = select(2, getCharPlayerIsTargeting())
        if wasKeyPressed(keys.VK_J) and set_skin ~= nil and skinBox.v and not sampIsChatInputActive() and not sampIsDialogActive() then
            sampSendChat('/me протянул левую руку в сумку висящую на плече'); wait(800)
            sampSendChat('/me достал новую майку из сумки'); wait(800)
            sampSendChat('/do Майка в руке.'); wait(800)
            sampSendChat('/me передал новую майку человеку напротив'); wait(800)
            sampSendChat('/setskin ' .. select(2, sampGetPlayerIdByCharHandle(set_skin)))
        end
    end
end

function imgui.OnDrawFrame()
    if MWS.v then
        imgui.SetNextWindowSize(imgui.ImVec2(530, 200), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Помощник для лидеров/замов гетто", MWS, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Разработчик Vasek, vk: https://vk.com/vaska3710")
        imgui.Separator()
        if imgui.Button(u8"Информация") then
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Ливнуть игрока через сокращенную команду: /unv id", color)
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Как выдать скин по РП? Ставишь галочку, далее кликаешь на игрока(ПКМ) и нажимаешь J", color)
        end
        imgui.SameLine()
        if imgui.Button(u8"Сменить себе скин") then sampSendChat('/setskin ' .. select(2, sampGetPlayerIdByCharHandle(playerPed))) end
        imgui.SameLine()
        if imgui.Button(u8"Заспавнить транспорт") then sampSendChat('/ffixcar') end
        imgui.SameLine()
        if imgui.Button(u8"Открыть/Закрыть общак") then sampSendChat('/wlock') end
        if imgui.Button(u8"Настройки") then two_window.v = true end
        imgui.Separator()
        imgui.Checkbox(u8"Инвайтить игрока с РП отыгровкой", inviteBox)
        imgui.Checkbox(u8"Выдавать скин с РП отыгровкой", skinBox)
        imgui.Separator()
        imgui.Text(u8"Спавн транспорта(Автоматически) каждые:")
        imgui.PushItemWidth(120)
        imgui.Combo(u8"", select_combo, arrStrCombo, #arrStrCombo)
        imgui.SameLine()
        if imgui.Button(th and u8"Остановить" or u8"Активировать") then
            cars = not cars
            if cars then
                th = lua_thread.create(function()
                    while cars do
                        if select_combo.v then
                            if select_combo.v == 0 then
                                sampSendChat('/ffixcar')
                                wait(300000)
                            end
                            if select_combo.v == 1 then
                                sampSendChat('/ffixcar')
                                wait(600000)
                            end
                            if select_combo.v == 2 then
                                sampSendChat('/ffixcar')
                                wait(900000)
                            end
                        end
                    end
                end)
            else
                th:terminate()
                th = nil
            end
        end
        imgui.End()
    end
    
    if two_window.v then
        imgui.SetNextWindowPos(imgui.ImVec2(174, 356), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(210, 120), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Настройки", two_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Настройка клавиш")
        imgui.End()
    end
end

function onScriptTerminate(script, quitGame)
    if script == thisScript() then
        mainIni = {
            main = {
                invite = inviteBox.v,
                skin = skinBox.v
            }
        } inicfg.save(mainIni, 'l_setting.ini')
    end
end
 
  • Нравится
Реакции: James Saula

Fasmin

Участник
Автор темы
112
2
Типа того?
Lua:
script_name('Helper For Leaders[ORP]')
script_author('Vasek')
--libs
local encoding = require 'encoding'
local inicfg = require 'inicfg'
local keys = require 'vkeys'
local imgui = require 'imgui'
encoding.default = 'CP1251'
u8 = encoding.UTF8
--vars
local arrStrCombo = {u8"5 минут", u8"10 минут", u8"15 минут"}
local color = 0xFF8C00
local main_color = 0x5A90CE
local set_skin = nil
local sw, sh = getScreenResolution()
--cfg
local mainIni = inicfg.load({
    main = {
        invite = false,
        skin = false
    }
}, 'l_setting')
--vars imgui
local MWS = imgui.ImBool(false)
local two_window = imgui.ImBool(false)
local inviteBox = imgui.ImBool(mainIni.main.invite)
local skinBox = imgui.ImBool(mainIni.main.skin)
local TB = imgui.ImBuffer(256)
local select_combo = imgui.ImInt(0)

function main()
    if not isSampfuncsLoaded() then end
    repeat wait(0) until isSampAvailable()
    print(script.this.name)
    print("Автор скрипта: " .. table.concat(script.this.authors))
    if not doesFileExist('moonloader/config/l_setting.ini') then inicfg.save(mainIni, 'l_setting.ini') end

    sampAddChatMessage("[Helper for leaders]: {FFFFFF}loaded", main_color)
    sampRegisterChatCommand('invite', function(arg)
        if inviteBox.v then
            if not inv then
                inv = true
                lua_thread.create(function()
                    local var = string.match(arg, "%d")
                    if var ~= nil then
                        sampSendChat('/me достал банду из кармана'); wait(800)
                        sampSendChat('/do Бандана в руке.'); wait(800)
                        sampSendChat('/me кинул бандану челоеку напротив'); wait(800)
                        sampSendChat("/invite " .. arg)
                    else
                        sampAddChatMessage("{FF0000}[Ошибка]: {FFFFFF}Введите /invite id", -1)
                    end
                end); inv = false
            end
        else
            sampSendChat("/invite " .. arg)
        end
    end)
    sampRegisterChatCommand('unv', function(arg) sampSendChat('/uninvite ' .. arg .. ' Выселен.') end)
    sampRegisterChatCommand('lhelp', function() MWS.v = not MWS.v end)
   
    while true do
        wait(0)
        imgui.Process = MWS.v or two_window.v
        set_skin = select(2, getCharPlayerIsTargeting())
        if wasKeyPressed(keys.VK_J) and set_skin ~= nil and skinBox.v and not sampIsChatInputActive() and not sampIsDialogActive() then
            sampSendChat('/me протянул левую руку в сумку висящую на плече'); wait(800)
            sampSendChat('/me достал новую майку из сумки'); wait(800)
            sampSendChat('/do Майка в руке.'); wait(800)
            sampSendChat('/me передал новую майку человеку напротив'); wait(800)
            sampSendChat('/setskin ' .. select(2, sampGetPlayerIdByCharHandle(set_skin)))
        end
    end
end

function imgui.OnDrawFrame()
    if MWS.v then
        imgui.SetNextWindowSize(imgui.ImVec2(530, 200), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8"Помощник для лидеров/замов гетто", MWS, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Разработчик Vasek, vk: https://vk.com/vaska3710")
        imgui.Separator()
        if imgui.Button(u8"Информация") then
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Ливнуть игрока через сокращенную команду: /unv id", color)
            sampAddChatMessage("[Helper for leaders]: {FFFFFF}Как выдать скин по РП? Ставишь галочку, далее кликаешь на игрока(ПКМ) и нажимаешь J", color)
        end
        imgui.SameLine()
        if imgui.Button(u8"Сменить себе скин") then sampSendChat('/setskin ' .. select(2, sampGetPlayerIdByCharHandle(playerPed))) end
        imgui.SameLine()
        if imgui.Button(u8"Заспавнить транспорт") then sampSendChat('/ffixcar') end
        imgui.SameLine()
        if imgui.Button(u8"Открыть/Закрыть общак") then sampSendChat('/wlock') end
        if imgui.Button(u8"Настройки") then two_window.v = true end
        imgui.Separator()
        imgui.Checkbox(u8"Инвайтить игрока с РП отыгровкой", inviteBox)
        imgui.Checkbox(u8"Выдавать скин с РП отыгровкой", skinBox)
        imgui.Separator()
        imgui.Text(u8"Спавн транспорта(Автоматически) каждые:")
        imgui.PushItemWidth(120)
        imgui.Combo(u8"", select_combo, arrStrCombo, #arrStrCombo)
        imgui.SameLine()
        if imgui.Button(th and u8"Остановить" or u8"Активировать") then
            cars = not cars
            if cars then
                th = lua_thread.create(function()
                    while cars do
                        if select_combo.v then
                            if select_combo.v == 0 then
                                sampSendChat('/ffixcar')
                                wait(300000)
                            end
                            if select_combo.v == 1 then
                                sampSendChat('/ffixcar')
                                wait(600000)
                            end
                            if select_combo.v == 2 then
                                sampSendChat('/ffixcar')
                                wait(900000)
                            end
                        end
                    end
                end)
            else
                th:terminate()
                th = nil
            end
        end
        imgui.End()
    end
   
    if two_window.v then
        imgui.SetNextWindowPos(imgui.ImVec2(174, 356), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowSize(imgui.ImVec2(210, 120), imgui.Cond.FirstUseEver)
        imgui.Begin(u8"Настройки", two_window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
        imgui.Text(u8"Настройка клавиш")
        imgui.End()
    end
end

function onScriptTerminate(script, quitGame)
    if script == thisScript() then
        mainIni = {
            main = {
                invite = inviteBox.v,
                skin = skinBox.v
            }
        } inicfg.save(mainIni, 'l_setting.ini')
    end
end
зачем ты мне тут это кинул, если ты в смс скинул?
 

Smeruxa

Известный
1,294
680
зачем так убого делать ини?
Lua:
local directIni = 'FileName.ini'
local ini = inicfg.load(inicfg.load({
    section1 = {
        key1 = true,
        key2 = 1,
        key3 = 'string',
    },
}, directIni))
inicfg.save(ini, directIni)
КАВО :D
Lua:
local inicfg = require 'inicfg'

local HLcfg = inicfg.load({
    config = {
        yaLox = false,
        tiLox = true -- <3
    }
}, "test.ini")
inicfg.save(HLcfg, "test.ini")

-- если надо будет сохранить что то вызываешь save()

function save()
    inicfg.save(HLcfg, "test.ini")
end