- 345
- 12
что не так в коде?
, вот вторая версия скрипта(она тестовая)
Lua:
script_name('aak')
script_author('enyag')
require "lib.moonloader" -- подключение библиотеки
local dlstatus = require('moonloader').download_status
local inicfg = require 'inicfg'
update_state = false
local script_vers = 1
local script_vers_text = "1.00"
local update_url = "https://raw.githubusercontent.com/enyagboss/sektapearsprojectrp/master/update.ini" -- тут тоже свою ссылку
local update_path = getWorkingDirectory() .. "/update.ini" -- и тут свою ссылку
local script_url = "https://github.com/enyagboss/sektapearsprojectrp/blob/master/aak.luac?raw=true" -- тут свою ссылку
local script_path = thisScript().path
tik = "Включить замену никнеймов\nЧёрный экран\nВключить только РП чат\nПозывный и состав."
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("aak", cmd_aak)
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
nick = sampGetPlayerNickname(id)
downloadUrlToFile(update_url, update_path, function(id, status)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
updateIni = inicfg.load(nil, update_path)
if tonumber(updateIni.info.vers) > script_vers then
sampAddChatMessage("Есть обновление! Версия: " .. updateIni.info.vers_text, -1)
update_state = true
end
os.remove(update_path)
end
end)
while true do
wait(0)
if update_state then
downloadUrlToFile(script_url, script_path, function(id, status)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
sampAddChatMessage("Скрипт успешно обновлен!", -1)
thisScript():reload()
end
end)
break
end
end
end
function cmd_aak(arg)
sampShowDialog(55555, "Скрипт для ААК by Enyag", tik, "Выбрать", "Закрыть", 2)
end
Lua:
script_name('aak')
script_author('enyag')
require "lib.moonloader" -- подключение библиотеки
local dlstatus = require('moonloader').download_status
local inicfg = require 'inicfg'
update_state = false
local script_vers = 1
local script_vers_text = "1.00"
local update_url = "https://raw.githubusercontent.com/enyagboss/sektapearsprojectrp/master/update.ini" -- тут тоже свою ссылку
local update_path = getWorkingDirectory() .. "/update.ini" -- и тут свою ссылку
local script_url = "https://github.com/enyagboss/sektapearsprojectrp/blob/master/aak.luac?raw=true" -- тут свою ссылку
local script_path = thisScript().path
tik = "Включить замену никнеймов\nЧёрный экран\nВключить только РП чат\nПозывный и состав."
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("aak", cmd_aak)
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
nick = sampGetPlayerNickname(id)
downloadUrlToFile(update_url, update_path, function(id, status)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
updateIni = inicfg.load(nil, update_path)
if tonumber(updateIni.info.vers) > script_vers then
sampAddChatMessage("Есть обновление! Версия: " .. updateIni.info.vers_text, -1)
update_state = true
end
os.remove(update_path)
end
end)
while true do
wait(0)
if update_state then
downloadUrlToFile(script_url, script_path, function(id, status)
if status == dlstatus.STATUS_ENDDOWNLOADDATA then
sampAddChatMessage("Скрипт успешно обновлен!", -1)
thisScript():reload()
end
end)
break
end
end
end
function cmd_aak(arg)
sampShowDialog(55555, "Скрипт для ААК by Enyag and Morris", tik, "Выбрать", "Закрыть", 2)
end