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

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

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

by rubenwardy » Mon Jun 13, 2016 21:09

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.
Last edited by rubenwardy on Sat Jul 23, 2016 19:07, edited 1 time in total.
 

User avatar
ynong123
Member
 
Posts: 17
Joined: Fri Mar 11, 2016 13:24
GitHub: ynong123
IRC: ynong123
In-game: ynong123

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

by ynong123 » Sun Jul 17, 2016 00:32

Nice work! I like your mod. I think others will like it too.
Take a look of my mods:
Password Chest
Color Decoration Block

Forgive me if my English is bad.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 9 guests

cron