if imgui.Button(u8'Проверить обновления##check_update', imgui.ImVec2(125,50)) then
local fpath = os.getenv('TEMP') .. '\\satiety-bot.json'
downloadUrlToFile('https://gist.githubusercontent.com/CodesSamp/ae80c392812e790302a7306fd97cd929/raw/ad7ad5117980edd88d47523e9d749b980151a917/raw', fpath, function(id, status, p1, p2)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
local f = io.open(fpath, 'r')
if f then
local info = decodeJson(f:read('*a'))
updatelink = info.updateurl
if info and info.latest then
version = tonumber(info.latest)
ver = tonumber(info.ver)
if version > tonumber(thisScript().version) then
new = 1
sampAddChatMessage(('[Helper]: {FFFFFF}Доступно обновление!'), 0xF1CB09)
else
update = false
sampAddChatMessage(('[Helper]: {FFFFFF}У вас установлена последняя версия!'), 0xF1CB09)
end
end
end
end
end)
end
if new == 1 then
imgui.SameLine()
if imgui.Button(u8'Обновить##update') then
lua_thread.create(function()
sampAddChatMessage(('[Helper]: Обновляюсь...'), 0xF1CB09)
wait(300)
downloadUrlToFile(updatelink, thisScript().path, function(id3, status1, p13, p23)
if status1 == dlstatus.STATUS_ENDDOWNLOADDATA then
sampAddChatMessage(('[Helper]: Обновление завершено!'), 0xF1CB09)
thisScript():reload()
end
end)
end)
end
end