2012-01-26 17:44:37 -05:00
|
|
|
function HandleKickCommand( Split, Player )
|
|
|
|
if( #Split < 2 ) then
|
|
|
|
Player:SendMessage( cChatColor.Green .. "Usage: /kick [Player] <Reason>" )
|
|
|
|
return true
|
|
|
|
end
|
2012-08-22 19:05:12 -04:00
|
|
|
|
|
|
|
local FoundPlayerCallback = function( OtherPlayer )
|
|
|
|
local Reason = "You have been kicked"
|
|
|
|
if( #Split > 2 ) then
|
|
|
|
Reason = table.concat(Split, " ", 3)
|
|
|
|
end
|
2012-01-26 17:44:37 -05:00
|
|
|
|
2012-08-22 19:05:12 -04:00
|
|
|
local Server = cRoot:Get():GetServer()
|
|
|
|
LOGINFO( Player:GetName() .. " is kicking " .. OtherPlayer:GetName() .. " ( "..Reason..") " )
|
|
|
|
Server:SendMessage( "Kicking " .. OtherPlayer:GetName() )
|
|
|
|
|
|
|
|
local ClientHandle = OtherPlayer:GetClientHandle()
|
|
|
|
ClientHandle:Kick( Reason )
|
2012-01-26 17:44:37 -05:00
|
|
|
end
|
|
|
|
|
2012-08-22 19:05:12 -04:00
|
|
|
if( cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) == false ) then
|
|
|
|
Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
|
|
|
|
return true
|
2012-01-26 17:44:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|