(exception) update.luac: error reading ini file: D:\SAMP\CLEAR SBORKA SAMP\moonloader\script_update.ini: cannot open file
[17:34:47.955073] (error) update.luac: D:\SAMP\CLEAR SBORKA SAMP\moonloader\update.luac:0: attempt to index global 'updateIni' (a nil value)
stack traceback:
D:\SAMP\CLEAR SBORKA SAMP\moonloader\update.luac: in function <D:\SAMP\CLEAR SBORKA SAMP\moonloader\update.luac:0>
[17:34:47.955073] (error) update.luac: Script died due to an error. (0F3649BC)
Код:
Код |
---|
require 'lib.moonloader'
inicfg = require 'inicfg'
dlstatus = require('moonloader').download_status
enc = require('encoding')
enc.default = 'CP1251'
local update_state = false
local script_version = 2
local script_version_text = "2.0"
local update_url = "https://raw.githubusercontent.com/FasminCode/FasminCode/main/script_update.ini"
local update_path = getWorkingDirectory() .. '/script_update.ini'
local script_url = "https://github.com/FasminCode/FasminCode/blob/main/update.luac?raw=true"
local script_path = thisScript().path
function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage("{ff0000}update.lua {00ff00}completed {ffffff}loaded", -1)
sampRegisterChatCommand('update', cmd_update)
downloadUrlToFile(update_url, update_path, function(id, status)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
updateIni = inicfg.load(nil, update_path)
if tonumber(updateIni.info.vers) > script_version then
sampAddChatMessage("Есть обновление! Версия: " .. updateIni.info.vers_text, -1)
update_state = true
end
os.remove(update_path)
end
end)
while true do wait(0)
if update_state then
downloadUrlToFile(script_url, script_path, function(id, status)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
sampAddChatMessage("Скрипт успешно обновлен!", -1)
thisScript():reload()
end
end)
break
end
end
end
function cmd_update()
sampShowDialog(2335, "UPDATE SCRIPT V2.0", "Новое обновление!\nЧто было добавлено: ничего!", "Закрыть", "", 0)
end
|