|
|
|
@ -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 |