These code snippets are examples of how the player database class can be integrated with a Half-Life client hook. They are taken from the current X-Spectate source (beta 6) but are here for illustration only -- they can definitely be improved upon substantially.

/*========================================================================================
===== This function is called when the user presses "F8" to view database information =====
  =======================================================================================*/

void ShowPlayerDatabaseInfo(void)
{
	pEngfuncs->Con_Printf("\nX-Spectate: player database entries\n");
	pEngfuncs->Con_Printf("----------------------------------------\n\n");
	pEngfuncs->Con_Printf("Database contains %d unique players.\n\n", g_PlayerDatabase.GetNumberOfUniquePlayers());
	for(int i = 1; i < 33; i++)
	{
		hud_player_info_t pPlayerInfo;
		pEngfuncs->pfnGetPlayerInfo(i, &pPlayerInfo);
		if(pPlayerInfo.name && pPlayerInfo.name[0])
		{
			string line;
			vector<string> names;

			line += pPlayerInfo.name;
			line += "  -  ";

			int uid = atoi(pEngfuncs->PlayerInfo_ValueForKey(i, "*fid"));
			int matches = g_PlayerDatabase.GetPlayerNames(uid, &names, 3);
			if(matches)
			{
				for(vector<string>::iterator j = names.begin(); j != names.end(); j++)
				{
					if(j != names.begin())
						line += ", ";
					line += *j;
				}
			}
			else
			{
				line += "[no database matches]";
			}
			pEngfuncs->Con_Printf("%s\n", line.c_str());
		}
	}
	pEngfuncs->Con_Printf("----------------------------------------\n\n");
}

/*=====================================================================================================
===== This function hook checks players against the database (and adds them) when they join the game=====
  =====================================================================================================*/

int hook_MsgTextMsg(const char *pszName, int iSize, void *pbuf)
{
	int ret;

	char *p;

	if(iSize > 10)
	{
		p = (char*)pbuf + 1;
		if(!strncmp(p, "#Game_join", 10))
		{
			while(*(p++) != '\0');
			for(int i = 1; i < 33; i++)
			{
				hud_player_info_t pPlayerInfo;
				pEngfuncs->pfnGetPlayerInfo(i, &pPlayerInfo);
				if(pPlayerInfo.name && pPlayerInfo.name[0])
				{
					//pEngfuncs->Con_Printf("checking %s against %s\n", p, pPlayerInfo.name);
					if(!strncmp(pPlayerInfo.name, p, strlen(pPlayerInfo.name)))
					{
						// easy way of adding the byte of SayText
						string line("[X-Spectate] ");
						vector<string> names;

						int uid = atoi(pEngfuncs->PlayerInfo_ValueForKey(i, "*fid"));
						int matches = g_PlayerDatabase.GetPlayerNames(uid, &names, 3);
						if(matches)
						{
							line += pPlayerInfo.name;
							line += " joined the game. Database entries: ";
							for(vector<string>::iterator j = names.begin(); j != names.end(); j++)
							{
								if(j != names.begin())
									line += ", ";
								line += *j;
							}
							line += ".";
						}
						else
						{
							line += pPlayerInfo.name;
							line += " joined the game. No database matches.";
						}
						pEngfuncs->Con_Printf("%s\n", line.c_str());
						char buf[4096];
						_snprintf(buf, 4095, "%c\x02%s\n", i, line.c_str());
						hook_MsgSayText("SayText", strlen(buf) + 1, buf);
						g_PlayerDatabase.AddPlayerName(uid, pPlayerInfo.name);
						break;
					}
				}
			}
		}
	}
	
	ret = orig_MsgTextMsg(pszName, iSize, pbuf);

	return ret;
}