added version files

master
rubin 2 years ago
parent b65691939c
commit dad8eb4c9f
  1. 2
      .gitattributes
  2. 5
      changelog
  3. 116
      corn-hud.lua
  4. 1
      version

2
.gitattributes vendored

@ -0,0 +1,2 @@
*.lua working-tree-encoding=windows-1251
changelog working-tree-encoding=windows-1251

@ -0,0 +1,5 @@
Версия от 23.01.2023
Добавлено меню по команде /corn
Добавлена функция смены активации
Добавлен модуль автообновления
Исправлена работа на сервере Classic

@ -116,14 +116,14 @@ function main()
end end
if render then if render then
renderText = { renderText = {
[1] = '{00D900}Öåíà ïîêóïêè çåðíà: '..ini.price.zerno..'$', [1] = '{00D900}Цена покупки зерна: '..ini.price.zerno..'$',
[2] = '{00D900}Öåíà ïðîäàæè óðîæàÿ: '..ini.price.urojai..'$', [2] = '{00D900}Цена продажи урожая: '..ini.price.urojai..'$',
[3] = '{00D900} ', [3] = '{00D900} ',
[4] = string.format('{00D900}Ôåðìà ¹0 | Áàëàíñ: %d$ | Çåðíî: %d [%d$] | Óðîæàé: %d [%d$]', ini['Farm 0'].bank, ini['Farm 0'].corn, ini['Farm 0'].cornPrice, ini['Farm 0'].product, ini['Farm 0'].productPrice), [4] = string.format('{00D900}Ферма №0 | Баланс: %d$ | Зерно: %d [%d$] | Урожай: %d [%d$]', ini['Farm 0'].bank, ini['Farm 0'].corn, ini['Farm 0'].cornPrice, ini['Farm 0'].product, ini['Farm 0'].productPrice),
[5] = string.format('{00D900}Ôåðìà ¹1 | Áàëàíñ: %d$ | Çåðíî: %s [%s$] | Óðîæàé: %s [%s$]', ini['Farm 1'].bank, ini['Farm 1'].corn, ini['Farm 1'].cornPrice, ini['Farm 1'].product, ini['Farm 1'].productPrice), [5] = string.format('{00D900}Ферма №1 | Баланс: %d$ | Зерно: %s [%s$] | Урожай: %s [%s$]', ini['Farm 1'].bank, ini['Farm 1'].corn, ini['Farm 1'].cornPrice, ini['Farm 1'].product, ini['Farm 1'].productPrice),
[6] = string.format('{00D900}Ôåðìà ¹2 | Áàëàíñ: %d$ | Çåðíî: %s [%s$] | Óðîæàé: %s [%s$]', ini['Farm 2'].bank, ini['Farm 2'].corn, ini['Farm 2'].cornPrice, ini['Farm 2'].product, ini['Farm 2'].productPrice), [6] = string.format('{00D900}Ферма №2 | Баланс: %d$ | Зерно: %s [%s$] | Урожай: %s [%s$]', ini['Farm 2'].bank, ini['Farm 2'].corn, ini['Farm 2'].cornPrice, ini['Farm 2'].product, ini['Farm 2'].productPrice),
[7] = string.format('{00D900}Ôåðìà ¹3 | Áàëàíñ: %d$ | Çåðíî: %s [%s$] | Óðîæàé: %s [%s$]', ini['Farm 3'].bank, ini['Farm 3'].corn, ini['Farm 3'].cornPrice, ini['Farm 3'].product, ini['Farm 3'].productPrice), [7] = string.format('{00D900}Ферма №3 | Баланс: %d$ | Зерно: %s [%s$] | Урожай: %s [%s$]', ini['Farm 3'].bank, ini['Farm 3'].corn, ini['Farm 3'].cornPrice, ini['Farm 3'].product, ini['Farm 3'].productPrice),
[8] = string.format('{00D900}Ôåðìà ¹4 | Áàëàíñ: %d$ | Çåðíî: %s [%s$] | Óðîæàé: %s [%s$]', ini['Farm 4'].bank, ini['Farm 4'].corn, ini['Farm 4'].cornPrice, ini['Farm 4'].product, ini['Farm 4'].productPrice), [8] = string.format('{00D900}Ферма №4 | Баланс: %d$ | Зерно: %s [%s$] | Урожай: %s [%s$]', ini['Farm 4'].bank, ini['Farm 4'].corn, ini['Farm 4'].cornPrice, ini['Farm 4'].product, ini['Farm 4'].productPrice),
} }
local X, Y = ini.Settings.X, ini.Settings.Y local X, Y = ini.Settings.X, ini.Settings.Y
for i = 1, #renderText do for i = 1, #renderText do
@ -144,10 +144,10 @@ function main()
posY = ((posY / 2.2) - (renderGetFontDrawHeight(font) * 3)) posY = ((posY / 2.2) - (renderGetFontDrawHeight(font) * 3))
renderText = { renderText = {
[1] = (render and 'Corn-HUD: ON' or 'Corn-HUD: OFF'), [1] = (render and 'Corn-HUD: ON' or 'Corn-HUD: OFF'),
[2] = 'Çàãðóçèòü', [2] = 'Загрузить',
[3] = 'Ðàçãðóçèòü', [3] = 'Разгрузить',
[4] = 'Èíôîðìàöèÿ î ôåðìå', [4] = 'Информация о ферме',
[5] = 'Îáíîâèòü èíôîðìàöèþ î ôåðìå' [5] = 'Обновить информацию о ферме'
} }
for i = 1, #renderText do for i = 1, #renderText do
if drawClickableText(renderText[i], posX - (renderGetFontDrawTextLength(font, renderText[i]) / 2), posY, 0xFF00D900, 0xFFFFFFFF) then if drawClickableText(renderText[i], posX - (renderGetFontDrawTextLength(font, renderText[i]) / 2), posY, 0xFF00D900, 0xFFFFFFFF) then
@ -201,37 +201,37 @@ function main()
end end
function sampev.onServerMessage(color, message) function sampev.onServerMessage(color, message)
if message:find(' Çåðíî: (%d+) / 1500') then if message:find(' Зерно: (%d+) / 1500') then
zerno = tonumber(message:match(' Çåðíî: (%d+) / 1500')) zerno = tonumber(message:match(' Зерно: (%d+) / 1500'))
end end
if message:find(' Óðîæàé: (%d+) / 1500') then if message:find(' Урожай: (%d+) / 1500') then
urojai = tonumber(message:match(' Óðîæàé: (%d+) / 1500')) urojai = tonumber(message:match(' Урожай: (%d+) / 1500'))
end end
if message:find(' Íàðêîòèêè: (%d+) / 1500') then if message:find(' Наркотики: (%d+) / 1500') then
narko = tonumber(message:match(' Íàðêîòèêè: (%d+) / 1500')) narko = tonumber(message:match(' Наркотики: (%d+) / 1500'))
end end
end end
function sampev.onCreate3DText(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text) function sampev.onCreate3DText(id, color, position, distance, testLOS, attachedPlayerId, attachedVehicleId, text)
if text:find('{FF8000}Ðàçãðóçêà íàðêîòèêîâ.*Ñòîèìîñòü íàðêîòèêîâ (%d+) âèðò') then if text:find('{FF8000}Разгрузка наркотиков.*Стоимость наркотиков (%d+) вирт') then
ini.price.narko = text:match('{FF8000}Ðàçãðóçêà íàðêîòèêîâ.*Ñòîèìîñòü íàðêîòèêîâ (%d+) âèðò') ini.price.narko = text:match('{FF8000}Разгрузка наркотиков.*Стоимость наркотиков (%d+) вирт')
inicfg.save(ini, iniName) inicfg.save(ini, iniName)
end end
if text:find('{FF8000}Çàãðóçêà çåðíà.*Ñòîèìîñòü çåðíà (%d+) âèðò.+') then if text:find('{FF8000}Загрузка зерна.*Стоимость зерна (%d+) вирт.+') then
ini.price.zerno = text:match('{FF8000}Çàãðóçêà çåðíà.*Ñòîèìîñòü çåðíà (%d+) âèðò.+') ini.price.zerno = text:match('{FF8000}Загрузка зерна.*Стоимость зерна (%d+) вирт.+')
inicfg.save(ini, iniName) inicfg.save(ini, iniName)
end end
if text:find('{FF8000}Ðàçãðóçêà óðîæàÿ.*Ñòîèìîñòü óðîæàÿ (%d+) âèðò') then if text:find('{FF8000}Разгрузка урожая.*Стоимость урожая (%d+) вирт') then
ini.price.urojai = text:match('{FF8000}Ðàçãðóçêà óðîæàÿ.*Ñòîèìîñòü óðîæàÿ (%d+) âèðò') ini.price.urojai = text:match('{FF8000}Разгрузка урожая.*Стоимость урожая (%d+) вирт')
inicfg.save(ini, iniName) inicfg.save(ini, iniName)
end end
end end
function sampev.onShowDialog(dialogId, style, title, button1, button2, text) function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
if text:find(".FBDD7E.Áàëàíñ ôåðìû:.FFFFFF.\t\t\t(%d+).+FBDD7E.Ñåìåíà â àìáàðå:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Óðîæàÿ íà ïîëå:{FFFFFF}\t\t\t(%d+) / %d+.+FBDD7E.Ïðîäóêöèè â àìáàðå:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Öåíà çà ñåìåíà:.FFFFFF.\t\t\t(%d+).+FBDD7E.Öåíà íà ïðîäóêöèþ:.FFFFFF.\t\t\t(%d+)") then if text:find(".FBDD7E.Баланс фермы:.FFFFFF.\t\t\t(%d+).+FBDD7E.Семена в амбаре:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Урожая на поле:{FFFFFF}\t\t\t(%d+) / %d+.+FBDD7E.Продукции в амбаре:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Цена за семена:.FFFFFF.\t\t\t(%d+).+FBDD7E.Цена на продукцию:.FFFFFF.\t\t\t(%d+)") then
local S0 = CheckCoord() local S0 = CheckCoord()
if S0 ~= '' then if S0 ~= '' then
ini[S0].bank, ini[S0].corn, ini[S0].product, ini[S0].cornPrice, ini[S0].productPrice = text:match(".FBDD7E.Áàëàíñ ôåðìû:.FFFFFF.\t\t\t(%d+).+FBDD7E.Ñåìåíà â àìáàðå:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Óðîæàÿ íà ïîëå:{FFFFFF}\t\t\t%d+ / %d+.+FBDD7E.Ïðîäóêöèè â àìáàðå:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Öåíà çà ñåìåíà:.FFFFFF.\t\t\t(%d+).+FBDD7E.Öåíà íà ïðîäóêöèþ:.FFFFFF.\t\t\t(%d+)") ini[S0].bank, ini[S0].corn, ini[S0].product, ini[S0].cornPrice, ini[S0].productPrice = text:match(".FBDD7E.Баланс фермы:.FFFFFF.\t\t\t(%d+).+FBDD7E.Семена в амбаре:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Урожая на поле:{FFFFFF}\t\t\t%d+ / %d+.+FBDD7E.Продукции в амбаре:.FFFFFF.\t\t\t(%d+) / %d+.+FBDD7E.Цена за семена:.FFFFFF.\t\t\t(%d+).+FBDD7E.Цена на продукцию:.FFFFFF.\t\t\t(%d+)")
inicfg.save(ini, iniName) inicfg.save(ini, iniName)
if finfoCheck ~= 0 then if finfoCheck ~= 0 then
finfoCheck = 0 finfoCheck = 0
@ -239,27 +239,27 @@ function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
end end
end end
end end
if text:find('{FFFFFF}Çåðíà êóïëåíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò.*{FFFFFF}Ñêèäêà: {0289CC}%d+ âèðò') then if text:find('{FFFFFF}Зерна куплено: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт.*{FFFFFF}Скидка: {0289CC}%d+ вирт') then
zerno = zerno + tonumber(text:match('{FFFFFF}Çåðíà êóïëåíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò.*{FFFFFF}Ñêèäêà: {0289CC}%d+ âèðò')) zerno = zerno + tonumber(text:match('{FFFFFF}Зерна куплено: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт.*{FFFFFF}Скидка: {0289CC}%d+ вирт'))
print(zerno) print(zerno)
end end
if text:find('{FFFFFF}Çåðíà ïðîäàíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò.*{FFFFFF}Äîáàâëåíî ê ÇÏ: {0289CC}%d+ âèðò') then if text:find('{FFFFFF}Зерна продано: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт.*{FFFFFF}Добавлено к ЗП: {0289CC}%d+ вирт') then
zerno = zerno - tonumber(text:match('{FFFFFF}Çåðíà ïðîäàíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò.*{FFFFFF}Äîáàâëåíî ê ÇÏ: {0289CC}%d+ âèðò')) zerno = zerno - tonumber(text:match('{FFFFFF}Зерна продано: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт.*{FFFFFF}Добавлено к ЗП: {0289CC}%d+ вирт'))
print(zerno) print(zerno)
end end
if text:find('{FFFFFF}Óðîæàÿ êóïëåíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò') then if text:find('{FFFFFF}Урожая куплено: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт') then
urojai = urojai + tonumber(text:match('{FFFFFF}Óðîæàÿ êóïëåíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò')) urojai = urojai + tonumber(text:match('{FFFFFF}Урожая куплено: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт'))
print(urojai) print(urojai)
end end
if text:find('Óðîæàÿ ïðîäàíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò') then if text:find('Урожая продано: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт') then
urojai = urojai - tonumber(text:match('Óðîæàÿ ïðîäàíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò')) urojai = urojai - tonumber(text:match('Урожая продано: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт'))
print(urojai) print(urojai)
end end
if text:find('{FFFFFF}Íàðêîòèêîâ êóïëåíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò') then if text:find('{FFFFFF}Наркотиков куплено: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт') then
narko = narko + tonumber(text:match('{FFFFFF}Íàðêîòèêîâ êóïëåíî: {0289CC}(%d+).*{FFFFFF}Öåíà: {0289CC}%d+ âèðò')) narko = narko + tonumber(text:match('{FFFFFF}Наркотиков куплено: {0289CC}(%d+).*{FFFFFF}Цена: {0289CC}%d+ вирт'))
end end
if text:find('Íàðêîòèêîâ ïðîäàíî: {0289CC}(%d+)') then if text:find('Наркотиков продано: {0289CC}(%d+)') then
narko = narko - tonumber(text:match('Íàðêîòèêîâ ïðîäàíî: {0289CC}(%d+)')) narko = narko - tonumber(text:match('Наркотиков продано: {0289CC}(%d+)'))
end end
end end
@ -301,7 +301,7 @@ menu = {}
function menu.get() function menu.get()
return { return {
{ {
settings = {title = "corn-hud" ,style = 4 ,btn1 = "Âûáðàòü" ,btn2 = "Çàêðûòü" ,forward = "{ffffff}" ,backwards = "\n" ,score = true}, settings = {title = "corn-hud" ,style = 4 ,btn1 = "Выбрать" ,btn2 = "Закрыть" ,forward = "{ffffff}" ,backwards = "\n" ,score = true},
{ {
{ {
title = 'HUD\t'..(render and "ON" or "OFF"), title = 'HUD\t'..(render and "ON" or "OFF"),
@ -312,7 +312,7 @@ function menu.get()
end end
}, },
{ {
title = 'Ñìåíèòü ïîçèöèþ\t', title = 'Сменить позицию\t',
click = function(button, list, input , outs) click = function(button, list, input , outs)
if button ~= 1 then return end if button ~= 1 then return end
if not render then if not render then
@ -332,7 +332,7 @@ function menu.get()
end end
}, },
{ {
title = 'Êëàâèøà ¹1\t'..ini.Settings.Key1:gsub("VK_", ""), title = 'Клавиша №1\t'..ini.Settings.Key1:gsub("VK_", ""),
click = function(button, list, input , outs) click = function(button, list, input , outs)
if button ~= 1 then return end if button ~= 1 then return end
wait(200) wait(200)
@ -340,7 +340,7 @@ function menu.get()
repeat repeat
wait(0) wait(0)
if not sampIsDialogActive() then if not sampIsDialogActive() then
sampShowDialog(0, "Ñìåíà àêòèâàöèè", "Íàæìèòå íà ëþáóþ êëàâèøó", "Âûáðàòü", "Çàêðûòü", 0) sampShowDialog(0, "Смена активации", "Нажмите на любую клавишу", "Выбрать", "Закрыть", 0)
end end
for k, v in pairs(vkeys) do for k, v in pairs(vkeys) do
if wasKeyPressed(v) and k ~= "VK_ESCAPE" and k ~= "VK_RETURN" then if wasKeyPressed(v) and k ~= "VK_ESCAPE" and k ~= "VK_RETURN" then
@ -354,7 +354,7 @@ function menu.get()
end end
}, },
{ {
title = 'Êëàâèøà ¹2\t'..ini.Settings.Key2:gsub("VK_", ""), title = 'Клавиша №2\t'..ini.Settings.Key2:gsub("VK_", ""),
click = function(button, list, input , outs) click = function(button, list, input , outs)
if button ~= 1 then return end if button ~= 1 then return end
wait(200) wait(200)
@ -362,7 +362,7 @@ function menu.get()
repeat repeat
wait(0) wait(0)
if not sampIsDialogActive() then if not sampIsDialogActive() then
sampShowDialog(0, "Ñìåíà àêòèâàöèè", "Íàæìèòå íà ëþáóþ êëàâèøó", "Âûáðàòü", "Çàêðûòü", 0) sampShowDialog(0, "Смена активации", "Нажмите на любую клавишу", "Выбрать", "Закрыть", 0)
end end
for k, v in pairs(vkeys) do for k, v in pairs(vkeys) do
if wasKeyPressed(v) and k ~= "VK_ESCAPE" and k ~= "VK_RETURN" then if wasKeyPressed(v) and k ~= "VK_ESCAPE" and k ~= "VK_RETURN" then
@ -470,7 +470,7 @@ function openURL(url, fpath)
if (text:find("Not found") and not text:find('"Not found"')) or text == "" then if (text:find("Not found") and not text:find('"Not found"')) or text == "" then
text = "" text = ""
addChatMessage("Íå óäàëîñü ñêà÷àòü îáíîâëåíèå ïî ññûëêå:") addChatMessage("Не удалось скачать обновление по ссылке:")
addChatMessage(url) addChatMessage(url)
end end
@ -509,12 +509,12 @@ script_update = {
if result then if result then
ini[name].server_version = text ini[name].server_version = text
if text ~= "" and not string.find(text, thisScript().version) then if text ~= "" and not string.find(text, thisScript().version) then
addChatMessage( string.format("Âûøëà íîâàÿ âåðñèÿ '%s'. Òåêóùàÿ: '%s'", text, thisScript().version) ) addChatMessage( string.format("Вышла новая версия '%s'. Текущая: '%s'", text, thisScript().version) )
if ini[name].auto_update then if ini[name].auto_update then
addChatMessage( string.format("Àâòîîáíîâëåíèå ñêðèïòà âêëþ÷åíî. Ïðîöåññ çàïóùåí!") ) addChatMessage( string.format("Автообновление скрипта включено. Процесс запущен!") )
script_update.command() script_update.command()
else else
addChatMessage( string.format("Àâòîîáíîâëåíèå ñêðèïòà âûêëþ÷åíî. Îáíîâèòü ñàìîìó: /%s", command) ) addChatMessage( string.format("Автообновление скрипта выключено. Обновить самому: /%s", command) )
end end
end end
end end
@ -528,7 +528,7 @@ script_update = {
local result, text = pcall(openURL, script_update.version_url, fpath) local result, text = pcall(openURL, script_update.version_url, fpath)
if result then if result then
if text ~= "" and not string.find(text, thisScript().version) then if text ~= "" and not string.find(text, thisScript().version) then
addChatMessage( string.format("Âûøëà íîâàÿ âåðñèÿ '%s'. Òåêóùàÿ: '%s'", text, thisScript().version) ) addChatMessage( string.format("Вышла новая версия '%s'. Текущая: '%s'", text, thisScript().version) )
local fpath = os.tmpname() local fpath = os.tmpname()
local result, text = pcall(openURL, script_update.script_url, fpath) local result, text = pcall(openURL, script_update.script_url, fpath)
if result and text ~= "" and text:find(thisScript().name:gsub("%-", "%%-")) then if result and text ~= "" and text:find(thisScript().name:gsub("%-", "%%-")) then
@ -537,13 +537,13 @@ script_update = {
file:write(text) file:write(text)
file:flush() file:flush()
io.close(file) io.close(file)
addChatMessage("Îáíîâëåíèå çàâåðøåíî, ñêðèïò ïåðåçàãðóæåí!") addChatMessage("Обновление завершено, скрипт перезагружен!")
wait(500) wait(500)
thisScript():reload() thisScript():reload()
end end
end end
else else
addChatMessage("Ó Âàñ óñòàíîâëåíà ïîñëåäíÿÿ âåðñèÿ!") addChatMessage("У Вас установлена последняя версия!")
end end
end end
end) end)
@ -553,7 +553,7 @@ script_update = {
dialog = {}, dialog = {},
init = function() init = function()
if not sampIsChatCommandDefined("rubin-mods") then if not sampIsChatCommandDefined("rubin-mods") then
sampAddChatMessage("{667dff}[RUBIN MODS]{FFFFFF} Óïðàâëåíèå îáíîâëåíèÿìè ñêðèïòîâ: /rubin-mods", 0xFFFFFFFF) sampAddChatMessage("{667dff}[RUBIN MODS]{FFFFFF} Управление обновлениями скриптов: /rubin-mods", 0xFFFFFFFF)
sampRegisterChatCommand("rubin-mods",script_update.menu.show) sampRegisterChatCommand("rubin-mods",script_update.menu.show)
while true do while true do
wait(0) wait(0)
@ -596,7 +596,7 @@ script_update = {
for i = 1, #script_update.menu.text do for i = 1, #script_update.menu.text do
text = text..script_update.menu.text[i].."\n" text = text..script_update.menu.text[i].."\n"
end end
sampShowDialog(2160,"Îáíîâëåíèå ñêðèïòîâ: Rubin Mods","Ñêðèïò\tÂåðñèÿ\n"..text,"Âûáðàòü","Çàêðûòü",5) sampShowDialog(2160,"Обновление скриптов: Rubin Mods","Скрипт\tВерсия\n"..text,"Выбрать","Закрыть",5)
end end
}, },
menu2 = { menu2 = {
@ -609,25 +609,25 @@ script_update = {
script_update.menu2.dialog = {} script_update.menu2.dialog = {}
local ini = inicfg.load({}, script_update.address_ini) local ini = inicfg.load({}, script_update.address_ini)
local k = data.script_name local k = data.script_name
script_update.menu2.text[#script_update.menu2.text+1] = string.format("Àâòîîáíîâëåíèå %s", (ini[k].auto_update and "{59fc30}ON" or "{ff0000}OFF")) script_update.menu2.text[#script_update.menu2.text+1] = string.format("Автообновление %s", (ini[k].auto_update and "{59fc30}ON" or "{ff0000}OFF"))
script_update.menu2.dialog[#script_update.menu2.dialog+1] = function() script_update.menu2.dialog[#script_update.menu2.dialog+1] = function()
ini[k].auto_update = not ini[k].auto_update ini[k].auto_update = not ini[k].auto_update
inicfg.save(ini, script_update.address_ini) inicfg.save(ini, script_update.address_ini)
script_update.menu2.show(data) script_update.menu2.show(data)
end end
if not ini[k].auto_update then if not ini[k].auto_update then
script_update.menu2.text[#script_update.menu2.text+1] = string.format("Ïðîâåðÿòü îáíîâëåíèÿ %s", (ini[k].check_update and "{59fc30}ON" or "{ff0000}OFF")) script_update.menu2.text[#script_update.menu2.text+1] = string.format("Проверять обновления %s", (ini[k].check_update and "{59fc30}ON" or "{ff0000}OFF"))
script_update.menu2.dialog[#script_update.menu2.dialog+1] = function() script_update.menu2.dialog[#script_update.menu2.dialog+1] = function()
ini[k].check_update = not ini[k].check_update ini[k].check_update = not ini[k].check_update
inicfg.save(ini, script_update.address_ini) inicfg.save(ini, script_update.address_ini)
script_update.menu2.show(data) script_update.menu2.show(data)
end end
end end
script_update.menu2.text[#script_update.menu2.text+1] = string.format("Ïîñëåäíèå èçìåíåíèÿ") script_update.menu2.text[#script_update.menu2.text+1] = string.format("Последние изменения")
script_update.menu2.dialog[#script_update.menu2.dialog+1] = function() script_update.menu2.dialog[#script_update.menu2.dialog+1] = function()
script_update.changelog(ini[k].changelog_url) script_update.changelog(ini[k].changelog_url)
end end
script_update.menu2.text[#script_update.menu2.text+1] = string.format("Óäàëèòü èç ñïèñêà") script_update.menu2.text[#script_update.menu2.text+1] = string.format("Удалить из списка")
script_update.menu2.dialog[#script_update.menu2.dialog+1] = function() script_update.menu2.dialog[#script_update.menu2.dialog+1] = function()
ini[k] = nil ini[k] = nil
inicfg.save(ini, script_update.address_ini) inicfg.save(ini, script_update.address_ini)
@ -638,14 +638,14 @@ script_update = {
for i = 1, #script_update.menu2.text do for i = 1, #script_update.menu2.text do
text = text..script_update.menu2.text[i].."\n" text = text..script_update.menu2.text[i].."\n"
end end
sampShowDialog(2162,"Íàñòðîéêè îáíîâëåíèÿ äëÿ "..data.script_name,text,"Âûáðàòü","Íàçàä",2) sampShowDialog(2162,"Настройки обновления для "..data.script_name,text,"Выбрать","Назад",2)
end end
}, },
changelog = function(url, data) changelog = function(url, data)
local fpath = os.tmpname() local fpath = os.tmpname()
local result, text = pcall(openURL, url, fpath) local result, text = pcall(openURL, url, fpath)
if result then if result then
sampShowDialog(2161,"Changelog - "..thisScript().name,text,"Âûáðàòü","Íàçàä",4) sampShowDialog(2161,"Changelog - "..thisScript().name,text,"Выбрать","Назад",4)
end end
end end
} }

@ -0,0 +1 @@
23.01.2023
Loading…
Cancel
Save