-- This Source Code Form is subject to the terms of the Mozilla Public -- License, v. 2.0. If a copy of the MPL was not distributed with this -- file, You can obtain one at http://mozilla.org/MPL/2.0/. minetest.register_on_joinplayer(function(ObjectRef, last_login) local name = ObjectRef:get_player_name() local meta = ObjectRef:get_meta() if meta:get_int("age_verified") == 0 then minetest.show_formspec(name, "age_verify", "formspec_version[6]" .. "size[10.5,11]" .. "image[1.4,0.2;7.6,7.6;warning_sign.png]" .. "label[1.5,8.5;Please input your age.]" .. "field[1.5,9.3;3,0.8;age;Age;]" .. "button_exit[6,9.3;3,0.8;conf;Confirm]") minetest.sound_play("aom", { to_player = name, gain = 1.0, -- default fade = 0.0, -- default, change to a value > 0 to fade the sound in pitch = 1.0, -- default }, true) end end) minetest.register_on_player_receive_fields(function(player, formname, fields) local name = player:get_player_name() if formname == "age_verify" then if fields.quit then local age = tonumber(fields.age) if age == nil then minetest.kick_player(name, "age invalid or missing") return end if age < 18 then minetest.kick_player(name, "Sorry, you are too young to play on this server.") minetest.log("player "..name.." is too young.") elseif age > 100 then minetest.kick_player(name, "Lying about the age is childish. Sorry, you are too young to play on this server.") minetest.log("player "..name.." is too old.") else minetest.log("player "..name.." verified age.") local meta = player:get_meta() meta:set_int("age_verified",1) end end end end)