diff options
Diffstat (limited to 'MCServer/Plugins/Core/kick.lua')
-rw-r--r-- | MCServer/Plugins/Core/kick.lua | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/MCServer/Plugins/Core/kick.lua b/MCServer/Plugins/Core/kick.lua index ce8bd7a31..5004c8c2f 100644 --- a/MCServer/Plugins/Core/kick.lua +++ b/MCServer/Plugins/Core/kick.lua @@ -4,26 +4,39 @@ function HandleKickCommand( Split, Player ) return true
end
+ local Reason = "You have been kicked"
+ if( #Split > 2 ) then
+ Reason = table.concat(Split, " ", 3)
+ end
+
+ if( KickPlayer( Split[2], Reason ) == false ) then
+ Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
+ end
+
+ return true
+end
+
+
+function KickPlayer( PlayerName, Reason )
+ local RealName = ""
local FoundPlayerCallback = function( OtherPlayer )
- local Reason = "You have been kicked"
- if( #Split > 2 ) then
- Reason = table.concat(Split, " ", 3)
+ if( Reason == nil ) then
+ Reason = "You have been kicked"
end
+
+ RealName = OtherPlayer:GetName()
local Server = cRoot:Get():GetServer()
- LOGINFO( Player:GetName() .. " is kicking " .. OtherPlayer:GetName() .. " ( "..Reason..") " )
- Server:SendMessage( "Kicking " .. OtherPlayer:GetName() )
+ LOGINFO( "'" .. RealName .. "' is being kicked for ( "..Reason..") " )
+ Server:SendMessage( "Kicking " .. RealName )
local ClientHandle = OtherPlayer:GetClientHandle()
ClientHandle:Kick( Reason )
end
- if( cRoot:Get():FindAndDoWithPlayer( Split[2], FoundPlayerCallback ) == false ) then
- Player:SendMessage( cChatColor.Green .. "Could not find player " .. Split[2] )
- return true
+ if( cRoot:Get():FindAndDoWithPlayer( PlayerName, FoundPlayerCallback ) == false ) then
+ return false -- could not find player
end
-
-
-
- return true
+
+ return true, RealName -- player should be kicked now
end
\ No newline at end of file |