diff --git a/commands.lua b/commands.lua index aaafc32..e7a9734 100644 --- a/commands.lua +++ b/commands.lua @@ -1,15 +1,14 @@ -spawn = {x = -110.0, y = 25.9, z = -202.0} - minetest.register_on_chat_message(function(name, message, playername, player) - local cmd = "/spawn" + local cmd ="/spawn" if message:sub(0, #cmd) == cmd then if message == '/spawn' then - local player = minetest.env:get_player_by_name(name) - minetest.chat_send_player(player:get_player_name(), "Teleporting to spawn...") - player:setpos(spawn) - return true --deds to sfan5 + local player = minetest.env:get_player_by_name(name) + local spawnPoint = minetest.setting_get("static_spawnpoint") + minetest.get_player_by_name(name):setpos(minetest.string_to_pos(spawnPoint)) + minetest.chat_send_player(name, "Teleported to spawn!") + return true end - end + end local cmd ="/away" if message:sub(0, #cmd) == cmd then if message == '/away' then