new thread for testers upd

update
rubin 2 years ago
parent fd5426844d
commit c3fa930814
  1. 26
      mafia-tools.lua

@ -556,18 +556,20 @@ upd_testers.init = function()
local command = (thisScript().name:gsub(" ", "").."-test"):lower()
addChatMessage("Активна команда обновления скрипта: "..command)
sampRegisterChatCommand(command, function()
local fpath = os.tmpname()
local result, text = pcall(openURL, upd_testers.url, fpath)
if result and text ~= "" and text:find(thisScript().name:gsub("%-", "%%-")) then
local file, error = io.open(thisScript().path, "w")
if file ~= nil then
file:write(text)
file:flush()
io.close(file)
addChatMessage("Обновление завершено, скрипт перезагружен!")
wait(500)
thisScript():reload()
lua_thread.create(function()
local fpath = os.tmpname()
local result, text = pcall(openURL, upd_testers.url, fpath)
if result and text ~= "" and text:find(thisScript().name:gsub("%-", "%%-")) then
local file, error = io.open(thisScript().path, "w")
if file ~= nil then
file:write(text)
file:flush()
io.close(file)
addChatMessage("Обновление завершено, скрипт перезагружен!")
wait(500)
thisScript():reload()
end
end
end
end)
end)
end
Loading…
Cancel
Save