IniCfg

Plavluha

Участник
Автор темы
85
22
Не хочет создаваться cfg
Lua:
local TAG = 'На поясе жетон FBI./На плече нашивка "N122B".'

require "lib.moonloader"
local sampev = require 'lib.samp.events'
local inicfg = require 'inicfg'
local font = renderCreateFont("Arial",9,5)
local on = require "lib.samp.events"

local status = "НЕИЗВЕСТНО"
local rab = false

function main()
    while not isSampAvailable() do wait(100) end
    
    _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)

    sampAddChatMessage("{7B68EE}[Neddie] {ffffff}AutoNashivka [{33EA0D} LOADED {ffffff}]",-1)
    sampRegisterChatCommand('na', function()
        rab = true
        sampSendChat('/settings')
    end)
    while true do
        wait(0)
        renderFontDrawText(font, status, -2, -2, 0xFFFFFFFF)
    end
    
    local anotherIni = inicfg.load(nil, "nashivka")
    
    if anotherIni ~= nil then
        local TAG, STAT = "text", "UNKNOWN"
        local newData = {
          main = {
            TAG = "text",
            STAT = status
          }
        }
    end
    inicfg.save(newData, 'nashivka')
    mainIni.settings.TAG = "text"
    mainIni.settings.STAT = "UNKNOWN"
end

local mainIni = inicfg.load({
  settings =
  {
    TAG = "text",
    STAT = "UNKNOWN"
  }
})

function sampev.onServerMessage(color, text)
    if text:find("Вы создали описание персонажа:") then
        status = "НАДЕТА"
    elseif text:find("Описание вашего персонажа:") then
        status = "НАДЕТА"
        rab = true
        sampSendChat("/settings")
    elseif text:find("Вы удалили описание своего персонажа") then
        status = "СНЯТА"
    elseif text:find(nick.." переодевается в рабочую одежду.") then
        status = "СНЯТА"
    elseif text:find("Устанавливать описание можно один раз в минуту.") then
        status = "СНЯТА"
        rab = true
        sampSendChat("/settings")
    end
end

function on.onShowDialog(did, style, title, b1, b2, text)
    if rab == true and did == 154 and style == 5 then
        if status == "СНЯТА" or "НЕИЗВЕСТНО" then
            sampSendDialogResponse(did, 1, 16, nil)
            return false
        elseif status == "НАДЕТА" then
            sampSendDialogResponse(did, 0, nil, nil)
            return false
        end
    elseif did == 15016 and style == 1 then
        sampSendDialogResponse(did, 1, nil, TAG)
        sampAddChatMessage("{7B68EE}[Neddie] {ffffff}AutoNashivka [{33EA0D} НАДЕТА {ffffff}]", -1)
        rab = false
        status = "НАДЕТА"
        return false
    elseif did == 15017 and style == 0 then
        sampSendDialogResponse(did, 1, nil, nil)
        sampAddChatMessage("{7B68EE}[Neddie] {ffffff}AutoNashivka [{F51111} СНЯТА {ffffff}]", -1)
        rab = false
        status = "СНЯТА"
        return false
    elseif did == 0 and style == 0 and title:find("Описание.*персонажа") then
        return false
    elseif did == 0 and style == 0 and text:find("Вы.*успешно.*переоделись.*в.*форму.*S.W.A.T.") then
        sampSendDialogResponse(did, 1, nil, nil)
        if status == "СНЯТА" or "НЕИЗВЕСТНО" then
            rab = true
            sampSendChat('/settings')
        return false
        end
    end
end

@chapo памаги пжпжпж 🥵🥵🥵
 
Последнее редактирование:

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,777
11,225
  • Нравится
Реакции: Plavluha и Loocking