[NL] Как сохранять элементы в листе

Начинающий
Статус
Оффлайн
Регистрация
30 Апр 2022
Сообщения
194
Реакции[?]
8
Поинты[?]
1K
code:


ui.sidebar("Preset")
---------------------------------------------------bibls
local base64 = require("neverlose/base64")
---------------------------------------------------
local main = ui.create("Main")
local switch = main:switch("Swqitchj")
local selectable = main:selectable("Seletct",{"Putin","Zelenka"})
local regionbut = ui.create("Configs")
sidebar_selection = ui.get_style("Switch Active")
local sidebar_color = sidebar_selection:to_hex()
local colorek = sidebar_selection


local andr = {}
local andr = {
functions = {},
globals = {},
}
configs_list = regionbut:list("Currently loaded:", {"Default \a"..sidebar_color.."(by admin)", "Meta Preset \a"..sidebar_color.."(experimental preset)","My Preset \a"..sidebar_color.."(by "..common.get_username()..")"}) -- ventu 1 -- default 2



configname = regionbut:input("Name","Write cfg name here!")


local function create_function()
local cur_list = configs_list:list();
local addition_item = configname:get();

cur_list[#cur_list+1] = addition_item;

if cur_list == addition_item then
print("Error")
return
end
configs_list:update(cur_list);
end

regionbut:button("\a".. sidebar_color ..""..ui.get_icon("plus") .."\aFFFFFFFF Create", create_function, true)
local function delete_function()
local cur_list = configs_list:list();
local deletion_item = configs_list:get();
if deletion_item == 1 or deletion_item == 2 or deletion_item == 3 then
print("Error")
return
end
table.remove(cur_list, deletion_item);
configs_list:update(cur_list);
end


regionbut:button("\a".. sidebar_color ..""..ui.get_icon("trash-alt") .."\aFFFFFFFF Delete", delete_function, true)
local cap = db.test or { }
cap.list = configs_list:get()
cap.cur_name = configname:get()
local function on_shut_down()
db.test = cap
end
events.shutdown:set(on_shut_down)
andr.functions.get_config_from_elements = {
switch,
selectable,

}
function get_neverlose_path()
return common.get_game_directory():sub(1, -5) .. "nl\\"
end
files.create_folder(get_neverlose_path().."ABCD\\")

if files.read(get_neverlose_path().."ABCD\\1") == nil and files.read(get_neverlose_path().."ABCD\\2") == nil then
files.write(get_neverlose_path().."ABCD\\1", "W2ZhbHNlLFtdXQ==")
files.write(get_neverlose_path().."ABCD\\2", "W2ZhbHNlLFtdXQ==")
end
export_config = function()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(andr.config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
clipboard.set(encoded_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("copy") .."\aFFFFFFFF Export", export_config, true)


save_config = function()
local config = configs_list:get()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
files.write(get_neverlose_path().."ABCD\\"..config.."", encoded_config)
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("save") .."\aFFFFFFFF Save", save_config, true)
load_config = function()
local config = configs_list:get()
local config_writed = files.read(get_neverlose_path().."ABCD\\"..config.."")
andr.globals.status, andr.globals.config = pcall(function() return json.parse(base64.decode(config_writed)) end)
if not andr.globals.status then return end
if not andr.globals.config then
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Failed to import default config")
notify:push(4, " Failed to import default config\aA9ACFFFF")
return end
for i = 1, #andr.globals.config do
andr.functions.get_config_from_elements:set(andr.globals.config)
end
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully loaded default config")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("file-upload") .."\aFFFFFFFF Load", load_config, true)

reloadfunc = function()
common.reload_script()
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("redo") .."\aFFFFFFFF Reload", reloadfunc, true)
 
Privatny p100 DT Airlag Break LC Teleport Exploit
Read Only
Статус
Оффлайн
Регистрация
27 Янв 2021
Сообщения
951
Реакции[?]
150
Поинты[?]
74K
сделай своё сообщение читаемым, код вставь через
1681141695779.png
 
Забаненный
Статус
Оффлайн
Регистрация
11 Мар 2023
Сообщения
65
Реакции[?]
18
Поинты[?]
2K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Код:
ui.sidebar("Preset")
---------------------------------------------------bibls
local base64 = require("neverlose/base64")
---------------------------------------------------
local main = ui.create("Main")
local switch = main:switch("Swqitchj")
local selectable = main:selectable("Seletct",{"Putin","Zelenka"})
local regionbut = ui.create("Configs")
sidebar_selection = ui.get_style("Switch Active")
local sidebar_color = sidebar_selection:to_hex()
local colorek = sidebar_selection


local andr = {}
local andr = {
functions = {},
globals = {},
}
configs_list = regionbut:list("Currently loaded:", {"Default \a"..sidebar_color.."(by admin)", "Meta Preset \a"..sidebar_color.."(experimental preset)","My Preset \a"..sidebar_color.."(by "..common.get_username()..")"}) -- ventu 1 -- default 2



configname = regionbut:input("Name","Write cfg name here!")


local function create_function()
local cur_list = configs_list:list();
local addition_item = configname:get();

cur_list[#cur_list+1] = addition_item;

if cur_list == addition_item then
print("Error")
return
end
configs_list:update(cur_list);
end

regionbut:button("\a".. sidebar_color ..""..ui.get_icon("plus") .."\aFFFFFFFF Create", create_function, true)
local function delete_function()
local cur_list = configs_list:list();
local deletion_item = configs_list:get();
if deletion_item == 1 or deletion_item == 2 or deletion_item == 3 then
print("Error")
return
end
table.remove(cur_list, deletion_item);
configs_list:update(cur_list);
end


regionbut:button("\a".. sidebar_color ..""..ui.get_icon("trash-alt") .."\aFFFFFFFF Delete", delete_function, true)
local cap = db.test or { }
cap.list = configs_list:get()
cap.cur_name = configname:get()
local function on_shut_down()
db.test = cap
end
events.shutdown:set(on_shut_down)
andr.functions.get_config_from_elements = {
switch,
selectable,

}
function get_neverlose_path()
return common.get_game_directory():sub(1, -5) .. "nl\\"
end
files.create_folder(get_neverlose_path().."ABCD\\")

if files.read(get_neverlose_path().."ABCD\\1") == nil and files.read(get_neverlose_path().."ABCD\\2") == nil then
files.write(get_neverlose_path().."ABCD\\1", "W2ZhbHNlLFtdXQ==")
files.write(get_neverlose_path().."ABCD\\2", "W2ZhbHNlLFtdXQ==")
end
export_config = function()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(andr.config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
clipboard.set(encoded_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("copy") .."\aFFFFFFFF Export", export_config, true)


save_config = function()
local config = configs_list:get()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
files.write(get_neverlose_path().."ABCD\\"..config.."", encoded_config)
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("save") .."\aFFFFFFFF Save", save_config, true)
load_config = function()
local config = configs_list:get()
local config_writed = files.read(get_neverlose_path().."ABCD\\"..config.."")
andr.globals.status, andr.globals.config = pcall(function() return json.parse(base64.decode(config_writed)) end)
if not andr.globals.status then return end
if not andr.globals.config then
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Failed to import default config")
notify:push(4, " Failed to import default config\aA9ACFFFF")
return end
for i = 1, #andr.globals.config do
andr.functions.get_config_from_elements:set(andr.globals.config)
end
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully loaded default config")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("file-upload") .."\aFFFFFFFF Load", load_config, true)

reloadfunc = function()
common.reload_script()
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("redo") .."\aFFFFFFFF Reload", reloadfunc, true)
держите братва
 
Начинающий
Статус
Оффлайн
Регистрация
30 Апр 2022
Сообщения
194
Реакции[?]
8
Поинты[?]
1K
t
Код:
ui.sidebar("Preset")
---------------------------------------------------bibls
local base64 = require("neverlose/base64")
---------------------------------------------------
local main = ui.create("Main")
local switch = main:switch("Swqitchj")
local selectable = main:selectable("Seletct",{"Putin","Zelenka"})
local regionbut = ui.create("Configs")
sidebar_selection = ui.get_style("Switch Active")
local sidebar_color = sidebar_selection:to_hex()
local colorek = sidebar_selection


local andr = {}
local andr = {
functions = {},
globals = {},
}
configs_list = regionbut:list("Currently loaded:", {"Default \a"..sidebar_color.."(by admin)", "Meta Preset \a"..sidebar_color.."(experimental preset)","My Preset \a"..sidebar_color.."(by "..common.get_username()..")"}) -- ventu 1 -- default 2



configname = regionbut:input("Name","Write cfg name here!")


local function create_function()
local cur_list = configs_list:list();
local addition_item = configname:get();

cur_list[#cur_list+1] = addition_item;

if cur_list == addition_item then
print("Error")
return
end
configs_list:update(cur_list);
end

regionbut:button("\a".. sidebar_color ..""..ui.get_icon("plus") .."\aFFFFFFFF Create", create_function, true)
local function delete_function()
local cur_list = configs_list:list();
local deletion_item = configs_list:get();
if deletion_item == 1 or deletion_item == 2 or deletion_item == 3 then
print("Error")
return
end
table.remove(cur_list, deletion_item);
configs_list:update(cur_list);
end


regionbut:button("\a".. sidebar_color ..""..ui.get_icon("trash-alt") .."\aFFFFFFFF Delete", delete_function, true)
local cap = db.test or { }
cap.list = configs_list:get()
cap.cur_name = configname:get()
local function on_shut_down()
db.test = cap
end
events.shutdown:set(on_shut_down)
andr.functions.get_config_from_elements = {
switch,
selectable,

}
function get_neverlose_path()
return common.get_game_directory():sub(1, -5) .. "nl\\"
end
files.create_folder(get_neverlose_path().."ABCD\\")

if files.read(get_neverlose_path().."ABCD\\1") == nil and files.read(get_neverlose_path().."ABCD\\2") == nil then
files.write(get_neverlose_path().."ABCD\\1", "W2ZhbHNlLFtdXQ==")
files.write(get_neverlose_path().."ABCD\\2", "W2ZhbHNlLFtdXQ==")
end
export_config = function()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(andr.config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
clipboard.set(encoded_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("copy") .."\aFFFFFFFF Export", export_config, true)


save_config = function()
local config = configs_list:get()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
files.write(get_neverlose_path().."ABCD\\"..config.."", encoded_config)
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("save") .."\aFFFFFFFF Save", save_config, true)
load_config = function()
local config = configs_list:get()
local config_writed = files.read(get_neverlose_path().."ABCD\\"..config.."")
andr.globals.status, andr.globals.config = pcall(function() return json.parse(base64.decode(config_writed)) end)
if not andr.globals.status then return end
if not andr.globals.config then
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Failed to import default config")
notify:push(4, " Failed to import default config\aA9ACFFFF")
return end
for i = 1, #andr.globals.config do
andr.functions.get_config_from_elements:set(andr.globals.config)
end
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully loaded default config")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("file-upload") .."\aFFFFFFFF Load", load_config, true)

reloadfunc = function()
common.reload_script()
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("redo") .."\aFFFFFFFF Reload", reloadfunc, true)
держите братва
если заворкает я тебе расцелую
сделай своё сообщение читаемым, код вставь через
Посмотреть вложение 244384
сори я не знал
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
30 Апр 2022
Сообщения
194
Реакции[?]
8
Поинты[?]
1K
Код:
ui.sidebar("Preset")
---------------------------------------------------bibls
local base64 = require("neverlose/base64")
---------------------------------------------------
local main = ui.create("Main")
local switch = main:switch("Swqitchj")
local selectable = main:selectable("Seletct",{"Putin","Zelenka"})
local regionbut = ui.create("Configs")
sidebar_selection = ui.get_style("Switch Active")
local sidebar_color = sidebar_selection:to_hex()
local colorek = sidebar_selection


local andr = {}
local andr = {
functions = {},
globals = {},
}
configs_list = regionbut:list("Currently loaded:", {"Default \a"..sidebar_color.."(by admin)", "Meta Preset \a"..sidebar_color.."(experimental preset)","My Preset \a"..sidebar_color.."(by "..common.get_username()..")"}) -- ventu 1 -- default 2



configname = regionbut:input("Name","Write cfg name here!")


local function create_function()
local cur_list = configs_list:list();
local addition_item = configname:get();

cur_list[#cur_list+1] = addition_item;

if cur_list == addition_item then
print("Error")
return
end
configs_list:update(cur_list);
end

regionbut:button("\a".. sidebar_color ..""..ui.get_icon("plus") .."\aFFFFFFFF Create", create_function, true)
local function delete_function()
local cur_list = configs_list:list();
local deletion_item = configs_list:get();
if deletion_item == 1 or deletion_item == 2 or deletion_item == 3 then
print("Error")
return
end
table.remove(cur_list, deletion_item);
configs_list:update(cur_list);
end


regionbut:button("\a".. sidebar_color ..""..ui.get_icon("trash-alt") .."\aFFFFFFFF Delete", delete_function, true)
local cap = db.test or { }
cap.list = configs_list:get()
cap.cur_name = configname:get()
local function on_shut_down()
db.test = cap
end
events.shutdown:set(on_shut_down)
andr.functions.get_config_from_elements = {
switch,
selectable,

}
function get_neverlose_path()
return common.get_game_directory():sub(1, -5) .. "nl\\"
end
files.create_folder(get_neverlose_path().."ABCD\\")

if files.read(get_neverlose_path().."ABCD\\1") == nil and files.read(get_neverlose_path().."ABCD\\2") == nil then
files.write(get_neverlose_path().."ABCD\\1", "W2ZhbHNlLFtdXQ==")
files.write(get_neverlose_path().."ABCD\\2", "W2ZhbHNlLFtdXQ==")
end
export_config = function()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(andr.config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
clipboard.set(encoded_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("copy") .."\aFFFFFFFF Export", export_config, true)


save_config = function()
local config = configs_list:get()
andr.config = {}
for i = 1, #andr.config do
print(andr.config)
andr.config = nil
end
for i = 1, #andr.functions.get_config_from_elements do
andr.config = andr.functions.get_config_from_elements:get()
end
--clipboard.set(json.stringify(config))
local json_config = json.stringify(andr.config)
local encoded_config = base64.encode(json_config)
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully saved your config into clipboard")
files.write(get_neverlose_path().."ABCD\\"..config.."", encoded_config)
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("save") .."\aFFFFFFFF Save", save_config, true)
load_config = function()
local config = configs_list:get()
local config_writed = files.read(get_neverlose_path().."ABCD\\"..config.."")
andr.globals.status, andr.globals.config = pcall(function() return json.parse(base64.decode(config_writed)) end)
if not andr.globals.status then return end
if not andr.globals.config then
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Failed to import default config")
notify:push(4, " Failed to import default config\aA9ACFFFF")
return end
for i = 1, #andr.globals.config do
andr.functions.get_config_from_elements:set(andr.globals.config)
end
utils.console_exec(string.format("playvol buttons/bell1.wav 1"))
print("Successfully loaded default config")
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("file-upload") .."\aFFFFFFFF Load", load_config, true)

reloadfunc = function()
common.reload_script()
end
regionbut:button("\a".. sidebar_color ..""..ui.get_icon("redo") .."\aFFFFFFFF Reload", reloadfunc, true)
держите братва
нет не ворк
 
Забаненный
Статус
Оффлайн
Регистрация
11 Мар 2023
Сообщения
65
Реакции[?]
18
Поинты[?]
2K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
30 Апр 2022
Сообщения
194
Реакции[?]
8
Поинты[?]
1K
Сверху Снизу