From f07ec4feec149a4499c2956d1d1d525b2b1bdaaa Mon Sep 17 00:00:00 2001 From: Aleksandr Avdeev Date: Wed, 16 Oct 2024 11:11:27 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=D1=82=D1=8C=20=D1=84=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D1=8E?= =?UTF-8?q?=20=D0=BE=D1=82=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=B8?= =?UTF-8?q?=D0=B3=D1=80=D0=BE=D0=BA=D0=B0=20=D0=B2=20=D1=82=D1=8E=D1=80?= =?UTF-8?q?=D1=8C=D0=BC=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - добавлена проверка на корректность введенного имени игрока; - добавлена отправка в тюрьму игрока, который оффлайн. --- init.lua | 28 ++++++++++++++++------------ locale/jail.ru.tr | 4 +++- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/init.lua b/init.lua index 85482a8..09337c4 100644 --- a/init.lua +++ b/init.lua @@ -36,22 +36,26 @@ jail.set_permissions_for_the_jail = function (player) end jail.add_jail = function(self_player_name, player_name) - for i = 1, #prisoners_list do - if prisoners_list[i] == player_name then - minetest.chat_send_player(self_player_name, S("The player is already in jail")) - return + if (minetest.player_exists(player_name)) then + for i = 1, #prisoners_list do + if prisoners_list[i] == player_name then + minetest.chat_send_player(self_player_name, S("The player is already in jail")) + return + end end - end - local player = minetest.env:get_player_by_name(player_name) - if (player) then table.insert(prisoners_list, player_name) - player:setpos(jail.jailpos) - minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail"))) - minetest.chat_send_all(minetest.colorize("red", - "" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name)) jail.set_permissions_for_the_jail(player_name) + local player = minetest.env:get_player_by_name(player_name) + if (player) then + player:setpos(jail.jailpos) + minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail"))) + minetest.chat_send_all(minetest.colorize("red", + "" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name)) + else + minetest.chat_send_player(self_player_name, minetest.colorize("red", S("Player sent to jail, but not online"))) + end else - minetest.chat_send_player(player_name, minetest.colorize("red", S("Не в сети"))) + minetest.chat_send_player(self_player_name, minetest.colorize("red", S("The player does not exist, check that the nickname is correct"))) end end diff --git a/locale/jail.ru.tr b/locale/jail.ru.tr index 95bcf48..3b90e2b 100644 --- a/locale/jail.ru.tr +++ b/locale/jail.ru.tr @@ -28,4 +28,6 @@ Players online=Игроки онлайн Prisoners=Заключенные To jail=В тюрьму To freedom=На свободу -Graphical prisoner management shell=Графическая оболочка управления заключенными \ No newline at end of file +Graphical prisoner management shell=Графическая оболочка управления заключенными +Player sent to jail, but not online=Игрок отправлен в тюрьму, но не в сети +The player does not exist, check that the nickname is correct=Игрока не сущеcтвует, проверьте правильность ника \ No newline at end of file -- 2.47.1 From db4633f9311ecd0b2c55a2739075af2e30e30d37 Mon Sep 17 00:00:00 2001 From: Aleksandr Avdeev Date: Wed, 16 Oct 2024 13:17:17 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=9E=D1=82=D1=80=D0=B5=D0=B4=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D1=81=D0=BE?= =?UTF-8?q?=D0=BE=D0=B1=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B2=20=D1=87?= =?UTF-8?q?=D0=B0=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - редакция перевода; - реорганизация отправки сообщений чата в функции посадки в тюрьму --- init.lua | 8 +++----- locale/jail.ru.tr | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 09337c4..99da9f0 100644 --- a/init.lua +++ b/init.lua @@ -46,16 +46,14 @@ jail.add_jail = function(self_player_name, player_name) table.insert(prisoners_list, player_name) jail.set_permissions_for_the_jail(player_name) local player = minetest.env:get_player_by_name(player_name) + minetest.chat_send_all(minetest.colorize("red", + "" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name)) if (player) then player:setpos(jail.jailpos) minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail"))) - minetest.chat_send_all(minetest.colorize("red", - "" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name)) - else - minetest.chat_send_player(self_player_name, minetest.colorize("red", S("Player sent to jail, but not online"))) end else - minetest.chat_send_player(self_player_name, minetest.colorize("red", S("The player does not exist, check that the nickname is correct"))) + minetest.chat_send_player(self_player_name, minetest.colorize("red", S("The player '") .. player_name .. S("' does not exist, check that the nickname is correct"))) end end diff --git a/locale/jail.ru.tr b/locale/jail.ru.tr index 3b90e2b..ca43563 100644 --- a/locale/jail.ru.tr +++ b/locale/jail.ru.tr @@ -28,6 +28,6 @@ Players online=Игроки онлайн Prisoners=Заключенные To jail=В тюрьму To freedom=На свободу -Graphical prisoner management shell=Графическая оболочка управления заключенными -Player sent to jail, but not online=Игрок отправлен в тюрьму, но не в сети -The player does not exist, check that the nickname is correct=Игрока не сущеcтвует, проверьте правильность ника \ No newline at end of file +Graphical prisoner management shell=Интерфейс управления заключенными +The player '=Игрока ' +' does not exist, check that the nickname is correct=' не сущеcтвует, проверьте правильность ника \ No newline at end of file -- 2.47.1