illuna/commands.lua

68 lines
2.8 KiB
Lua
Raw Normal View History

2016-06-05 18:55:27 +02:00
minetest.register_on_chat_message(function(name, message, playername, player)
local cmd ="/spawn"
2016-06-05 18:55:27 +02:00
if message:sub(0, #cmd) == cmd then
if message == '/spawn' then
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
2016-06-05 18:55:27 +02:00
end
end
2016-06-05 18:55:27 +02:00
local cmd ="/away"
if message:sub(0, #cmd) == cmd then
if message == '/away' then
local player = minetest.env:get_player_by_name(name)
2016-06-05 19:01:58 +02:00
minetest.chat_send_all(name.." is now away from keyboard!")
irc:say(string.format('*** %s is now away from keyboard.', player:get_player_name()))
2016-06-05 18:55:27 +02:00
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)
2016-06-05 19:01:58 +02:00
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
2016-06-05 18:55:27 +02:00
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)