Fix SetAuthIdCookie's IsAuthIdConnect function's issues with mixed auth id types.
This commit is contained in:
parent
f42a1fe0e4
commit
ea86eee74e
@ -356,34 +356,6 @@ const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer)
|
|||||||
return steamId ? steamId : pPlayer->GetAuthString();
|
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()
|
void ClientPrefs::CatchLateLoadClients()
|
||||||
{
|
{
|
||||||
IGamePlayer *pPlayer;
|
IGamePlayer *pPlayer;
|
||||||
|
@ -182,7 +182,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer);
|
const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer);
|
||||||
size_t IsAuthIdConnected(char *authID);
|
|
||||||
|
|
||||||
extern sp_nativeinfo_t g_ClientPrefNatives[];
|
extern sp_nativeinfo_t g_ClientPrefNatives[];
|
||||||
|
|
||||||
|
@ -83,6 +83,42 @@ cell_t FindClientPrefCookie(IPluginContext *pContext, const cell_t *params)
|
|||||||
NULL);
|
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)
|
cell_t SetAuthIdCookie(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
g_ClientPrefs.AttemptReconnection();
|
g_ClientPrefs.AttemptReconnection();
|
||||||
|
Loading…
Reference in New Issue
Block a user