add random summ

This commit is contained in:
Александр Авдеев 2024-01-20 15:49:02 +05:00 committed by Koldun
parent c6bde2be2a
commit ac5e71ee17
Signed by: Koldun
GPG Key ID: 53DE683337F5D25F
4 changed files with 33 additions and 20 deletions

View File

@ -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"

View File

@ -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

View File

@ -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.=Попробуйте еще раз.

View File

@ -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.