spawn_command/init.lua

19 lines
588 B
Lua
Raw Normal View History

2014-12-01 11:11:34 -08:00
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,
})