convert /spawn to 'real' command, must match interact priv

This commit is contained in:
tchncs 2016-06-08 19:19:58 +02:00
parent 69dc14788f
commit f82df4fb45

View File

@ -1,15 +1,16 @@
minetest.register_on_chat_message(function(name, message, playername, player)
local cmd ="/spawn"
if message:sub(0, #cmd) == cmd then
if message == '/spawn' then
command = {}
minetest.register_chatcommand("spawn", {
params = "<player>",
privs = {interact=true},
description = "Teleports you to the Spawnpoint",
func = function(name, param)
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
local cmd ="/away"
minetest.chat_send_player(name, "Teleporting to Spawnpoint...")
end,
})
--[[ local cmd ="/away"
if message:sub(0, #cmd) == cmd then
if message == '/away' then
local player = minetest.env:get_player_by_name(name)
@ -66,8 +67,9 @@ minetest.register_on_respawnplayer(function(player, pos)
return true
end)
--]]
-- Commands, originally by Grailtest @0-afflatus
command = {}
-- Notices