removed .gitattributes

master
rubin 2 years ago
parent dad8eb4c9f
commit 385175184e
  1. 2
      .gitattributes
  2. 10
      changelog
  3. 116
      corn-hud.lua

2
.gitattributes vendored

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

@ -1,5 +1,5 @@
Версия от 23.01.2023 Версия от 23.01.2023
Добавлено меню по команде /corn Добавлено меню по команде /corn
Добавлена функция смены активации Добавлена функция смены активации
Добавлен модуль автообновления Добавлен модуль автообновления
Исправлена работа на сервере Classic Исправлена работа на сервере 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
} }
Loading…
Cancel
Save