- Версия MoonLoader
- .026-beta
Есть условный скрипт
Допустим я зашел в игру, скрипт запустился, потом я захотел добавить еще одну строку в конфиг, при добавлении
Lua:
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
if doesFileExist("moonloader/config/MyCfg.json") then
local f = io.open("moonloader/config/MyCfg.json", 'r')
if f then
config = decodeJson(f:read('*a'))
f:close()
end
else
config = {
keyOne = { v = {18,78}},
keyTwo = { v = {18,79}},
keyThree = { v = {18,80}},
}
saveData(config, 'moonloader/config/MyCfg.json')
end
wait(-1)
end
function saveData(table, path)
if doesFileExist(path) then os.remove(path) end
local pathFile = io.open(path, "w")
if pathFile then
pathFile:write(encodeJson(table))
pathFile:close()
end
end
Допустим я зашел в игру, скрипт запустился, потом я захотел добавить еще одну строку в конфиг, при добавлении
оно не добавляется в сам файл по пути config/MyCfg.jsonkeyFour = { v = {18,81}},