-
Notifications
You must be signed in to change notification settings - Fork 42
/
do.lua
55 lines (44 loc) · 1.47 KB
/
do.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function HandleDoCommand( Split, Player )
if #Split < 3 then
SendMessage( Player, "Usage: " .. Split[1] .. " <player> <command> [arguments ...]" )
return true
end
-- Get the command and arguments.
local newSplit = table.concat( Split, " ", 3 )
local FoundPlayerCallback = function( a_Player )
local pluginManager = cRoot:Get():GetPluginManager()
if (pluginManager:ExecuteCommand( a_Player, newSplit )) then
SendMessageSuccess( Player, "Command executed!" )
else
SendMessageFailure( Player, "Bad command - execution failed" )
end
return true
end
if not cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) then
SendMessageFailure( Player, "Could not find player" )
return true
end
return true
end
function HandleSudoCommand ( Split, Player )
if #Split < 3 then
SendMessage( Player, "Usage: " .. Split[1] .. " <player> <command> [arguments ...]" )
return true
end
-- Get the command and arguments.
local newSplit = table.concat( Split, " ", 3 )
local FoundPlayerCallback = function( a_Player )
local pluginManager = cRoot:Get():GetPluginManager()
if (pluginManager:ForceExecuteCommand( a_Player, newSplit )) then
SendMessageSuccess( Player, "Command executed!" )
else
SendMessageFailure( Player, "Bad command - execution failed" )
end
return true
end
if not cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) then
SendMessageFailure( Player, "Could not find player" )
return true
end
return true
end