Skip to content

Commit cabf965

Browse files
committed
Fixed a to_python error.
Added support to reject connection requests.
1 parent 971dcde commit cabf965

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Diff for: src/core/addons/sp_addon.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ void CAddonManager::ClientSettingsChanged( edict_t *pEdict )
142142
//---------------------------------------------------------------------------------
143143
// Calls client connect listeners.
144144
//---------------------------------------------------------------------------------
145-
void CAddonManager::ClientConnect( bool *bAllowConnect, edict_t *pEntity,
145+
PLUGIN_RESULT CAddonManager::ClientConnect( bool *bAllowConnect, edict_t *pEntity,
146146
const char *pszName, const char *pszAddress, char *reject, int maxrejectlen )
147147
{
148-
CALL_LISTENERS(ClientConnect, *bAllowConnect, IndexFromEdict(pEntity), pszName, pszAddress, reject, maxrejectlen);
148+
CALL_LISTENERS(ClientConnect, ptr(new CPointer((unsigned long) bAllowConnect)), IndexFromEdict(pEntity), pszName, pszAddress, ptr(new CPointer((unsigned long) reject)), maxrejectlen);
149+
return PLUGIN_OVERRIDE;
149150
}
150151

151152
//---------------------------------------------------------------------------------

Diff for: src/core/addons/sp_addon.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class CAddonManager
5252
void ClientDisconnect( edict_t *pEntity );
5353
void ClientPutInServer( edict_t *pEntity, char const *playername );
5454
void ClientSettingsChanged( edict_t *pEdict );
55-
void ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen );
55+
PLUGIN_RESULT ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen );
5656

5757
void OnQueryCvarValueFinished( QueryCvarCookie_t iCookie, edict_t *pPlayerEntity, EQueryCvarValueStatus eStatus, const char *pCvarName, const char *pCvarValue );
5858

Diff for: src/core/core/sp_main.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ void CSourcePython::ClientSettingsChanged( edict_t *pEdict )
357357
//-----------------------------------------------------------------------------
358358
PLUGIN_RESULT CSourcePython::ClientConnect( bool *bAllowConnect, edict_t *pEntity, const char *pszName, const char *pszAddress, char *reject, int maxrejectlen )
359359
{
360-
g_AddonManager.ClientConnect(bAllowConnect, pEntity, pszName, pszAddress, reject, maxrejectlen);
361-
return PLUGIN_CONTINUE;
360+
return g_AddonManager.ClientConnect(bAllowConnect, pEntity, pszName, pszAddress, reject, maxrejectlen);
362361
}
363362

364363
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)