Added support files

Added privs levels
master
DonBatman 2016-03-21 18:30:00 -07:00
parent 443381d3c6
commit 323c169569
5 changed files with 225 additions and 36 deletions

6
Readme.md Normal file
View File

@ -0,0 +1,6 @@
myadmin
-------
Adds admin tools and chat commands to Minetest.
licence - DWYWPL

View File

@ -1,127 +1,127 @@
minetest.register_chatcommand("chats", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_player(name,"Available commands - /afk, /back, /here, /there, /happy, /sad, /surprised, /mad, /funny, /crazy, /hurt, /mining")
return true
end,
})
minetest.register_chatcommand("afk", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is AFK! ")
return true
end,
})
minetest.register_chatcommand("back", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is Back! ")
return true
end,
})
minetest.register_chatcommand("gtg", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." needs to go now. Bye!")
return true
end,
})
minetest.register_chatcommand("bbl", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is leaving and will be back later.")
return true
end,
})
minetest.register_chatcommand("lol", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is laughing out loud! Ha Ha Ha Ha Ha Ha Ha ")
return true
end,
})
minetest.register_chatcommand("happy", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is Happy! ")
return true
end,
})
minetest.register_chatcommand("sad", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is Sad! ")
return true
end,
})
minetest.register_chatcommand("surprised", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is Surprised! ")
return true
end,
})
minetest.register_chatcommand("mad", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is Soooooooooo Mad! ")
return true
end,
})
minetest.register_chatcommand("here", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all("The amazing "..name.." is here! ")
return true
end,
})
minetest.register_chatcommand("there", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is not there! "..name.." is here")
return true
end,
})
minetest.register_chatcommand("funny", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is soooooooooooo funny! ")
return true
end,
})
minetest.register_chatcommand("crazy", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is losing their mind! ")
return true
end,
})
minetest.register_chatcommand("hurt", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is hurt! ")
return true
end,
})
minetest.register_chatcommand("mining", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all(name.." is Mining! ")
return true
end,
})
minetest.register_chatcommand("max", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all("Max is the greatest guy ever! Except for Batman. Batman is better!")
return true
end,
})
minetest.register_chatcommand("bat", {
privs = {talk = true},
func = function(text)
privs = {shout = true},
func = function(name, param)
minetest.chat_send_all("Batman is the greatest guy ever! Except for Max. Max is better!")
return true
end,

View File

@ -1,3 +1,4 @@
dofile(minetest.get_modpath("myadmin").."/tools.lua")
dofile(minetest.get_modpath("myadmin").."/spawn.lua")
dofile(minetest.get_modpath("myadmin").."/chat.lua")
dofile(minetest.get_modpath("myadmin").."/privs.lua")

13
licence.txt Normal file
View File

@ -0,0 +1,13 @@
DO WHAT YOU WANT TO PUBLIC LICENSE
or abbreviated DWYWPL
December 2nd 2015
License Copyright (C) 2015 Michael Tomaino (PlatinumArts@gmail.com)
www.sandboxgamemaker.com/DWYWPL/
DO WHAT YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
1. You are allowed to do whatever you want to with what content is using this license.
2. This content is provided 'as-is', without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this content.

169
privs.lua Normal file
View File

@ -0,0 +1,169 @@
minetest.register_privilege("myadmin_levels", "Lets person set level of privlege people have")
minetest.register_chatcommand("tps_commands", {
privs = {privs = true},
func = function(name, param)
minetest.chat_send_player(name,"Available commands - /admin, /mod, /helper, /norm, /punish, /unpunish, silence")
return true
end,
})
minetest.register_chatcommand("admin", {
params = "",
description = "Administrator",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.shout=true
privs.interact=true
privs.home=true
privs.give=true
privs.teleport=true
privs.bring=true
privs.fast=true
privs.fly=true
privs.noclip=true
privs.privs=true
privs.basic_privs=true
privs.kick=true
privs.ban=true
privs.myadmin_levels=true
privs.tps_magicchests=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now an Admin")
minetest.chat_send_player(name, param .. " is now an Admin")
return true
end
end})
minetest.register_chatcommand("mod", {
params = "",
description = "Moderator",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.shout=true
privs.interact=true
privs.home=true
privs.teleport=true
privs.fast=true
privs.fly=true
privs.basic_privs=true
privs.kick=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now a Moderator")
minetest.chat_send_player(name, param .. " is now a Moderator")
return true
end
end})
minetest.register_chatcommand("helper", {
params = "",
description = "Helper",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.shout=true
privs.interact=true
privs.home=true
privs.fast=true
privs.fly=true
privs.kick=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now a Helper")
minetest.chat_send_player(name, param .. " is now a Helper")
return true
end
end})
minetest.register_chatcommand("norm", {
params = "",
description = "Normal Player",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.shout=true
privs.interact=true
privs.home=true
privs.fast=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now a Normal Player")
minetest.chat_send_player(name, param .. " is now a Normal Player")
return true
end
end})
minetest.register_chatcommand("unpunish", {
params = "",
description = "Unpunish Player",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.shout=true
privs.interact=true
privs.home=true
privs.fast=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now unpunished")
minetest.chat_send_player(name, param .. " is now unpunished")
return true
end
end})
minetest.register_chatcommand("punish", {
params = "",
description = "Punish Player",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.shout=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now being punished")
minetest.chat_send_player(name, param .. " is now punished")
return true
end
end})
minetest.register_chatcommand("silence", {
params = "",
description = "Silence Player",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
local privs=minetest.get_player_privs(param)
privs.interact=true
privs.home=true
privs.fast=true
minetest.set_player_privs(param,privs)
minetest.chat_send_player(param, "You are now silenced")
minetest.chat_send_player(name, param .. " is now silenced")
return true
end
end})
minetest.register_chatcommand("ghost", {
params = "",
description = "Remove all privs",
privs={myadmin_levels=true},
func = function(name, param)
if minetest.get_player_by_name(param) then
minetest.set_player_privs(param, {})
minetest.chat_send_player(param, "You are now a ghost")
minetest.chat_send_player(name, param .. " is now ghosted")
return true
end
end})