local on = require('lib.samp.events')
local path = getGameDirectory()..'\\moonloader\\config\\data.json'
local config = {}
if not doesFileExist(path) then
local f = io.open(path, 'w+')
f:write(encodeJson(config)):close()
else
local f = io.open(path, "r")
a = f:read("*a")
config = decodeJson(a)
f:close()
end
function on.onShowDialog(did, style, title, b1, b2, text)
for l,k in ipairs(config) do
if k[1] ~= did and k[2] ~= title and k[3] ~= text and k[4] ~= b1 and k[5] ~= b2 and k[6] ~= style then -- проверка, можешь убрать если хош чтобы ВСЕ диалоги с повтором записывались
table.insert(config,#config+1,{did, title, text, b1, b2, style})
JSONSave()
end
end
end
function JSONSave()
if doesFileExist(path) then
local f = io.open(path, 'w+')
if f then
f:write(encodeJson(config)):close()
end
end
end