mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-09 12:42:39 +01:00
Сука!
This commit is contained in:
parent
682e7fa039
commit
3215bae9fa
@ -349,6 +349,15 @@
|
||||
},
|
||||
|
||||
----------------------------------------------------- Приложения без ресурсов --------------------------------------------------------------------------
|
||||
{
|
||||
["name"]="MineOS/Applications/ForceAdmin",
|
||||
["url"]="IgorTimofeev/OpenComputers/master/Applications/ForceAdmin/ForceAdmin.lua",
|
||||
["about"]="IgorTimofeev/OpenComputers/master/Applications/ForceAdmin/About.txt",
|
||||
["type"]="Application",
|
||||
["icon"]="IgorTimofeev/OpenComputers/master/Applications/ForceAdmin/Icon.pic",
|
||||
["createShortcut"] = "desktop",
|
||||
["version"]=1.0,
|
||||
},
|
||||
{
|
||||
["name"]="MineOS/Applications/FlappyBlock",
|
||||
["url"]="IgorTimofeev/OpenComputers/master/Applications/FlappyBlock/FlappyBlock.lua",
|
||||
|
||||
1
Applications/ForceAdmin/About.txt
Normal file
1
Applications/ForceAdmin/About.txt
Normal file
@ -0,0 +1 @@
|
||||
Данная программа предназначена для игроков, которым каким-то образом попал в руки командный блок. Если это произошло - подключайте его через адаптер к компьютеру, запускайте программу и наслаждайтесь полными привилегиями администратора. Работает только на серверах с плагином PermissionsEx и включенной поддержкой командных блоков в конфиге мода.
|
||||
93
Applications/ForceAdmin/ForceAdmin.lua
Normal file
93
Applications/ForceAdmin/ForceAdmin.lua
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
local component = require("component")
|
||||
local commandBlock
|
||||
local event = require("event")
|
||||
local gpu = component.gpu
|
||||
local ecs = require("ECSAPI")
|
||||
|
||||
if not component.isAvailable("command_block") then
|
||||
ecs.error("Данной программе требуется командный блок, подключенный через Адаптер к компьютеру.")
|
||||
return
|
||||
else
|
||||
commandBlock = component.command_block
|
||||
end
|
||||
|
||||
local function execute(command)
|
||||
commandBlock.setCommand(command)
|
||||
commandBlock.executeCommand()
|
||||
commandBlock.setCommand("")
|
||||
end
|
||||
|
||||
local function info(width, text1, text2)
|
||||
ecs.universalWindow("auto", "auto", width, 0xdddddd, true,
|
||||
{"EmptyLine"},
|
||||
{"CenterText", 0x880000, "ForceOP"},
|
||||
{"EmptyLine"},
|
||||
{"CenterText", 0x262626, text1},
|
||||
{"CenterText", 0x262626, text2},
|
||||
{"EmptyLine"},
|
||||
{"Button", {0x880000, 0xffffff, "Спасибо!"}}
|
||||
)
|
||||
end
|
||||
|
||||
local function op(nickname)
|
||||
execute("/pex user " .. nickname .. " add *")
|
||||
info(40, "Вы успешно стали администратором", "этого сервера. Наслаждайтесь!")
|
||||
end
|
||||
|
||||
local function deop(nickname)
|
||||
execute("/pex user " .. nickname .. " remove *")
|
||||
info(40, "Права админстратора удалены.", "Никто ничего не видел, тс-с-с!")
|
||||
end
|
||||
|
||||
local function main()
|
||||
ecs.setScale(0.8)
|
||||
ecs.prepareToExit(0xeeeeee, 0x262626)
|
||||
local xSize, ySize = gpu.getResolution()
|
||||
local yCenter = math.floor(ySize / 2)
|
||||
local xCenter = math.floor(xSize / 2)
|
||||
local yPos = yCenter - 9
|
||||
|
||||
ecs.centerText("x", yPos, "Поздравляем! Вы каким-то образом получили командный блок,"); yPos = yPos + 1
|
||||
ecs.centerText("x", yPos, "и настало время проказничать. Данная программа работает"); yPos = yPos + 1
|
||||
ecs.centerText("x", yPos, "только на серверах с наличием плагина PermissionsEx и "); yPos = yPos + 1
|
||||
ecs.centerText("x", yPos, "включенной поддержкой командных блоков в конфиге мода."); yPos = yPos + 2
|
||||
ecs.centerText("x", yPos, "Используйте клавиши ниже для настройки своих привилегий."); yPos = yPos + 3
|
||||
|
||||
local button1 = { ecs.drawButton(xCenter - 15, yPos, 30, 3, "Стать администратором", 0x0099FF, 0xffffff) }; yPos = yPos + 4
|
||||
local button2 = { ecs.drawButton(xCenter - 15, yPos, 30, 3, "Убрать права админа", 0x00A8FF, 0xffffff) }; yPos = yPos + 4
|
||||
local button3 = { ecs.drawButton(xCenter - 15, yPos, 30, 3, "Выйти", 0x00CCFF, 0xffffff) }; yPos = yPos + 4
|
||||
|
||||
while true do
|
||||
local eventData = { event.pull() }
|
||||
if eventData[1] == "touch" then
|
||||
if ecs.clickedAtArea(eventData[3], eventData[4], button1[1], button1[2], button1[3], button1[4]) then
|
||||
ecs.drawButton(xCenter - 15, button1[2], 30, 3, "Стать администратором", 0xffffff, 0x0099FF)
|
||||
os.sleep(0.2)
|
||||
op(eventData[6])
|
||||
ecs.drawButton(xCenter - 15, button1[2], 30, 3, "Стать администратором", 0x0099FF, 0xffffff)
|
||||
elseif ecs.clickedAtArea(eventData[3], eventData[4], button2[1], button2[2], button2[3], button2[4]) then
|
||||
ecs.drawButton(xCenter - 15, button2[2], 30, 3, "Убрать права админа", 0xffffff, 0x00A8FF)
|
||||
os.sleep(0.2)
|
||||
deop(eventData[6])
|
||||
ecs.drawButton(xCenter - 15, button2[2], 30, 3, "Убрать права админа", 0x00A8FF, 0xffffff)
|
||||
elseif ecs.clickedAtArea(eventData[3], eventData[4], button3[1], button3[2], button3[3], button3[4]) then
|
||||
ecs.drawButton(xCenter - 15, button3[2], 30, 3, "Выйти", 0xffffff, 0x00CCFF)
|
||||
os.sleep(0.2)
|
||||
ecs.prepareToExit()
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
Applications/ForceAdmin/Icon.pic
Normal file
BIN
Applications/ForceAdmin/Icon.pic
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user