From 1e713fc793b1fe862cbfeb03ddb9cfcfe89e6c6f Mon Sep 17 00:00:00 2001 From: Aleksandr Avdeev Date: Sat, 20 Jan 2024 13:49:02 +0300 Subject: [PATCH] add random summ --- interact/config.lua | 4 ++-- interact/init.lua | 22 +++++++++++++++++++--- interact/locale/interact.ru.tr | 13 ++++++------- interact/rules.lua | 14 ++++++-------- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/interact/config.lua b/interact/config.lua index 546cfa7..9379c65 100644 --- a/interact/config.lua +++ b/interact/config.lua @@ -26,7 +26,7 @@ interact.grief_ban = true --The second screen-- --Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen. -interact.s2_l1 = S("So, do you want interact, or do you just want to look around") +interact.s2_l1 = S("So, do you want privs, or do you just want to look around") interact.s2_l2 = S("the server?") --The buttons. These ones can have a maximum of 26 characters. interact.s2_b1 = S("Yes, I want!") @@ -44,7 +44,7 @@ interact.s3_b1 = S("I agree") interact.s3_b2 = S("I disagree") --The message to send players who disagree when they are kicked for disagring with the rules. -interact.disagree_msg = S("Bye then! You have to agree to the rules to play on the server.") +interact.disagree_msg = S("Bye then! You have to agree to the rules to play on the server and give the right answer.") --Kick, ban or ignore players who disagree with the rules. --Options are "kick" "ban" "nothing" diff --git a/interact/init.lua b/interact/init.lua index 9bfba89..cd18646 100644 --- a/interact/init.lua +++ b/interact/init.lua @@ -8,6 +8,11 @@ local rule2 = 0 local rule3 = 0 local rule4 = 0 local multi = 0 +local a,b + +--local a = function () return math.random(49) end +--local b = function () return math.random(50, 99) end +--local sum = function () return a+b end local function make_formspec(player) local name = player:get_player_name() @@ -33,8 +38,12 @@ end --Форма запроса на interact local function make_formspec3(player) local size = { "size[10,8]" } + -- обновляем слагаемые + a = math.random(50) + b = math.random(50) + local text = tostring(a).."+"..tostring(b).."=?" table.insert(size, "textarea[0.5,0.5;9.5,5.5;TOS;" ..interact.s3_header.. ";" ..interact.rules.. "]") - table.insert(size, "field[0.5,6.4;2,0.5;answer;2+3="..S("answer")..";]") + table.insert(size, "field[0.5,6.4;2,0.5;answer;"..text..";]") table.insert(size, "button[5.5,7.4;2,0.5;decline;" ..interact.s3_b2.. "]") table.insert(size, "button_exit[7.5,7.4;2,0.5;accept;" ..interact.s3_b1.. "]") return table.concat(size) @@ -120,14 +129,21 @@ end) minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= "interact_rules" then return end local name = player:get_player_name() + print("Сумма") + print(tostring(a+b)) if fields.accept then if interact.screen4 == false then - if minetest.check_player_privs(name, interact.priv) and fields.answer == "5" then + if minetest.check_player_privs(name, interact.priv) and fields.answer == tostring(a+b) then minetest.chat_send_player(name, interact.interact_msg1) minetest.chat_send_player(name, interact.interact_msg2) local privs = minetest.get_player_privs(name) privs.interact = true - minetest.set_player_privs(name, privs) + minetest.set_player_privs(name, { + interact = true, + home = true, + spawn = true, + tp = true + }) minetest.log("action", "Granted " ..name.. " interact.") else if interact.disagree_action == "kick" then diff --git a/interact/locale/interact.ru.tr b/interact/locale/interact.ru.tr index dc0db41..bee17bb 100644 --- a/interact/locale/interact.ru.tr +++ b/interact/locale/interact.ru.tr @@ -1,20 +1,19 @@ # textdomain: interact -So, do you want interact, or do you just want to look around=Итак, вы хотите пообщаться или просто хотите осмотреться +So, do you want privs, or do you just want to look around=Итак, вы хотите права или просто хотите осмотреться the server?=на сервере? -Yes, I want!=Да, я хочу! -I just want to look round.=Я просто хочу осмотреться. +Yes, I want!= Хочу права! +I just want to look round.=Пока осмотрюсь Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!=Приятной прогулки! Если вы хотите взаимодействовать в игре, просто введите в чат /rules, и вы сможете повторить процесс снова! -I agree=Я согласен -I disagree=Я не согласен -answer=ответ +I agree=Согласен +I disagree=Не согласен Hello, welcome to this server!=Здравствуйте, добро пожаловать на этот сервер! Could you please tell me if you like to grief or not?=Скажите, пожалуйста, любите ли вы горевать или нет? No, I don't.=Нет, я не знаю. Yes, I do!=Да! Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!=Если вам нравится грифинг, попробуйте одиночную игру, потому что тогда вы уничтожите только свои собственные имущество! Here are the rules:=Вот правила: -Bye then! You have to agree to the rules to play on the server.=Ну тогда пока! Чтобы играть на сервере, вам необходимо согласиться с правилами. +Bye then! You have to agree to the rules to play on the server and give the right answer.=Ну тогда пока! Чтобы играть на сервере, вам необходимо согласиться с правилами и дать правильный ответ решения. Back to rules=Вернуться к правилам Time for a quiz on the rules!=Пришло время викторины по правилам! Have another go.=Попробуйте еще раз. diff --git a/interact/rules.lua b/interact/rules.lua index 46d56bf..926b588 100644 --- a/interact/rules.lua +++ b/interact/rules.lua @@ -1,14 +1,12 @@ +local S = minetest.get_translator("interact") + --The actual rules. interact.rules = [[ -Rules: +Rules(Правила): + +1. No griefing (Никакого грифинга). +2. No hacked clients (Никаких взломанных клиентов). -1. No griefing. -2. No hacked clients. -3. No swearing or insults towards other players. -4. No family roleplay. -5. No dating. -6. Do not ask for more privs, or to be an admin. Also do not ask for items. -7. PVP is not allowed. ]] --The questions on the rules, if the quiz is used.