Update init.lua

This commit is contained in:
Emojigit 2020-08-04 14:41:00 +08:00 committed by GitHub
parent 7efa94a208
commit ceff769ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,8 @@
minetest.register_privilege("setblock", {
description = "Player can use place and setblock command.",
give_to_singleplayer= false,
})
local function split (inputstr, sep)
if sep == nil then
sep = "%s"
@ -12,7 +17,7 @@ end
minetest.register_chatcommand("place", {
params = "<x> <y> <x> <nodename>",
description = "Place block",
privs = {creative = true},
privs = {setblock = true},
func = function(name, param)
splited = split(param," ")
if not(tonumber(splited[1]) and tonumber(splited[2]) and tonumber(splited[3])) then
@ -33,7 +38,7 @@ minetest.register_chatcommand("place", {
minetest.register_chatcommand("place_here", {
params = "<node>",
privs = {creative = true},
privs = {setblock = true},
description = "Place block at player's pos",
func = function(name, param)
local player = minetest.get_player_by_name(name)
@ -56,7 +61,7 @@ minetest.register_chatcommand("place_here", {
minetest.register_chatcommand("setblock", {
params = "<x> <y> <x> <nodename>",
privs = {creative = true},
privs = {setblock = true},
description = "Set a block",
func = function(name, param)
splited = split(param," ")
@ -78,7 +83,7 @@ minetest.register_chatcommand("setblock", {
minetest.register_chatcommand("setblock_here", {
params = "<node>",
privs = {creative = true},
privs = {setblock = true},
description = "Set a block at player's pos",
func = function(name, param)
local player = minetest.get_player_by_name(name)