Create init.lua
parent
7d60850633
commit
16729ec67b
|
@ -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,
|
||||||
|
})
|
Loading…
Reference in New Issue