From 7b75aaea7c538f61518a60fe4af363383020e0bc Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 29 Jun 2013 15:30:05 +0000 Subject: Advanced RCON: Command output is sent to the RCON client. RCON authentication is now required before executing commands. Console command handlers now return two values, bool (IsHandled) and string (CommandOutput). API change: removed cRoot:ExecuteConsoleCommand(), added cRoot:QueueExecuteConsoleCommand(). API change: removed cPluginManager:ExecuteConsoleCommand(), use cRoot:QueueExecuteConsoleCommand() instead git-svn-id: http://mc-server.googlecode.com/svn/trunk@1631 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Core/ban.lua | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'MCServer/Plugins/Core/ban.lua') diff --git a/MCServer/Plugins/Core/ban.lua b/MCServer/Plugins/Core/ban.lua index a4a4822bd..4e882b66f 100644 --- a/MCServer/Plugins/Core/ban.lua +++ b/MCServer/Plugins/Core/ban.lua @@ -18,23 +18,27 @@ function HandleBanCommand( Split, Player ) return true end -function BanPlayer( PlayerName, Reason ) - if( Reason == nil ) then + + + + +function BanPlayer(PlayerName, Reason) + -- Ban the player in the banned.ini: + BannedPlayersIni:SetValueB("Banned", PlayerName, true) + BannedPlayersIni:WriteFile() + + -- Kick the player: + if (Reason == nil) then Reason = "You have been banned" end - - local Success, RealName = KickPlayer( PlayerName, Reason ) - if( Success == false ) then - return false + local Success = KickPlayer(PlayerName, Reason) + if (not(Success)) then + return false; end - LOGINFO( "'" .. RealName .. "' is being banned for ( "..Reason..") " ) - - local Server = cRoot:Get():GetServer() - Server:SendMessage( "Banning " .. RealName ) - - BannedPlayersIni:SetValueB("Banned", RealName, true) - BannedPlayersIni:WriteFile() + LOGINFO("'" .. PlayerName .. "' has been banned (\"" .. Reason .. "\") "); + local Server = cRoot:Get():GetServer(); + Server:SendMessage("Banned " .. PlayerName); return true end \ No newline at end of file -- cgit v1.2.3