From ea86eee74eba5f69e8813ba9c282d174aa18685a Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Sat, 15 Nov 2014 09:34:49 -0500 Subject: [PATCH] Fix SetAuthIdCookie's IsAuthIdConnect function's issues with mixed auth id types. --- extensions/clientprefs/extension.cpp | 28 ---------------------- extensions/clientprefs/extension.h | 1 - extensions/clientprefs/natives.cpp | 36 ++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/extensions/clientprefs/extension.cpp b/extensions/clientprefs/extension.cpp index 1c8665f7..ab5edd27 100644 --- a/extensions/clientprefs/extension.cpp +++ b/extensions/clientprefs/extension.cpp @@ -356,34 +356,6 @@ const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer) return steamId ? steamId : pPlayer->GetAuthString(); } -size_t IsAuthIdConnected(char *authID) -{ - IGamePlayer *player; - const char *authString; - - for (int playerIndex = playerhelpers->GetMaxClients()+1; --playerIndex > 0;) - { - player = playerhelpers->GetGamePlayer(playerIndex); - if (player == NULL || !player->IsConnected()) - { - continue; - } - - authString = GetPlayerCompatAuthId(player); - - if (authString == NULL || authString[0] == '\0') - { - continue; - } - - if (strcmp(authString, authID) == 0) - { - return playerIndex; - } - } - return 0; -} - void ClientPrefs::CatchLateLoadClients() { IGamePlayer *pPlayer; diff --git a/extensions/clientprefs/extension.h b/extensions/clientprefs/extension.h index 6178b83c..9e916ba6 100644 --- a/extensions/clientprefs/extension.h +++ b/extensions/clientprefs/extension.h @@ -182,7 +182,6 @@ public: }; const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer); -size_t IsAuthIdConnected(char *authID); extern sp_nativeinfo_t g_ClientPrefNatives[]; diff --git a/extensions/clientprefs/natives.cpp b/extensions/clientprefs/natives.cpp index 0478734f..28309ad1 100644 --- a/extensions/clientprefs/natives.cpp +++ b/extensions/clientprefs/natives.cpp @@ -83,6 +83,42 @@ cell_t FindClientPrefCookie(IPluginContext *pContext, const cell_t *params) NULL); } +size_t IsAuthIdConnected(char *authID) +{ + IGamePlayer *player; + const char *authString; + + for (int playerIndex = playerhelpers->GetMaxClients()+1; --playerIndex > 0;) + { + player = playerhelpers->GetGamePlayer(playerIndex); + if (player == NULL || !player->IsConnected()) + { + continue; + } + + authString = player->GetAuthString(); + if (authString == NULL || authString[0] == '\0' || strcmp(authString, authID) != 0) + { + continue; + } + + authString = player->GetSteam2Id(); + if (authString == NULL || authString[0] == '\0' || strcmp(authString, authID) != 0) + { + continue; + } + + authString = player->GetSteam3Id(); + if (authString == NULL || authString[0] == '\0' || strcmp(authString, authID) != 0) + { + continue; + } + + return playerIndex; + } + return 0; +} + cell_t SetAuthIdCookie(IPluginContext *pContext, const cell_t *params) { g_ClientPrefs.AttemptReconnection();