illuna/commands.lua
2016-06-05 19:01:58 +02:00

69 lines
2.7 KiB
Lua

spawn = {x = -110.0, y = 25.9, z = -202.0}
minetest.register_on_chat_message(function(name, message, playername, player)
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
end
end
local cmd ="/away"
if message:sub(0, #cmd) == cmd then
if message == '/away' then
local player = minetest.env:get_player_by_name(name)
minetest.chat_send_all(name.." is now away from keyboard!")
irc:say(string.format('*** %s is now away from keyboard.', player:get_player_name()))
return true --deds to sfan5
end
end
local cmd ="/re"
if message:sub(0, #cmd) == cmd then
if message == '/re' then
local player = minetest.env:get_player_by_name(name)
minetest.chat_send_all(name.." is no longer away from keyboard!")
irc:say(string.format('*** %s is no longer away from keyboard.', player:get_player_name()))
return true
end
end
local cmd ="/hacmd"
if message:sub(0, #cmd) == cmd then
if message == '/hacmd' then
--local player = minetest.env:get_player_by_name(name)
minetest.chat_send_all("additional Commands")
minetest.chat_send_all("===================")
minetest.chat_send_all("use /away for afk note from server.")
minetest.chat_send_all("use /re for no-longer-afk note from server.")
minetest.chat_send_all("use /spawn to teleporting you to the spawnpoint.")
minetest.chat_send_all("use /helpcmdplus to show this helpmessage.")
return true
end
end
local cmd ="/helpcmdplus"
if message:sub(0, #cmd) == cmd then
if message == '/helpcmdplus' then
local player = minetest.env:get_player_by_name(name)
minetest.chat_send_all("additional Comands")
minetest.chat_send_all("==================")
minetest.chat_send_player(player:get_player_name(),"use /away for afk note from server.")
minetest.chat_send_player(player:get_player_name(),"use /re for no-longer-afk note from server.")
minetest.chat_send_player(player:get_player_name(),"use /spawn to teleporting you to the Spawnpoint.")
return true
end
end
end)
--Deds to Kahrl
minetest.register_on_newplayer(function(player)
player:setpos(spawn)
return true
end)
--Deds to Kahrl
minetest.register_on_respawnplayer(function(player, pos)
player:setpos(spawn)
return true
end)