Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ minetest.register_chatcommand("run_as", {
end,
})

minetest.register_chatcommand("repeat", {
params = "<repetitions> /<command>",
description = "Run a chatcommand multiple times",
func = function(name, param)
local repetitions, msg = param:match"^([0-9]+) *(/.*)"
if not repetitions then
return false, "Invalid arguments (see /help run_as)."
end
repetitions = tonumber(repetitions)
if repetitions > 5
and not minetest.check_player_privs(name, "server") then
return false,
"More than 5 repetitions require the server privilege."
end
for _ = 1, repetitions do
execute_chatcommand(name, msg)
end
end,
})

minetest.register_chatcommand("grantme", {
params = "<privilege>|all",
description = "Give privilege to yourself",
Expand Down