forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd_op.lua
33 lines (29 loc) · 806 Bytes
/
cmd_op.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local function GetAdminRankName()
local Ranks = cRankManager:GetAllRanks()
for _, Rank in ipairs(Ranks) do
local Permissions = cRankManager:GetRankPermissions(Rank)
for _, Permission in ipairs(Permissions) do
if Permission == "*" then
return Rank
end
end
end
end
function HandleOpCommand(Split, Player)
local Response
if not Split[2] then
Response = SendMessage(Player, "Usage: " .. Split[1] .. " <player>")
else
local PlayerName = Split[2]
local AdminRankName = GetAdminRankName()
if not AdminRankName then
Response = SendMessage(Player, "No admin rank found, missing * permission")
else
return HandleRankCommand({"rank", PlayerName, AdminRankName}, Player)
end
end
return true, Response
end
function HandleConsoleOp(Split)
return HandleOpCommand(Split)
end