Page 1 of 1

[Mod] ChatCmdBuilder [0.1][chatcmdbuilder] - No regex!

PostPosted: Mon Jun 13, 2016 21:09
by rubenwardy
Easily create complex chat commands with no regex.

Thank you to Sobralia for the inspiration.

License: CC0
Github: https://github.com/rubenwardy/ChatCmdBuilder
Download: https://github.com/rubenwardy/ChatCmdBu ... master.zip

See README.md for more documentation.

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
ChatCmdBuilder.new("admin", function(cmd)
   cmd:sub("kill :target", function(name, target)
      local player = minetest.get_player_by_name(target)
      if player then
         player:set_hp(0)
         return true, "Killed " .. target
      else
         return false, "Unable to find " .. target
      end
   end)

   cmd:sub("move :target to :pos:pos", function(name, target, pos)
      local player = minetest.get_player_by_name(target)
      if player then
         player:setpos(pos)
         return true, "Moved " .. target .. " to " .. minetest.pos_to_string(pos)
      else
         return false, "Unable to find " .. target
      end
   end)
end, {
   description = "Admin tools",
   privs = {
      kick = true,
      ban = true
   }
})


A player could then do /admin kill player1 to kill player1, or /admin move player1 to 0,0,0 to teleport a user.

Re: [Mod] ChatCmdBuilder [0.1] - Complex cmds with no regex

PostPosted: Sun Jul 17, 2016 00:32
by ynong123
Nice work! I like your mod. I think others will like it too.