1
0
This commit is contained in:
BlackImpostor 2024-05-14 19:29:16 +03:00 committed by GitHub
parent 00b442404c
commit a81764057d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 39 additions and 63 deletions

View File

@ -1,46 +1,5 @@
local have_spawn_command = minetest.get_modpath("spawn_command")
local enable_damage = core.settings:get_bool("enable_damage") local enable_damage = core.settings:get_bool("enable_damage")
-- 'spawn_command' mod
if have_spawn_command then
function set_the_spawn(name, param)
local p = {}
local posmessage = {x = 0, y = 0, z = 0}
local player = minetest.get_player_by_name(name);
local pos = player:get_pos();
local static_spawnpoint = minetest.setting_get_pos("static_spawnpoint");
local spawn_pos = vector.round(spawn_command.pos);
p.x, p.y, p.z = string.match(param, "^([%d.~-]+)[, ] *([%d.~-]+)[, ] *([%d.~-]+)$");
p = core.parse_coordinates(p.x, p.y, p.z, pos);
if player == nil then
return false
end
if p and p.x and p.y and p.z then
spawn_command.pos = {x = p.x, y = p.y, z = p.z};
static_spawnpoint = {x = p.x, y = p.y, z = p.z};
posmessage = {x = p.x, y = p.y, z = p.z};
minetest.chat_send_player(name, core.colorize("#00FF06", "Spawn sets successful at ".. posmessage.x .." ".. posmessage.y .." ".. posmessage.z .."!"))
elseif param == "" then
spawn_pos = vector.round(pos);
spawn_command.pos = spawn_pos;
static_spawnpoint = spawnpos;
minetest.chat_send_player(name, core.colorize("#00FF06", "Spawn sets successful at ".. spawn_pos.x .." ".. spawn_pos.y .." ".. spawn_pos.z .."!"))
else
minetest.chat_send_player(name, core.colorize("red", "Wrong position!"))
minetest.sound_play("error", name)
end
end
minetest.register_chatcommand("setspawn", {
params = "<X>,<Y>,<Z>",
description = "Sets a spawn point. (BETA)",
privs = {server = true},
func = set_the_spawn,
})
end
-- end
minetest.register_chatcommand("ip", { minetest.register_chatcommand("ip", {
params = "<name>", params = "<name>",
description = "Show the IP of a player.", description = "Show the IP of a player.",
@ -56,21 +15,26 @@ minetest.register_chatcommand("ip", {
return return
end end
minetest.chat_send_player(name, "IP address of ".. param .." is ".. minetest.get_player_ip(param)) minetest.chat_send_player(name, "IP address of ".. param .." is ".. minetest.get_player_ip(param))
end, end,
}) })
minetest.register_chatcommand("broadcast", { minetest.register_chatcommand("broadcast", {
params = "<message>", params = "<message>",
description = "Send GLOBAL message in chat.", description = "Send GLOBAL message in chat.",
privs = {server = true}, privs = {broadcast = true},
func = function(name, param) func = function(name, param)
if param == "" then if param == "" then
core.chat_send_player(name, core.colorize("red", "Message cannot be empty!")) core.chat_send_player(name, core.colorize("red", "Message cannot be empty!"))
minetest.sound_play("error", name) minetest.sound_play("error", name)
return
end
if minetest.check_player_privs(name, {server=true}) then
core.chat_send_all(core.colorize("#0006FF", "[Announcement] ")..core.colorize("#00FFC6", param))
else else
core.chat_send_all(core.colorize("#00FFC6", param)) core.chat_send_all(core.colorize("#0006FF", "[Announcement] ")..core.colorize("#00FFC6", param).." "..core.colorize("#82909D", string.format("(Announced by %s)", name)))
minetest.sound_play("broadcast") end
for _, player in ipairs(minetest.get_connected_players()) do
minetest.sound_play("broadcast", player:get_player_name())
end end
end, end,
}) })
@ -155,9 +119,9 @@ minetest.register_chatcommand("ban_menu", {
if core.is_singleplayer() then if core.is_singleplayer() then
minetest.chat_send_player(name, core.colorize("red", "You cannot ban in single mode!")) minetest.chat_send_player(name, core.colorize("red", "You cannot ban in single mode!"))
minetest.sound_play("error", name) minetest.sound_play("error", name)
else return
show_ban_menu(name)
end end
show_ban_menu(name)
end end
}) })
@ -168,9 +132,9 @@ minetest.register_chatcommand("kick_menu", {
if core.is_singleplayer() then if core.is_singleplayer() then
minetest.chat_send_player(name, core.colorize("red", "You cannot kick in single mode!")) minetest.chat_send_player(name, core.colorize("red", "You cannot kick in single mode!"))
minetest.sound_play("error", name) minetest.sound_play("error", name)
else return
show_kick_menu(name)
end end
show_kick_menu(name)
end end
}) })
@ -191,7 +155,7 @@ minetest.register_chatcommand("mute_menu", {
minetest.register_chatcommand("getpos", { minetest.register_chatcommand("getpos", {
params = "<name>", params = "<name>",
description = "Allows the player to find out the position of another player.", description = "Allows the player to find out the position of another player.",
privs = {server = true}, privs = {teleport = true},
func = function(name, param) func = function(name, param)
local player = minetest.get_player_by_name(param); local player = minetest.get_player_by_name(param);
if param == "" then if param == "" then
@ -201,13 +165,12 @@ minetest.register_chatcommand("getpos", {
elseif minetest.get_player_by_name(param) == nil then elseif minetest.get_player_by_name(param) == nil then
minetest.chat_send_player(name, core.colorize("red", "Player ".. param .." not found!")) minetest.chat_send_player(name, core.colorize("red", "Player ".. param .." not found!"))
minetest.sound_play("error", name) minetest.sound_play("error", name)
return return
else
local pos = player:get_pos();
local round_pos = vector.round(pos);
minetest.chat_send_player(name, "Position of ".. param .." is ".. round_pos.x .." ".. round_pos.y .." ".. round_pos.z)
end end
local pos = player:get_pos();
local round_pos = vector.round(pos);
minetest.chat_send_player(name, "Position of ".. param .." is ".. round_pos.x .." ".. round_pos.y .." ".. round_pos.z)
minetest.sound_play("done", name)
end, end,
}) })
@ -236,20 +199,28 @@ minetest.register_chatcommand("color", {
}) })
minetest.register_chatcommand("set_color", { minetest.register_chatcommand("set_color", {
params = "<name>", params = "<name> <color>",
description = "Sets a color for nickname of any player.", description = "Sets a color for nickname of any player.",
privs = {server = true}, privs = {server = true},
func = function(name, param) func = function(name, param)
if not param then local toname, color = string.match(param, "^([^ ]+) +(.+)$")
if not toname then
minetest.chat_send_player(name, core.colorize("red", "Please, specify an nickname of player.")) minetest.chat_send_player(name, core.colorize("red", "Please, specify an nickname of player."))
return return
end end
if minetest.get_player_by_name(param) == nil then if not color then
minetest.chat_send_player(name, core.colorize("red", "Please, specify an color for nickname."))
return
end
if minetest.get_player_by_name(toname) == nil then
minetest.chat_send_player(name, core.colorize("red", "Thats player offline or doesnt exist!")) minetest.chat_send_player(name, core.colorize("red", "Thats player offline or doesnt exist!"))
else else
minetest.get_player_by_name(othername):set_properties({ minetest.chat_send_player(name, string.format("Color of nickname for player %s successfully changed to %s", toname, color))
nametag = "*".. new_name, if essentials.changed_by then
nametag_color = "#AAAAAA" minetest.chat_send_player(toname, core.colorize("#00FF00", "Your color of nickname changed to \'".. color .."\' by ".. name))
end
minetest.get_player_by_name(toname):set_properties({
nametag_color = color
}) })
end end
end end

View File

@ -1,5 +1,5 @@
local http = minetest.request_http_api() local http = minetest.request_http_api()
local version = "0.7.1" local version = "0.7.2"
local modpath = minetest.get_modpath(minetest.get_current_modname()) local modpath = minetest.get_modpath(minetest.get_current_modname())
essentials = { essentials = {
a = "Created by SkyBuilder1717 (ContentDB)", a = "Created by SkyBuilder1717 (ContentDB)",

View File

@ -16,4 +16,9 @@ core.register_privilege("god_mode", {
core.register_privilege("colored_nickname", { core.register_privilege("colored_nickname", {
description = "Can use /color command", description = "Can use /color command",
give_to_singleplayer = false, give_to_singleplayer = false,
})
core.register_privilege("broadcast", {
description = "Can use /broadcast command",
give_to_singleplayer = false,
}) })