2014-10-28 18:01:32 +01:00
|
|
|
minetest.register_on_chat_message(function(name, message, playername, player)
|
|
|
|
local cmd = "/spawn"
|
|
|
|
if message:sub(0, #cmd) == cmd then
|
|
|
|
if message == '/spawn' then
|
2014-11-08 18:36:57 +01:00
|
|
|
local player = minetest.get_player_by_name(name)
|
2014-10-28 18:01:32 +01:00
|
|
|
if minetest.setting_get_pos("static_spawnpoint") then
|
|
|
|
minetest.chat_send_player(player:get_player_name(), "Teleporting to spawn...")
|
|
|
|
player:setpos(minetest.setting_get_pos("static_spawnpoint"))
|
|
|
|
else
|
|
|
|
minetest.chat_send_player(player:get_player_name(), "ERROR: No spawn point is set on this server!")
|
|
|
|
end
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|