由css源码修改过来的cs1.6添加好友代码?感兴趣的有时间可看下!(保留了修改痕迹)
// Update player info for all players
void UpdatePlayerInfo()
{
VecPlayers iInfo;
cl_entity_s *ent = NULL;
// IClientEntity *pEnt = NULL;
cl_entity_s *retval = NULL;
// C_BaseEntity *pBase = NULL;
vPlayers.clear(); // Delete old info
cl_entity_s *me = gEngfuncs.GetLocalPlayer();
// IClientEntity *pMe = entitylist->GetClientEntity(engine->GetLocalPlayer());
// for(int i = 0; i < entitylist->NumberOfEntities(0); i++)
for(int i = 0; i < cl_entity.Number(0); i++)
{
//pEnt = entitylist->GetClientEntity(i);
ent = gEngfuncs.GetEntityByIndex(i);
// We don't need to add ourselves
if(ent && me && ent->entindex() != me->entindex())
{
retval = ent->GetEntityByIndex();
// Is this a player?
if(retval && retval->Player())
{
// Get and save player info
if(gEngfuncs.GetPlayerInfo(i, &iInfo))
vPlayers.push_back(iInfo);