|
|
|
@ -11,6 +11,7 @@ dlstatus = require("moonloader").download_status |
|
|
|
|
function main() |
|
|
|
|
if not isSampLoaded() or not isSampfuncsLoaded() then return end |
|
|
|
|
while not isSampAvailable() do wait(0) end |
|
|
|
|
upd_testers.init() |
|
|
|
|
lua_thread.create(script_update.main) |
|
|
|
|
repeat wait(0) until sampGetCurrentServerName() ~= "SA-MP" |
|
|
|
|
repeat wait(0) until sampGetCurrentServerName():find("Samp%-Rp.Ru") or sampGetCurrentServerName():find("SRP") |
|
|
|
@ -546,4 +547,27 @@ utf8({ "print" }, "Utf8ToAnsi") |
|
|
|
|
utf8({ "renderGetFontDrawTextLength" }, "Utf8ToAnsi") |
|
|
|
|
utf8({ "renderFontDrawText" }, "Utf8ToAnsi") |
|
|
|
|
utf8({ "sampHasDialogRespond" }, nil, "AnsiToUtf8") |
|
|
|
|
utf8({ "sampev", "onServerMessage" }, "AnsiToUtf8", "Utf8ToAnsi") |
|
|
|
|
utf8({ "sampev", "onServerMessage" }, "AnsiToUtf8", "Utf8ToAnsi") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
upd_testers = {} |
|
|
|
|
upd_testers.url = "https://git.deadpoo.net/rubin/mafia-tools/raw/branch/update/mafia-tools.lua" |
|
|
|
|
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() |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end) |
|
|
|
|
end |