summaryrefslogtreecommitdiff
path: root/mesecons_commandblock
diff options
context:
space:
mode:
Diffstat (limited to 'mesecons_commandblock')
-rw-r--r--mesecons_commandblock/init.lua16
1 files changed, 15 insertions, 1 deletions
diff --git a/mesecons_commandblock/init.lua b/mesecons_commandblock/init.lua
index 0ae1321..0cc91c9 100644
--- a/mesecons_commandblock/init.lua
+++ b/mesecons_commandblock/init.lua
@@ -3,7 +3,7 @@ minetest.register_chatcommand("say", {
description = "Say <text> as the server",
privs = {server=true},
func = function(name, param)
- minetest.chat_send_all(param)
+ minetest.chat_send_all(name .. ": " .. param)
end
})
@@ -20,6 +20,20 @@ minetest.register_chatcommand("tell", {
end
})
+minetest.register_chatcommand("hp", {
+ params = "<name> <value>",
+ description = "Set health of <name> to <value> hitpoints",
+ privs = {ban=true},
+ func = function(name, param)
+ local found, _, target, value = param:find("^([^%s]+)%s+(%d+)$")
+ if found == nil then
+ minetest.chat_send_player(name, "Invalid usage: " .. param)
+ return
+ end
+ minetest.get_player_by_name(target):set_hp(value)
+ end
+})
+
local initialize_data = function(meta, player, command, param)
meta:set_string("formspec",
"invsize[9,6;]" ..