local S = minetest.get_translator("getto") getto_list = {"xek130"} getto = {} getto.centrepos = { x = 21888, y = 17, z = 25025 } getto.min_pos_x = 21689 getto.max_pos_x = 22032 getto.min_pos_z = 24725 getto.max_pos_z = 25199 local timer = 0 local timer_alert = 0 local interval_alert = 1 local overall_time_alert = 10 minetest.register_globalstep(function(dtime) if timer > os.time() then return end timer = os.time() + interval_alert for i = 1, #getto_list do local player = minetest.env:get_player_by_name(getto_list[i]) if player then local pos = player:get_pos() if (pos.x > getto.max_pos_x or pos.x < getto.min_pos_x or pos.z > getto.max_pos_z or pos.z < getto.min_pos_z) then msg = minetest.colorize("red", S("Return to the Ghetto territory!") .. S(" Time until return: ") .. overall_time_alert - timer_alert .. " c") minetest.chat_send_player(getto_list[i], msg) timer_alert = timer_alert + interval_alert if timer_alert > overall_time_alert then msg2 = minetest.colorize("red", S("You have been returned to the Ghetto!")) minetest.chat_send_player(getto_list[i], msg2) player:set_pos(getto.centrepos) timer_alert = 0 end else if timer_alert ~= 0 then msg3 = minetest.colorize("green", S("Thank you for coming back)")) minetest.chat_send_player(getto_list[i], msg3) timer_alert = 0 end end end end end)