about summary refs log tree commit diff
path: root/src/engine/server
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-12-30 00:07:17 +0100
committeroy <Tom_Adams@web.de>2011-12-30 00:07:17 +0100
commit1bb64d753432ddfd38694b04ff18d14679e08246 (patch)
tree96f01fa795a3af9b2ed0e347a6d8214e0a4a3b05 /src/engine/server
parent81e6cf6f83b8f45705f4c2a76ca4a1e647a3c4a2 (diff)
downloadzcatch-1bb64d753432ddfd38694b04ff18d14679e08246.tar.gz
zcatch-1bb64d753432ddfd38694b04ff18d14679e08246.zip
fixed last commit
Diffstat (limited to 'src/engine/server')
-rw-r--r--src/engine/server/server.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp
index 9bb36b74..d29b640b 100644
--- a/src/engine/server/server.cpp
+++ b/src/engine/server/server.cpp
@@ -1511,16 +1511,21 @@ void CServer::ConLogout(IConsole::IResult *pResult, void *pUser)
 {
 	CServer *pServer = (CServer *)pUser;
 
-	CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
-	Msg.AddInt(0);	//authed
-	Msg.AddInt(0);	//cmdlist
-	pServer->SendMsgEx(&Msg, MSGFLAG_VITAL, pServer->m_RconClientID, true);
-
-	pServer->m_aClients[pServer->m_RconClientID].m_Authed = AUTHED_NO;
-	pServer->SendRconLine(pServer->m_RconClientID, "You've logged out");
-	char aBuf[32];
-	str_format(aBuf, sizeof(aBuf), "ClientID=%d logged out", pServer->m_RconClientID);
-	pServer->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
+	if(pServer->m_RconClientID >= 0 && pServer->m_RconClientID < MAX_CLIENTS &&
+		pServer->m_aClients[pServer->m_RconClientID].m_State != CServer::CClient::STATE_EMPTY)
+	{
+		CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
+		Msg.AddInt(0);	//authed
+		Msg.AddInt(0);	//cmdlist
+		pServer->SendMsgEx(&Msg, MSGFLAG_VITAL, pServer->m_RconClientID, true);
+
+		pServer->m_aClients[pServer->m_RconClientID].m_Authed = AUTHED_NO;
+		pServer->m_aClients[pServer->m_RconClientID].m_pRconCmdToSend = 0;
+		pServer->SendRconLine(pServer->m_RconClientID, "Logout successful.");
+		char aBuf[32];
+		str_format(aBuf, sizeof(aBuf), "ClientID=%d logged out", pServer->m_RconClientID);
+		pServer->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
+	}
 }
 
 void CServer::ConchainSpecialInfoupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData)
@@ -1583,7 +1588,7 @@ void CServer::RegisterCommands()
 	Console()->Register("kick", "i?r", CFGFLAG_SERVER, ConKick, this, "Kick player with specified id for any reason");
 	Console()->Register("status", "", CFGFLAG_SERVER, ConStatus, this, "List players");
 	Console()->Register("shutdown", "", CFGFLAG_SERVER, ConShutdown, this, "Shut down");
-	Console()->Register("logout", "", CFGFLAG_SERVER, ConLogout, this, "Logs you out of Rcon");
+	Console()->Register("logout", "", CFGFLAG_SERVER, ConLogout, this, "Logout of rcon");
 
 	Console()->Register("record", "?s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "Record to a file");
 	Console()->Register("stoprecord", "", CFGFLAG_SERVER, ConStopRecord, this, "Stop recording");