From 74a25097b258165ad858fea96d6a22b461c4ed0b Mon Sep 17 00:00:00 2001 From: Fyren Date: Mon, 13 Apr 2009 16:39:53 -0700 Subject: [PATCH] Fix OnClientConnect rejectmsg handling, improve doc (bug 3690, r=dvander) --- core/PlayerManager.cpp | 2 +- plugins/include/clients.inc | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index daa6030d..d3b72bf9 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -421,7 +421,7 @@ bool PlayerManager::OnClientConnect(edict_t *pEntity, const char *pszName, const pPlayer->Initialize(pszName, pszAddress, pEntity); m_clconnect->PushCell(client); - m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8, SM_PARAM_COPYBACK); + m_clconnect->PushStringEx(reject, maxrejectlen, SM_PARAM_STRING_UTF8 | SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); m_clconnect->PushCell(maxrejectlen); m_clconnect->Execute(&res); diff --git a/plugins/include/clients.inc b/plugins/include/clients.inc index e252407c..8c132610 100644 --- a/plugins/include/clients.inc +++ b/plugins/include/clients.inc @@ -63,6 +63,10 @@ public const MaxClients; /**< Maximum number of players the server supports (dyn * If you return false (or return nothing), the client will be rejected. If the client is * rejected by this forward or any other, OnClientDisconnect will not be called. * + * Note: Do not write to rejectmsg if you plan on returning true. If multiple plugins write + * to the string buffer, it is not defined which plugin's string will be shown to the client, + * but it is guaranteed one of them will. + * * @param client Client index. * @param rejectmsg Buffer to store the rejection message when the connection is refused. * @param maxlen Maximum number of characters for rejection buffer.