Fix regression in DescribePlayer (%N / %L) for players not yet having entities (#2260)
* Define a constant for ENTREF_MASK * Fix regression in DescribePlayer for players that don't yet have entities
This commit is contained in:
@@ -576,7 +576,14 @@ int CoreProviderImpl::MaxClients()
|
||||
|
||||
bool CoreProviderImpl::DescribePlayer(int entRef, const char **namep, const char **authp, int *useridp)
|
||||
{
|
||||
int index = g_HL2.ReferenceToIndex(entRef);
|
||||
int index = entRef;
|
||||
if (entRef & ENTREF_MASK)
|
||||
{
|
||||
// Unless this is an explicit entity reference, we don't know nor care if the player has an entity yet,
|
||||
// as long as they are currently connected. (But if it *is* an explicit ref, validate it)
|
||||
index = g_HL2.ReferenceToIndex(entRef);
|
||||
}
|
||||
|
||||
CPlayer *player = g_Players.GetPlayerByIndex(index);
|
||||
if (!player || !player->IsConnected())
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user