- 101
- 24
Почему при смене STAT она не записывается в INI файл? Как фикс?
Lua:
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 directIni = 'nashivka.ini'
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)
inicfg.load(nil, directIni)
renderFontDrawText(font, STAT, -2, -3, 0xFFFFFFFF)
end
while true do
wait(0)
local ini = {
main = {
STAT = STAT,
TAG = TAG,
}
}
inicfg.save(ini, directIni)
end
end
local ini = inicfg.load(inicfg.load({
main = {
TAG = "text",
STAT = "НЕИЗВЕСТНО"
},
}, directIni))
TAG = ini.main.TAG
STAT = ini.main.STAT
inicfg.save(ini, directIni)
function sampev.onServerMessage(color, text)
if text:find("Вы создали описание персонажа:") then
STAT = "НАДЕТА"
elseif text:find("Описание вашего персонажа:") then
STAT = "НАДЕТА"
elseif text:find("Вы удалили описание своего персонажа") then
STAT = "СНЯТА"
elseif text:find(nick.." переодевается в рабочую одежду.") then
STAT = "СНЯТА"
elseif text:find("Устанавливать описание можно один раз в минуту.") then
STAT = "СНЯТА"
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 STAT == "СНЯТА" or "НЕИЗВЕСТНО" then
sampSendDialogResponse(did, 1, 16, nil)
return false
elseif STAT == "НАДЕТА" 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
STAT = "НАДЕТА"
return false
elseif did == 15017 and style == 0 then
sampSendDialogResponse(did, 1, nil, nil)
sampAddChatMessage("{7B68EE}[Neddie] {ffffff}AutoNashivka [{F51111} СНЯТА {ffffff}]", -1)
rab = false
STAT = "СНЯТА"
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 STAT == "СНЯТА" or "НЕИЗВЕСТНО" then
rab = true
sampSendChat('/settings')
return false
end
end
end