From 16729ec67bfd130a375520b245324738b55354f3 Mon Sep 17 00:00:00 2001 From: AndrejIT Date: Mon, 1 Dec 2014 21:11:34 +0200 Subject: [PATCH] Create init.lua --- init.lua | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 init.lua diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..5f5b371 --- /dev/null +++ b/init.lua @@ -0,0 +1,18 @@ + +minetest.register_chatcommand("spawn", { + description = "Teleport you to spawn point at (0,3,0)", + func = function(name) + local player = minetest.env:get_player_by_name(name) + if player == nil then + -- just a check to prevent the server crashing + return false + end + local pos = player:getpos() + if pos.x>-20 and pos.x<20 and pos.y>-20 and pos.z>-20 and pos.z<20 then + + else + player:setpos({x=0, y=3, z=0}) + minetest.chat_send_player(name, "Teleported to spawn!") + end + end, +})