Implement /say and /tell commands to aid mapmakers using command blocks.

This commit is contained in:
Anthony Zhang 2012-12-25 14:26:03 -05:00
parent 973a9c650f
commit a9a2108d13
1 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,25 @@
minetest.register_chatcommand("say", {
params = "<text>",
description = "Say <text> as the server",
privs = {server=true},
func = function(name, param)
minetest.chat_send_all(param)
end
})
minetest.register_chatcommand("tell", {
params = "<name> <text>",
description = "Say <text> to <name> privately",
func = function(name, param)
local found, _, target, message = param:find("^([^%s]+)%s+(.*)$")
if found == nil then
minetest.chat_send_player(name, "Invalid usage: " .. param)
return
end
minetest.chat_send_player(target, name .. " whispers: " .. message)
end
})
local initialize_data = function(meta, player, command, param)
meta:set_string("formspec",
"invsize[9,6;]" ..