From 21b1a4ddbe684d2389f47cfe2a9499a6d4be6919 Mon Sep 17 00:00:00 2001 From: rubin Date: Fri, 27 Jan 2023 22:58:04 +0300 Subject: [PATCH] bump version 27.01.2023 --- changelog | 7 +++++-- corn-hud.lua | 10 +++++----- version | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/changelog b/changelog index 3045e57..8ae6dbd 100644 --- a/changelog +++ b/changelog @@ -1,2 +1,5 @@ -Версия от 25.01.2023 - Скрипт переведен в кодировку UTF-8 \ No newline at end of file +Версия от 27.01.2023 + Добавлено меню /corn + Теперь можно сменить клавиши активации + Скрипт переведен в кодировку UTF-8 + Добавлен модуль автообновлений /rubin-mods diff --git a/corn-hud.lua b/corn-hud.lua index dc9f86b..c1ab42c 100644 --- a/corn-hud.lua +++ b/corn-hud.lua @@ -1,6 +1,6 @@ script_name('corn-hud') script_author("Serhiy_Rubin") -script_version("25.01.2023") +script_version("27.01.2023") require 'lib.sampfuncs' require 'lib.moonloader' local dlstatus = require("moonloader").download_status @@ -483,9 +483,9 @@ function addChatMessage(text) end script_update = { - version_url = "http://git.deadpoo.net/rubin/test/raw/branch/master/version", - script_url = "http://git.deadpoo.net/rubin/test/raw/branch/master/corn-hud.lua", - changelog_url = "http://git.deadpoo.net/rubin/test/raw/branch/master/changelog", + version_url = "http://git.deadpoo.net/rubin/corn-hud/raw/branch/master/version", + script_url = "http://git.deadpoo.net/rubin/corn-hud/raw/branch/master/corn-hud.lua", + changelog_url = "http://git.deadpoo.net/rubin/corn-hud/raw/branch/master/changelog", address_ini = "rubin-mods-updates.ini", main = function() local name = thisScript().name @@ -654,7 +654,7 @@ script_update = { -->> utf8(table path, incoming variables encoding, outcoming variables encoding) -->> table path example { "sampev", "onShowDialog" } -->> encoding options nil | AnsiToUtf8 | Utf8ToAnsi -_utf8 = load([=[return function(utf8_func, in_encoding, out_encoding); if encoding == nil then; encoding = require("encoding"); encoding.default = "CP1251"; u8 = encoding.UTF8; end; if type(utf8_func) ~= "table" then; return false; end; if AnsiToUtf8 == nil or Utf8ToAnsi == nil then; AnsiToUtf8 = function(text); return u8(text); end; Utf8ToAnsi = function(text); return u8:decode(text); end; end; if _UTF8_FUNCTION_SAVE == nil then; _UTF8_FUNCTION_SAVE = {}; end; local change_var = "_G"; for s = 1, #utf8_func do; change_var = string.format('%s["%s"]', change_var, utf8_func[s]); end; if _UTF8_FUNCTION_SAVE[change_var] == nil then _UTF8_FUNCTION = function(...); local pack = table.pack(...); for i = 1, pack.n do; if type(pack[i]) == "string" and in_encoding ~= nil and (in_encoding == "AnsiToUtf8" or in_encoding == "Utf8ToAnsi") then; pack[i] = _G[in_encoding](pack[i]); end; end; local unpacked = {_UTF8_FUNCTION_SAVE[change_var](table.unpack(pack))}; for i = 1, #unpacked do; if type(unpacked[i]) == "string" and out_encoding ~= nil and (out_encoding == "AnsiToUtf8" or out_encoding == "Utf8ToAnsi") then; unpacked[i] = _G[out_encoding](unpacked[i]); end; end; return table.unpack(unpacked); end; local text = string.format("_UTF8_FUNCTION_SAVE['%s'] = %s; %s = _UTF8_FUNCTION;", change_var, change_var, change_var); load(text)(); _UTF8_FUNCTION = nil; end; return true; end]=]) +_utf8 = load([=[return function(utf8_func, in_encoding, out_encoding); if encoding == nil then; encoding = require("encoding"); encoding.default = "CP1251"; u8 = encoding.UTF8; end; if type(utf8_func) ~= "table" then; return false; end; if AnsiToUtf8 == nil or Utf8ToAnsi == nil then; AnsiToUtf8 = function(text); return u8(text); end; Utf8ToAnsi = function(text); return u8:decode(text); end; end; if _UTF8_FUNCTION_SAVE == nil then; _UTF8_FUNCTION_SAVE = {}; end; local change_var = "_G"; for s = 1, #utf8_func do; change_var = string.format('%s["%s"]', change_var, utf8_func[s]); end; if _UTF8_FUNCTION_SAVE[change_var] == nil then; _UTF8_FUNCTION = function(...); local pack = table.pack(...); readTable = function(t, enc); for k, v in next, t do; if type(v) == 'table' then; readTable(v, enc); else; if enc ~= nil and (enc == "AnsiToUtf8" or enc == "Utf8ToAnsi") then; if type(k) == "string" then; k = _G[enc](k); end; if type(v) == "string" then; t[k] = _G[enc](v); end; end; end; end; return t; end; return table.unpack(readTable({_UTF8_FUNCTION_SAVE[change_var](table.unpack(readTable(pack, in_encoding)))}, out_encoding)); end; local text = string.format("_UTF8_FUNCTION_SAVE['%s'] = %s; %s = _UTF8_FUNCTION;", change_var, change_var, change_var); load(text)(); _UTF8_FUNCTION = nil; end; return true; end]=]) function utf8(...) pcall(_utf8(), ...) end diff --git a/version b/version index f9aa7e7..2d8d81b 100644 --- a/version +++ b/version @@ -1 +1 @@ -25.01.2023 \ No newline at end of file +27.01.2023 \ No newline at end of file