1
0
This commit is contained in:
BlackImpostor 2023-10-03 18:46:18 +03:00 committed by GitHub
parent e290b30087
commit 5e8b585e13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 182 additions and 0 deletions

30
ui/about.lua Normal file
View File

@ -0,0 +1,30 @@
local FORMNAME = "essentials:about"
-- ban menu
function show_about(name)
local formspec = [[
formspec_version[6]
size[8.6,9.9]
image[1.6,0.1;5.6,5.6;essentials_logo.png]
label[3.3,6;ESSENTIALS]
label[0.1,8.5;Builder Mods STUDIO a studio that develops great]
label[0.1,8.9;mods and games for Minetest ContentDB.]
label[0.1,9.3;A studio that will always be topical\, a studio that will]
label[0.1,9.7;create comfort in the game.]
label[2.2,6.4;By Builder Mods STUDIO]
image[0.1,6.9;1,1;skybuilder.png]
label[1.2,7.2;Builder Mods STUDIO]
label[1.2,7.6;By -SkyBuilder-]
]]
minetest.show_formspec(name, FORMNAME, formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if formname ~= FORMNAME then
return
end
return
end)
-- end

43
ui/ban_menu.lua Normal file
View File

@ -0,0 +1,43 @@
local FORMNAME = "essentials:ban_menu"
-- ban menu
function show_ban_menu(name)
local formspec = [[
formspec_version[6]
size[12.5,4.5]
field[4.5,0.6;6.8,1;player;Player name;]
field[4.5,2.1;6.8,1;reason;Reason of ban;]
button[4.5,3.3;6.8,1.1;ban_btn;Ban the player]
image[0.2,0.2;4.2,4.2;ban_user.png]
image_button_exit[11.4,0.1;1,1;close_btn.png;close_btn;]
]]
minetest.show_formspec(name, FORMNAME, formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if formname ~= FORMNAME then
return
end
if fields.ban_btn then
local player_ban = minetest.get_player_by_name(fields.player)
local player_banned = fields.player
local reason_ban = fields.reason
if core.is_singleplayer() then
minetest.chat_send_player(name, core.colorize("red", "You cannot ban in single mode!"))
elseif not player_ban then
minetest.chat_send_player(name, core.colorize("red", "Player not found!"))
elseif reason_ban == "" then
core.ban_player(fields.player)
core.chat_send_all("Banned ".. player_banned ..".")
else
core.ban_player(fields.player)
core.chat_send_all("Banned ".. player_banned .." for ".. reason_ban ..".")
end
end
return
end)
-- end

43
ui/kick_menu.lua Normal file
View File

@ -0,0 +1,43 @@
local FORMNAME = "essentials:kick_menu"
-- ban menu
function show_kick_menu(name)
local formspec = [[
formspec_version[6]
size[12.5,4.5]
field[1.2,0.6;6.8,1;player;Player name;]
field[1.2,2.1;6.8,1;reason;Reason of kick;]
button[1.2,3.3;6.8,1.1;kick_btn;Kick the player]
image[8.2,0.2;4.2,4.2;kick_user.png]
image_button_exit[0.1,0.1;1,1;close_btn.png;close_btn;]
]]
minetest.show_formspec(name, FORMNAME, formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if formname ~= FORMNAME then
return
end
if fields.kick_btn then
local player_kick = minetest.get_player_by_name(fields.player)
local player_kicked = fields.player
local reason_kick = fields.reason
if core.is_singleplayer() then
minetest.chat_send_player(name, core.colorize("red", "You cannot kick in single mode!"))
elseif not player_kick then
minetest.chat_send_player(name, core.colorize("red", "Player not found!"))
elseif reason_kick == "" then
core.kick_player(fields.player, fields.reason)
core.chat_send_all("Kicked ".. player_kicked ..".")
else
core.kick_player(fields.player, fields.reason)
core.chat_send_all("Kicked ".. player_kicked .." for ".. reason_kick ..".")
end
end
return
end)
-- end

66
ui/mute_menu.lua Normal file
View File

@ -0,0 +1,66 @@
local FORMNAME = "essentials:ban_menu"
-- ban menu
function show_mute_menu(name)
local formspec = [[
formspec_version[6]
size[4.5,9.6]
field[0.1,4.9;4.3,1.1;player;Player for mute;]
button[0.1,6.1;4.3,1.1;mute_btn;Mute the player]
image[0.1,0.1;4.3,4.3;mute_user.png]
image_button_exit[3.4,8.5;1,1;close_btn.png;close_btn;]
button[0.1,7.3;4.3,1.1;unmute_btn;Unmute the player]
]]
minetest.show_formspec(name, FORMNAME, formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname ~= FORMNAME then
return
end
if fields.unmute_btn then
local admin = player:get_player_name()
local player_mutted = fields.player
local player = minetest.get_player_by_name(fields.player)
if core.is_singleplayer() then
minetest.chat_send_player(admin, core.colorize("red", "You cannot mute in single mode!"))
elseif player_mutted == "" then
minetest.chat_send_player(admin, core.colorize("red", "Player name cannot be empty!"))
elseif not player then
minetest.chat_send_player(admin, core.colorize("red", "Player not found!"))
elseif privs.shout == true then
minetest.chat_send_player(admin, core.colorize("red", "Player already unmuted!"))
else
local privs = minetest.get_player_privs(fields.player)
minetest.chat_send_all(player_mutted .. " has been unmuted.")
privs = {shout = true}
minetest.set_player_privs(player, privs)
end
end
if fields.mute_btn then
local admin = player:get_player_name()
local player_mutted = fields.player
local player = minetest.get_player_by_name(fields.player)
if core.is_singleplayer() then
minetest.chat_send_player(admin, core.colorize("red", "You cannot mute in single mode!"))
elseif player_mutted == "" then
minetest.chat_send_player(admin, core.colorize("red", "Player name cannot be empty!"))
elseif not player then
minetest.chat_send_player(admin, core.colorize("red", "Player not found!"))
elseif privs.shout == true then
minetest.chat_send_player(admin, core.colorize("red", "Player already muted!"))
else
local privs = minetest.get_player_privs(fields.player)
minetest.chat_send_all(player_mutted .. " has been muted.")
privs = {shout = true}
minetest.set_player_privs(player, privs)
end
end
return
end)
-- end