forked from cuberite/Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkick.lua
More file actions
29 lines (26 loc) · 821 Bytes
/
kick.lua
File metadata and controls
29 lines (26 loc) · 821 Bytes
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
function HandleKickCommand( Split, Player )
if( #Split < 2 ) then
SendMessage(Player, cChatColor.LightGray .. "Usage: " .. Split[1] .. " <player> [reason]")
return true
end
local Reason = cChatColor.Rose .. "You have been kicked."
if ( #Split > 2 ) then
Reason = table.concat( Split, " ", 3 )
end
local IsPlayerKicked = false
local Kick = function(OtherPlayer)
if (OtherPlayer:GetName() == Split[2]) then
IsPlayerKicked = true
KickPlayer(Split[2], Reason)
end
end
cRoot:Get():FindAndDoWithPlayer(Split[2], Kick)
if (IsPlayerKicked) then
SendMessage(Player, cChatColor.LightGray .. "Kicked the player " .. Split[2] .. ".")
return true
end
if (IsPlayerKicked == false) then
SendMessageFailure( Player, cChatColor.LightGray .. "Couldn't find that player.")
return true
end
end