mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Make the interact quizz multi-language
This commit is contained in:
parent
55363559e1
commit
cc8ba514da
@ -1,47 +1,93 @@
|
||||
interact = {}
|
||||
|
||||
--Which screens to show.
|
||||
interact.screen1 = true --The welcome a first question screen.
|
||||
interact.screen2 = true --The visit or interact screen.
|
||||
interact.screen4 = true --The quiz screen.
|
||||
-- Which screens to show and in which order.
|
||||
interact.form_order = {
|
||||
"languageselect",
|
||||
"welcome",
|
||||
"visit",
|
||||
"rules",
|
||||
"quiz"
|
||||
}
|
||||
|
||||
--The first screen--
|
||||
--The text at the top.
|
||||
interact.s1_header = "Hello, welcome to this server!"
|
||||
interact.s1_header = {
|
||||
en = "Hello, welcome to this server!",
|
||||
fr = "Bonjour et bienvenue sur ce serveur!"
|
||||
}
|
||||
--Lines one and two. Make sure each line is less than 70 characters, or they will run off the screen.
|
||||
interact.s1_l2 = "Could you please tell me if you like to grief or not?"
|
||||
interact.s1_l3 = ""
|
||||
interact.s1_l2 = {
|
||||
en = "Could you please tell me if you like to grief or not?",
|
||||
fr = "Aimez-vous détruire les choses des autres?"
|
||||
}
|
||||
interact.s1_l3 = {en="",fr=""}
|
||||
--The buttons. Each can have 15 characters, max.
|
||||
interact.s1_b1 = "No, I don't."
|
||||
interact.s1_b2 = "Yes, I do!"
|
||||
interact.s1_b1 = {
|
||||
en = "No, I don't.",
|
||||
fr = "Non."
|
||||
}
|
||||
interact.s1_b2 = {
|
||||
en = "Yes, I do!",
|
||||
fr = "Oui!"
|
||||
}
|
||||
|
||||
--The message to send kicked griefers.
|
||||
interact.msg_grief = "Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!"
|
||||
interact.msg_grief = {
|
||||
en = "Try out singleplayer if you like griefing, because then you'll only destroy your own stuff!",
|
||||
fr = "Essayez le mode solo si vous aimez détruire des choses, car vous ne détruirez que les votres!"
|
||||
}
|
||||
|
||||
--Ban or kick griefers? Default is kick, set to true for ban.
|
||||
interact.grief_ban = false
|
||||
|
||||
--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 = "So, do you want interact, or do you just want to look around"
|
||||
interact.s2_l2 = "the server?"
|
||||
interact.s2_l1 = {
|
||||
en = "So, do you want interact, or do you just want to look around",
|
||||
fr = "Donc, voulez-vous interagir ou juste regarder"
|
||||
}
|
||||
interact.s2_l2 = {
|
||||
en = "the server?",
|
||||
fr = "le serveur?"
|
||||
}
|
||||
--The buttons. These ones can have a maximum of 26 characters.
|
||||
interact.s2_b1 = "Yes, I want interact!"
|
||||
interact.s2_b2 = "I just want to look round."
|
||||
interact.s2_b1 = {
|
||||
en = "Yes, I want interact!",
|
||||
fr = "Oui, je veux interagir!"
|
||||
}
|
||||
interact.s2_b2 = {
|
||||
en = "I just want to look round.",
|
||||
fr = "Je veux juste regarder."
|
||||
}
|
||||
|
||||
--The message the player is sent if s/he is just visiting.
|
||||
interact.visit_msg = "Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!"
|
||||
interact.visit_msg = {
|
||||
en = "Have a nice time looking round! If you want interact just type /rules, and you can go through the process again!",
|
||||
fr = "Bonne contemplation! Si vous voulez interagir, tapez la commande /rules, et vous pourrez recommencer le processus!"
|
||||
}
|
||||
|
||||
--The third screen--
|
||||
--The header for the rules box, this can have 60 characters, max.
|
||||
interact.s3_header = "Here are the rules:"
|
||||
interact.s3_header = {
|
||||
en = "Here are the rules:",
|
||||
fr = "Voici les règles:"
|
||||
}
|
||||
|
||||
--The buttons. Each can have 15 characters, max.
|
||||
interact.s3_b1 = "I agree"
|
||||
interact.s3_b2 = "I disagree"
|
||||
interact.s3_b1 = {
|
||||
en = "I agree",
|
||||
fr = "Accepter"
|
||||
}
|
||||
interact.s3_b2 = {
|
||||
en = "I disagree",
|
||||
fr = "Refuser"
|
||||
}
|
||||
|
||||
--The message to send players who disagree when they are kicked for disagring with the rules.
|
||||
interact.disagree_msg = "Bye then! You have to agree to the rules to play on the server."
|
||||
interact.disagree_msg = {
|
||||
en = "Bye then! You have to agree to the rules to play on the server.",
|
||||
fr = "Au revoir! Vous devez accepter les règles pour jouer sur le serveur."
|
||||
}
|
||||
|
||||
--Kick or ban players who disagree with the rules. False will just kick.
|
||||
interact.disagree_ban = false
|
||||
@ -50,39 +96,66 @@ interact.disagree_ban = false
|
||||
--Should there be a back to rules button?
|
||||
interact.s4_to_rules_button = true
|
||||
--The back to rules button. 13 characters, max.
|
||||
interact.s4_to_rules = "Back to rules"
|
||||
interact.s4_to_rules = {
|
||||
en = "Back to rules",
|
||||
fr = "<-- Règles"
|
||||
}
|
||||
|
||||
--The header for screen 4. 60 characters max, although this is a bit of a squash. I recomend 55 as a max.
|
||||
interact.s4_header = "Time for a quiz on the rules!"
|
||||
interact.s4_header = {
|
||||
en = "Time for a quiz on the rules!",
|
||||
fr = "Quizz sur les règles!"
|
||||
}
|
||||
|
||||
--Since the questions are intrinsically connected with the rules, they are to be found in rules.lua
|
||||
--The trues are limited to 24 characters. The falses can have 36 characters.
|
||||
interact.s4_question1_true = "Yes."
|
||||
interact.s4_question1_false = "No."
|
||||
interact.s4_question2_true = "Yes."
|
||||
interact.s4_question2_false = "No."
|
||||
interact.s4_question3_true = "Yes."
|
||||
interact.s4_question3_false = "No."
|
||||
interact.s4_question4_true = "Yes."
|
||||
interact.s4_question4_false = "No."
|
||||
interact.s4_question1_true = {en="Yes.",fr="Oui."}
|
||||
interact.s4_question1_false = {en="No.",fr="Non."}
|
||||
interact.s4_question2_true = {en="Yes.",fr="Oui."}
|
||||
interact.s4_question2_false = {en="No.",fr="Non."}
|
||||
interact.s4_question3_true = {en="Yes.",fr="Oui."}
|
||||
interact.s4_question3_false = {en="No.",fr="Non."}
|
||||
interact.s4_question4_true = {en="Yes.",fr="Oui."}
|
||||
interact.s4_question4_false = {en="No.",fr="Non."}
|
||||
|
||||
interact.s4_submit = "Submit!"
|
||||
interact.s4_submit = {
|
||||
en = "Submit!",
|
||||
fr = "Envoyer!"
|
||||
}
|
||||
|
||||
--What to do on a wrong quiz.
|
||||
--Options are "kick" "ban" "reshow" "rules" and "nothing"
|
||||
interact.on_wrong_quiz = "nothing"
|
||||
--Options are "kick" "ban", "" (nothing) or another form name (e.g. "rules", or "quiz" to re-show)
|
||||
interact.on_wrong_quiz = ""
|
||||
--The message to send the player if reshow is the on_wrong_quiz option.
|
||||
interact.quiz_try_again_msg = "Have another go."
|
||||
interact.quiz_try_again_msg = {
|
||||
en = "Have another go.",
|
||||
fr = "Réessayez."
|
||||
}
|
||||
--The message sent to the player if rules is the on_wrong_quiz option.
|
||||
interact.quiz_rules_msg = "Have another look at the rules:"
|
||||
interact.quiz_rules_msg = {
|
||||
en = "Have another look at the rules:",
|
||||
fr = "Re-regardez les règles:"
|
||||
}
|
||||
--The kick reason if kick is the on_wrong_quiz option.
|
||||
interact.wrong_quiz_kick_msg = "Pay more attention next time!"
|
||||
interact.wrong_quiz_kick_msg = {
|
||||
en = "Pay more attention next time!",
|
||||
fr = "Lisez mieux la prochaine fois!"
|
||||
}
|
||||
--The message sent to the player if nothing is the on_wrong_quiz option.
|
||||
interact.quiz_fail_msg = "You got that wrong."
|
||||
interact.quiz_fail_msg = {
|
||||
en = "You got that wrong.",
|
||||
fr = "Vous avez raté le quiz."
|
||||
}
|
||||
|
||||
--The messages send to the player after interact is granted.
|
||||
interact.interact_msg1 = "Thanks for accepting the rules, you now are able to interact with things."
|
||||
interact.interact_msg2 = "Happy building!"
|
||||
interact.interact_msg1 = {
|
||||
en = "Thanks for accepting the rules, you now are able to interact with things.",
|
||||
fr = "Merci d'avoir accepté les règles, vous pouvez désormais interagir avec les choses."
|
||||
}
|
||||
interact.interact_msg2 = {
|
||||
en = "Happy building!",
|
||||
fr = "Amusez-vous bien!"
|
||||
}
|
||||
|
||||
--The priv required to use the /rules command. If fast is a default priv, I recomend replacing shout with that.
|
||||
interact.priv = {}
|
||||
|
@ -7,83 +7,154 @@ local rule3 = 0
|
||||
local rule4 = 0
|
||||
local multi = 0
|
||||
|
||||
local function make_formspec(player)
|
||||
local name = player:get_player_name()
|
||||
local size = { "size[10,4]" }
|
||||
table.insert(size, "background[0,0;10,4;background.jpg]")
|
||||
table.insert(size, "label[0.5,0.5;" ..interact.s1_header.. "]")
|
||||
table.insert(size, "label[0.5,1.5;" ..interact.s1_l2.. "]")
|
||||
table.insert(size, "label[0.5,2;" ..interact.s1_l3.. "]")
|
||||
table.insert(size, "button_exit[5.5,3.4;2,0.5;no;" ..interact.s1_b1.. "]")
|
||||
table.insert(size, "button[7.5,3.4;2,0.5;yes;" ..interact.s1_b2.. "]")
|
||||
return table.concat(size)
|
||||
function table.length(T)
|
||||
local count = 0
|
||||
for _ in pairs(T) do count = count + 1 end
|
||||
return count
|
||||
end
|
||||
|
||||
local function make_formspec2(player)
|
||||
local name = player:get_player_name()
|
||||
local size = { "size[10,4]" }
|
||||
table.insert(size, "background[0,0;10,4;background.jpg]")
|
||||
table.insert(size, "label[0.5,0.5;" ..interact.s2_l1.. "]")
|
||||
table.insert(size, "label[0.5,1;" ..interact.s2_l2.. "]")
|
||||
table.insert(size, "button_exit[2.5,3.4;3.5,0.5;interact;" ..interact.s2_b1.. "]")
|
||||
table.insert(size, "button_exit[6.4,3.4;3.6,0.5;visit;" ..interact.s2_b2.. "]")
|
||||
return table.concat(size)
|
||||
end
|
||||
|
||||
local function make_formspec3(player)
|
||||
local size = { "size[10,8]" }
|
||||
table.insert(size, "background[0,0;10,8;background.jpg]")
|
||||
table.insert(size, "textarea[0.5,0.5;9.5,7.5;TOS;" ..interact.s3_header.. ";" ..interact.rules.. "]")
|
||||
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)
|
||||
end
|
||||
|
||||
local function make_formspec4(player)
|
||||
local name = player:get_player_name()
|
||||
local size = { "size[10,9]" }
|
||||
if interact.s4_to_rules_button == true then
|
||||
table.insert(size, "button_exit[7.75,0.25;2.1,0.1;rules;" ..interact.s4_to_rules.. "]")
|
||||
interact.player_languages = {}
|
||||
function interact.get_player_language(plr)
|
||||
if type(plr) == "string" then
|
||||
return interact.player_languages[plr]
|
||||
end
|
||||
table.insert(size, "label[0.25,0;" ..interact.s4_header.."]")
|
||||
table.insert(size, "label[0.5,0.5;" ..interact.s4_question1.."]")
|
||||
table.insert(size, "checkbox[0.25,1;rule1_true;" ..interact.s4_question1_true.."]")
|
||||
table.insert(size, "checkbox[4,1;rule1_false;" ..interact.s4_question1_false.. "]")
|
||||
table.insert(size, "label[0.5,2;" ..interact.s4_question2.. "]")
|
||||
table.insert(size, "checkbox[0.25,2.5;rule2_true;" ..interact.s4_question2_true.. "]")
|
||||
table.insert(size, "checkbox[4,2.5;rule2_false;" ..interact.s4_question2_false.. "]")
|
||||
table.insert(size, "label[0.5,3.5;" ..interact.s4_question3.. "]")
|
||||
table.insert(size, "checkbox[0.25,4;rule3_true;" ..interact.s4_question3_true.. "]")
|
||||
table.insert(size, "checkbox[4,4;rule3_false;" ..interact.s4_question3_false.. "]")
|
||||
table.insert(size, "label[0.5,5;" ..interact.s4_question4.. "]")
|
||||
table.insert(size, "checkbox[0.25,5.5;rule4_true;" ..interact.s4_question4_true.. "]")
|
||||
table.insert(size, "checkbox[4,5.5;rule4_false;" ..interact.s4_question4_false.."]")
|
||||
table.insert(size, "label[0.5,6.5;" ..interact.s4_multi_question.. "]")
|
||||
table.insert(size, "checkbox[4.75,6.25;multi_choice1;" ..interact.s4_multi1.. "]")
|
||||
table.insert(size, "checkbox[0.25,7;multi_choice2;" ..interact.s4_multi2.. "]")
|
||||
table.insert(size, "checkbox[4.75,7;multi_choice3;" ..interact.s4_multi3.."]")
|
||||
table.insert(size, "background[0,0;10,9;background.jpg]")
|
||||
table.insert(size, "button_exit[3,8.4;3.5,0.5;submit;" ..interact.s4_submit.."]")
|
||||
return table.concat(size)
|
||||
return interact.player_languages[plr:get_player_name()]
|
||||
end
|
||||
|
||||
interact.forms = {
|
||||
languageselect = function(player)
|
||||
local fs_width = 10
|
||||
local fs_button_margin = 1
|
||||
local fs = { "size["..tostring(fs_width)..",4]" }
|
||||
table.insert(fs, "background[0,0;10,4;background.jpg]")
|
||||
local i = 0
|
||||
local fs_button_width = (fs_width-fs_button_margin*2)/table.length(interact.languages)
|
||||
for lang, lname in pairs(interact.languages) do
|
||||
table.insert(fs, "button["..tostring(fs_button_margin+i*fs_button_width)..",2;"..tostring(fs_button_width)..",0.5;"..lang..";"..lname.."]")
|
||||
i = i+1
|
||||
end
|
||||
return table.concat(fs)
|
||||
end,
|
||||
|
||||
welcome = function(player)
|
||||
local lang = interact.get_player_language(player)
|
||||
local size = { "size[10,4]" }
|
||||
table.insert(size, "background[0,0;10,4;background.jpg]")
|
||||
table.insert(size, "label[0.5,0.5;" ..interact.s1_header[lang].. "]")
|
||||
table.insert(size, "label[0.5,1.5;" ..interact.s1_l2[lang].. "]")
|
||||
table.insert(size, "label[0.5,2;" ..interact.s1_l3[lang].. "]")
|
||||
table.insert(size, "button_exit[5.5,3.4;2,0.5;no;" ..interact.s1_b1[lang].. "]")
|
||||
table.insert(size, "button[7.5,3.4;2,0.5;yes;" ..interact.s1_b2[lang].. "]")
|
||||
return table.concat(size)
|
||||
end,
|
||||
|
||||
visit = function(player)
|
||||
local lang = interact.get_player_language(player)
|
||||
local size = { "size[10,4]" }
|
||||
table.insert(size, "background[0,0;10,4;background.jpg]")
|
||||
table.insert(size, "label[0.5,0.5;" ..interact.s2_l1[lang].. "]")
|
||||
table.insert(size, "label[0.5,1;" ..interact.s2_l2[lang].. "]")
|
||||
table.insert(size, "button_exit[2.5,3.4;3.5,0.5;interact;" ..interact.s2_b1[lang].. "]")
|
||||
table.insert(size, "button_exit[6.4,3.4;3.6,0.5;visit;" ..interact.s2_b2[lang].. "]")
|
||||
return table.concat(size)
|
||||
end,
|
||||
|
||||
rules = function(player)
|
||||
local lang = interact.get_player_language(player)
|
||||
local size = { "size[10,8]" }
|
||||
table.insert(size, "background[0,0;10,8;background.jpg]")
|
||||
table.insert(size, "textarea[0.5,0.5;9.5,7.5;TOS;" ..interact.s3_header[lang].. ";" ..interact.rules[lang].. "]")
|
||||
table.insert(size, "button[5.5,7.4;2,0.5;decline;" ..interact.s3_b2[lang].. "]")
|
||||
table.insert(size, "button_exit[7.5,7.4;2,0.5;accept;" ..interact.s3_b1[lang].. "]")
|
||||
return table.concat(size)
|
||||
end,
|
||||
|
||||
quiz = function(player)
|
||||
local lang = interact.get_player_language(player)
|
||||
local size = { "size[10,9]" }
|
||||
if interact.s4_to_rules_button == true then
|
||||
table.insert(size, "button_exit[7.75,0.25;2.1,0.1;rules;" ..interact.s4_to_rules[lang].. "]")
|
||||
end
|
||||
table.insert(size, "label[0.25,0;" ..interact.s4_header[lang].."]")
|
||||
table.insert(size, "label[0.5,0.5;" ..interact.s4_question1[lang].."]")
|
||||
table.insert(size, "checkbox[0.25,1;rule1_true;" ..interact.s4_question1_true[lang].."]")
|
||||
table.insert(size, "checkbox[4,1;rule1_false;" ..interact.s4_question1_false[lang].. "]")
|
||||
table.insert(size, "label[0.5,2;" ..interact.s4_question2[lang].. "]")
|
||||
table.insert(size, "checkbox[0.25,2.5;rule2_true;" ..interact.s4_question2_true[lang].. "]")
|
||||
table.insert(size, "checkbox[4,2.5;rule2_false;" ..interact.s4_question2_false[lang].. "]")
|
||||
table.insert(size, "label[0.5,3.5;" ..interact.s4_question3[lang].. "]")
|
||||
table.insert(size, "checkbox[0.25,4;rule3_true;" ..interact.s4_question3_true[lang].. "]")
|
||||
table.insert(size, "checkbox[4,4;rule3_false;" ..interact.s4_question3_false[lang].. "]")
|
||||
table.insert(size, "label[0.5,5;" ..interact.s4_question4[lang].. "]")
|
||||
table.insert(size, "checkbox[0.25,5.5;rule4_true;" ..interact.s4_question4_true[lang].. "]")
|
||||
table.insert(size, "checkbox[4,5.5;rule4_false;" ..interact.s4_question4_false[lang].."]")
|
||||
table.insert(size, "label[0.5,6.5;" ..interact.s4_multi_question[lang].. "]")
|
||||
table.insert(size, "checkbox[4.75,6.25;multi_choice1;" ..interact.s4_multi1[lang].. "]")
|
||||
table.insert(size, "checkbox[0.25,7;multi_choice2;" ..interact.s4_multi2[lang].. "]")
|
||||
table.insert(size, "checkbox[4.75,7;multi_choice3;" ..interact.s4_multi3[lang].."]")
|
||||
table.insert(size, "background[0,0;10,9;background.jpg]")
|
||||
table.insert(size, "button_exit[3,8.4;3.5,0.5;submit;" ..interact.s4_submit[lang].."]")
|
||||
return table.concat(size)
|
||||
end
|
||||
}
|
||||
|
||||
function interact.show_form(player, form, delay)
|
||||
if delay == nil then delay = 1 end
|
||||
minetest.after(delay, function()
|
||||
minetest.show_formspec(player:get_player_name(), form, interact.forms[form](player))
|
||||
end)
|
||||
end
|
||||
|
||||
function interact.show_next_form(player, current)
|
||||
local is_next = false
|
||||
for i, formspec in ipairs(interact.form_order) do
|
||||
if is_next then
|
||||
return interact.show_form(player, formspec, 0)
|
||||
end
|
||||
if formspec == current then
|
||||
is_next = true
|
||||
end
|
||||
end
|
||||
-- At the end? Everyting passed correctly, give permissions
|
||||
interact.grant_interact(player)
|
||||
end
|
||||
|
||||
function interact.grant_interact(player)
|
||||
local lang = interact.get_player_language(player)
|
||||
local name = player:get_player_name()
|
||||
if minetest.check_player_privs(name, interact.priv) then
|
||||
minetest.chat_send_player(name, interact.interact_msg1[lang])
|
||||
minetest.chat_send_player(name, interact.interact_msg2[lang])
|
||||
local privs = minetest.get_player_privs(name)
|
||||
privs.interact = true
|
||||
minetest.set_player_privs(name, privs)
|
||||
minetest.log("action", "Granted " ..name.. " interact.")
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "languageselect" then return end
|
||||
local plrlang = "en"
|
||||
for lang, _ in pairs(interact.languages) do
|
||||
if fields[lang] then
|
||||
plrlang = lang
|
||||
end
|
||||
end
|
||||
interact.player_languages[player:get_player_name()] = plrlang
|
||||
|
||||
interact.show_next_form(player, formname)
|
||||
end)
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "welcome" then return end
|
||||
local name = player:get_player_name()
|
||||
if fields.no then
|
||||
if interact.screen2 == false then
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "rules", make_formspec3(player))
|
||||
end)
|
||||
else
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "visit", make_formspec2(player))
|
||||
end)
|
||||
end
|
||||
interact.show_next_form(player, formname)
|
||||
return
|
||||
elseif fields.yes then
|
||||
if interact.grief_ban ~= true then
|
||||
minetest.kick_player(name, interact.msg_grief)
|
||||
local lang = interact.get_player_language(player)
|
||||
minetest.kick_player(name, interact.msg_grief[lang])
|
||||
else
|
||||
minetest.ban_player(name)
|
||||
end
|
||||
@ -95,12 +166,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "visit" then return end
|
||||
local name = player:get_player_name()
|
||||
if fields.interact then
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "rules", make_formspec3(player))
|
||||
end)
|
||||
interact.show_next_form(player, formname)
|
||||
return
|
||||
elseif fields.visit then
|
||||
minetest.chat_send_player(name, interact.visit_msg)
|
||||
local lang = interact.get_player_language(player)
|
||||
minetest.chat_send_player(name, interact.visit_msg[lang])
|
||||
minetest.log("action", name.. " is just visiting.")
|
||||
return
|
||||
end
|
||||
@ -111,24 +181,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "rules" then return end
|
||||
local name = player:get_player_name()
|
||||
if fields.accept then
|
||||
if interact.screen4 == false then
|
||||
if minetest.check_player_privs(name, interact.priv) 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.log("action", "Granted " ..name.. " interact.")
|
||||
end
|
||||
else
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "quiz", make_formspec4(player))
|
||||
end)
|
||||
end
|
||||
interact.show_next_form(player, formname)
|
||||
return
|
||||
elseif fields.decline then
|
||||
if interact.disagree_ban ~= true then
|
||||
minetest.kick_player(name, interact.disagree_msg)
|
||||
local lang = interact.get_player_language(player)
|
||||
minetest.kick_player(name, interact.disagree_msg[lang])
|
||||
else
|
||||
minetest.ban_player(name)
|
||||
end
|
||||
@ -140,9 +198,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname ~= "quiz" then return end
|
||||
local name = player:get_player_name()
|
||||
if fields.rules then
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "rules", make_formspec3(player))
|
||||
end)
|
||||
interact.show_form(player, "rules", 0)
|
||||
return
|
||||
end
|
||||
if fields.rule1_true then rule1 = true
|
||||
@ -163,36 +219,28 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
rule3 = 0
|
||||
rule4 = 0
|
||||
multi = 0
|
||||
if minetest.check_player_privs(name, interact.priv) 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.log("action", "Granted " ..name.. " interact.")
|
||||
end
|
||||
interact.show_next_form(player, formname)
|
||||
elseif fields.submit then
|
||||
rule1 = 0
|
||||
rule2 = 0
|
||||
rule3 = 0
|
||||
rule4 = 0
|
||||
multi = 0
|
||||
local lang = interact.get_player_language(player)
|
||||
if interact.on_wrong_quiz == "kick" then
|
||||
minetest.kick_player(name, interact.wrong_quiz_kick_msg)
|
||||
minetest.kick_player(name, interact.wrong_quiz_kick_msg[lang])
|
||||
elseif interact.on_wrong_quiz == "ban" then
|
||||
minetest.ban_player(name)
|
||||
elseif interact.on_wrong_quiz == "reshow" then
|
||||
minetest.chat_send_player(name, interact.quiz_try_again_msg)
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "quiz", make_formspec4(player))
|
||||
end)
|
||||
elseif interact.on_wrong_quiz == "rules" then
|
||||
minetest.chat_send_player(name, interact.quiz_rules_msg)
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "rules", make_formspec3(player))
|
||||
end)
|
||||
elseif interact.on_wrong_quiz == "" then
|
||||
minetest.chat_send_player(name, interact.quiz_fail_msg[lang])
|
||||
else
|
||||
minetest.chat_send_player(name, interact.quiz_fail_msg)
|
||||
if interact.on_wrong_quiz == formname then
|
||||
minetest.chat_send_player(name, interact.quiz_try_again_msg[lang])
|
||||
end
|
||||
if interact.on_wrong_quiz == "rules" then
|
||||
minetest.chat_send_player(name, interact.quiz_rules_msg[lang])
|
||||
end
|
||||
interact.show_form(interact.on_wrong_quiz)
|
||||
end
|
||||
end
|
||||
end)
|
||||
@ -204,19 +252,7 @@ minetest.register_chatcommand("rules",{
|
||||
func = function (name,params)
|
||||
local player = minetest.get_player_by_name(name)
|
||||
if not interact.blacklist[name] then
|
||||
if interact.screen1 ~= false then
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "welcome", make_formspec(player))
|
||||
end)
|
||||
elseif interact.screen2 ~= false then
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "visit", make_formspec2(player))
|
||||
end)
|
||||
else
|
||||
minetest.after(1, function()
|
||||
minetest.show_formspec(name, "rules", make_formspec3(player))
|
||||
end)
|
||||
end
|
||||
interact.show_form(player, interact.form_order[1])
|
||||
else
|
||||
minetest.log("action", "[interact] Blacklisted player " .. name .. " tried to get back " ..
|
||||
"his revoked privilege")
|
||||
@ -232,13 +268,7 @@ function start_formspecs(player)
|
||||
local name = player:get_player_name()
|
||||
if not minetest.get_player_privs(name).interact then
|
||||
if not interact.blacklist[name] then
|
||||
if interact.screen1 ~= false then
|
||||
minetest.show_formspec(name, "welcome", make_formspec(player))
|
||||
elseif interact.screen2 ~= false then
|
||||
minetest.show_formspec(name, "visit", make_formspec2(player))
|
||||
else
|
||||
minetest.show_formspec(name, "rules", make_formspec3(player))
|
||||
end
|
||||
interact.show_form(player, interact.form_order[1])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,31 +1,67 @@
|
||||
interact.languages = {
|
||||
en = "English",
|
||||
fr = "Français"
|
||||
}
|
||||
--The actual rules.
|
||||
interact.rules = [[
|
||||
Voici les regles :
|
||||
interact.rules = {
|
||||
en = [[1) No intentional try to disturb the server's stability will be tolerated. (lag, crash, bug exploit, ...)
|
||||
2) Cheating (hack, modified client, ...) is forbidden on this server. Be fair-play and learn to play according to the rules.
|
||||
3) On the server, PVP is authorized and theft/grief as well, to the exception of public buildings. (remember to use the areas mod to protect your buildings)
|
||||
4) Please do not spam or flood.
|
||||
5) Each player is responsible of his/her own account, we can't be held liable for any illegitimate use of it.
|
||||
6) Try to avoid 1x1 towers and overall destroying the environment, anywhere that is. This way the server will stay as beautiful, wild and natural as possible.
|
||||
7) Do not ask to be a member of the server staff.
|
||||
8) Swearing, racism, hate speech and the like is strictly prohibited.
|
||||
|
||||
1) Aucune atteinte intentionnelle au bon fonctionnement du serveur ne sera admise. (lag, crash, exploit de bug, etc...)
|
||||
2) La triche (hack, client modifie, etc...) n'est pas toleree sur le serveur. Soyez fair-play et apprenez a jouer selon les regles.
|
||||
3) Sur le serveur, le PVP est autorise, le vole/grief est aussi autorise, le grief n'est pas autorise sur les constructions publics. (pensez au mod areas pour proteger vos biens)
|
||||
4) Merci de ne pas spammer ou flooder.
|
||||
5) Chaque joueur a l'entiere responsabilite de son compte, nous ne sommes en aucun cas responsable d'une utilisation frauduleuse de votre compte dans le jeu.
|
||||
6) Si possible, evitez les constructions de tours en 1x1 mais aussi, de poser des blocs gachant le decor, n'importe ou. Ceci pour que le serveur reste le plus beau, sauvage et naturel possible.
|
||||
7) Ne demandez pas a etre membre de l'equipe du serveur.
|
||||
8) Aucune forme d'insulte ou de racisme n'est admise.
|
||||
Click on the "I accept" button to get the permission to build and interact with the server.]],
|
||||
fr = [[1) Aucune atteinte intentionnelle au bon fonctionnement du serveur ne sera admise. (lag, crash, exploit de bug, etc...)
|
||||
2) La triche (hack, client modifie, etc...) n'est pas toleree sur le serveur. Soyez fair-play et apprenez a jouer selon les regles.
|
||||
3) Sur le serveur, le PVP est autorise, le vole/grief est aussi autorise, le grief n'est pas autorise sur les constructions publics. (pensez au mod areas pour proteger vos biens)
|
||||
4) Merci de ne pas spammer ou flooder.
|
||||
5) Chaque joueur a l'entiere responsabilite de son compte, nous ne sommes en aucun cas responsable d'une utilisation frauduleuse de votre compte dans le jeu.
|
||||
6) Si possible, evitez les constructions de tours en 1x1 mais aussi, de poser des blocs gachant le decor, n'importe ou. Ceci pour que le serveur reste le plus beau, sauvage et naturel possible.
|
||||
7) Ne demandez pas a etre membre de l'equipe du serveur.
|
||||
8) Aucune forme d'insulte ou de racisme n'est admise.
|
||||
|
||||
Cliquez sur le bouton "Accepter" pour pouvoir construire et interagir sur le serveur.
|
||||
]]
|
||||
Cliquez sur le bouton "Accepter" pour pouvoir construire et interagir sur le serveur.]]
|
||||
}
|
||||
|
||||
--The questions on the rules, if the quiz is used.
|
||||
--The checkboxes for the first 4 questions are in config.lua
|
||||
interact.s4_question1 = "Puis-je utiliser un bug pour faire crasher le serveur afin qu'il redémarre?"
|
||||
interact.s4_question2 = "Puis-je demander à faire partie de l'équipe d'administration?"
|
||||
interact.s4_question3 = "Ai-je le droit de grieffer une zone non-protégée?"
|
||||
interact.s4_question4 = "Puis-je joindre librement l'IRC?"
|
||||
interact.s4_multi_question = "Which of these is a rule?"
|
||||
interact.s4_question1 = {
|
||||
en = "Can I use a bug to crash the server so it restarts?",
|
||||
fr = "Puis-je utiliser un bug pour faire crasher le serveur afin qu'il redémarre?"
|
||||
}
|
||||
interact.s4_question2 = {
|
||||
en = "Can I ask to be a member of the staff?",
|
||||
fr = "Puis-je demander à faire partie de l'équipe d'administration?"
|
||||
}
|
||||
interact.s4_question3 = {
|
||||
en = "Am I alllowed to grief a non-protected zone?",
|
||||
fr = "Ai-je le droit de grieffer une zone non-protégée?"
|
||||
}
|
||||
interact.s4_question4 = {
|
||||
en = "Can I freely join the IRC channel?",
|
||||
fr = "Puis-je joindre librement l'IRC?"
|
||||
}
|
||||
interact.s4_multi_question = {
|
||||
en = "Which of these is a rule?",
|
||||
fr = "Laquelle des affirmations est une règle?"
|
||||
}
|
||||
|
||||
--The answers to the multiple choice questions. Only one of these should be true.
|
||||
interact.s4_multi1 = "Pas de grieff"
|
||||
interact.s4_multi2 = "Pas de PvP"
|
||||
interact.s4_multi3 = "Vole d'objets autorisé"
|
||||
interact.s4_multi1 = {
|
||||
en = "No griefing",
|
||||
fr = "Pas de grief"
|
||||
}
|
||||
interact.s4_multi2 = {
|
||||
en = "No PvP",
|
||||
fr = "Pas de PvP"
|
||||
}
|
||||
interact.s4_multi3 = {
|
||||
en = "Object thief allowed",
|
||||
fr = "Vol d'objets autorisé"
|
||||
}
|
||||
|
||||
--Which answer is needed for the quiz questions. interact.quiz1-4 takes true or false.
|
||||
--True is left, false is right.
|
||||
|
Loading…
Reference in New Issue
Block a user