add auto-update

master
rubin 2 years ago
parent 080b08e625
commit 7678501077
  1. 13
      easy-cruise.lua

@ -1,6 +1,6 @@
script_name("easy-cruise")
script_author("rubin")
script_version("23.10.26.1")
script_version("22.10.26.1")
inicfg = require "inicfg"
dlstatus = require("moonloader").download_status
@ -86,9 +86,14 @@ script_update = {
local text = openURL(script_update.check_update_url, fpath)
if text ~= "" and not string.find(text, thisScript().version) then
addChatMessage( string.format("Вышла новая версия '%s'. Текущая: '%s'", text, thisScript().version) )
local command = thisScript().name:gsub(" ", "").."_update"
addChatMessage( string.format("Чтобы обновиться введите /%s'", command) )
sampRegisterChatCommand(command, script_update.command)
if script_update.auto_update then
addChatMessage( string.format("Авто-Обновление скрипта включено. Процесс запущен!") )
script_update.command()
else
local command = thisScript().name:gsub(" ", "").."_update"
sampRegisterChatCommand(command, script_update.command)
addChatMessage( string.format("Авто-Обновление скрипта выключено. Обновить самому: %s", command) )
end
end
end
end,

Loading…
Cancel
Save