Доработать функцию отправки игрока в тюрьму #1

Merged
Koldun merged 2 commits from Reload/jail:devel into main 2024-10-16 17:00:42 +03:00
2 changed files with 19 additions and 13 deletions
Showing only changes of commit f07ec4feec - Show all commits

View File

@ -36,22 +36,26 @@ jail.set_permissions_for_the_jail = function (player)
end end
jail.add_jail = function(self_player_name, player_name) jail.add_jail = function(self_player_name, player_name)
if (minetest.player_exists(player_name)) then
for i = 1, #prisoners_list do for i = 1, #prisoners_list do
if prisoners_list[i] == player_name then if prisoners_list[i] == player_name then
minetest.chat_send_player(self_player_name, S("The player is already in jail")) minetest.chat_send_player(self_player_name, S("The player is already in jail"))
return return
end end
end end
table.insert(prisoners_list, player_name)
jail.set_permissions_for_the_jail(player_name)
local player = minetest.env:get_player_by_name(player_name) local player = minetest.env:get_player_by_name(player_name)
if (player) then if (player) then
table.insert(prisoners_list, player_name)
player:setpos(jail.jailpos) player:setpos(jail.jailpos)
minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail"))) minetest.chat_send_player(player_name, minetest.colorize("red", S("You have been sent to jail")))
minetest.chat_send_all(minetest.colorize("red", minetest.chat_send_all(minetest.colorize("red",
"" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name)) "" .. player_name .. " " .. S("has been sent to jail by") .. " " .. self_player_name))
jail.set_permissions_for_the_jail(player_name)
else else
minetest.chat_send_player(player_name, minetest.colorize("red", S("Не в сети"))) 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")))
end end
end end

View File

@ -29,3 +29,5 @@ Prisoners=Заключенные
To jail=В тюрьму To jail=В тюрьму
To freedom=На свободу To freedom=На свободу
Graphical prisoner management shell=Графическая оболочка управления заключенными Graphical prisoner management shell=Графическая оболочка управления заключенными
Player sent to jail, but not online=Игрок отправлен в тюрьму, но не в сети
The player does not exist, check that the nickname is correct=Игрока не сущеcтвует, проверьте правильность ника
Koldun marked this conversation as resolved
Review

Здесь с синтаксисом всё в порядке? Знак = не должен быть за кавычками?

Здесь с синтаксисом всё в порядке? Знак `=` не должен быть за кавычками?
Review

всё норм же, не вижу проблем
кавычек нет, есть "апострофы", которые как текстовые символы в данном случае, выделяющие ник в сообщении, стоят где надо

всё норм же, не вижу проблем кавычек нет, есть "апострофы", которые как текстовые символы в данном случае, выделяющие ник в сообщении, стоят где надо