From 8814c417afc35e907c5b1686824c19b38e8cf60f Mon Sep 17 00:00:00 2001 From: Aleksandr Avdeev Date: Mon, 21 Oct 2024 13:18:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=83=20=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BE=D1=81=D0=B2=D0=BE=D0=B1=D0=BE=D0=B6=D0=B4=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=B3=D1=80=D0=BE=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D1=82=D1=8E=D1=80=D1=8C=D0=BC=D1=8B=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D0=BD=D0=B8=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- init.lua | 29 +++++++++++++++++++++++++++-- locale/jail.ru.tr | 2 ++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 1470343..1dd73b8 100644 --- a/init.lua +++ b/init.lua @@ -70,7 +70,7 @@ jail.set_release_privs = function(self_name, player, prisoners_list_id) table.remove(prisoners_list, prisoners_list_id) end -jail.release = function(self_name, id_player) +jail.release_id = function(self_name, id_player) local id = tonumber(id_player) local playername = prisoners_list[id] if (id == nil or id > #prisoners_list or id <= 0) then @@ -88,6 +88,22 @@ jail.release = function(self_name, id_player) end end +jail.release = function(self_name, player_name) + for i = 1, #prisoners_list do + if player_name == prisoners_list[i] then + local player = minetest.env:get_player_by_name(player_name) + if (player) then + player:setpos(releasepos) + minetest.chat_send_player(player_name, minetest.colorize("green", S("You have been released from jail"))) + end + jail.set_release_privs(self_name, player_name, i) + return + else + minetest.chat_send_player(self_name, S("Invalid playername")) + end + end +end + minetest.register_chatcommand("jail", { params = "", description = S("Sends a player to Jail"), @@ -119,11 +135,20 @@ minetest.register_chatcommand("jail_return", { }) minetest.register_chatcommand("release", { + params = "", + description = S("Releases a player from Jail by nickname"), + privs = { jail = true }, + func = function(name, param) + jail.release(name, param) + end, +}) + +minetest.register_chatcommand("release_id", { params = "", description = S("Releases a player from Jail by ID"), privs = { jail = true }, func = function(name, param) - jail.release(name, param) + jail.release_id(name, param) end, }) diff --git a/locale/jail.ru.tr b/locale/jail.ru.tr index ca43563..44bd833 100644 --- a/locale/jail.ru.tr +++ b/locale/jail.ru.tr @@ -4,6 +4,7 @@ Allows one to send/release prisoners=Позволяет заключать и о Sends a player to Jail=Отправить игрока в тюрьму Sends the player to prison for a limited time= Releases a player from Jail by ID=Освободить игрока из тюрьмы по ID +Releases a player from Jail by nickname=Освободить игрока из тюрьмы по никнейму You have been sent to jail=Вы помещены в тюрьму You have been return to jail=Вы возвращены в тюрьму You have been released from jail=Вы были освобождены из тюрьмы @@ -13,6 +14,7 @@ has been released from jail by=был освобожден из тюрьмы и List of prisoners=Список заключенных Prisoners:=Заключенные: Invalid ID=Неверный ID +Invalid playername=Неверное имя игрока Return a prisoner to jail=Возвратить заключенного в тюрьму The player is already in jail=Игрок уже в тюреме Total number of prisoners:=Общее число заключенных: -- 2.47.1