-
关注Ta
-
- 注册时间 2004-07-09
- 最后登录 2008-01-25
-
- 发帖1257
- 在线1135小时
- 精华8
- DB29513
- 威望2067
- 保证金0
- 桃子0
- 鲜花0
- 鸡蛋0
-
访问TA的空间加好友用道具
|
When i was reading around i read the request from Speedy about how to draw the player list, well here it is, but it's just a base to see how it works
credits go to h1web, cause i used a small part from his "esp base" biggrin.gif, and panzer as usual for his isValidEnt function.
I couldn't test it but it should work, if it doesn't, tell me, leave a msg and tell me what's the problem
just call the drawPlayerList() every 1st viewport
Code: | //================================================================== ================ bool isValidEnt(cl_entity_s *ent) { if(ent && (ent != pEngfuncs->GetLocalPlayer()) && !(ent->curstate.effects & EF_NODRAW) && ent->player && !ent->curstate.spectator && ent->curstate.solid && !(ent->curstate.messagenum < pEngfuncs->GetLocalPlayer()->curstate.messagenum)) { return true; } else return false; }
// ================================================================================ == int Team(int i) // 1 is terror , 2 is counter , 3 is all the rest { hud_player_info_t pinfo; cl_entity_t *pMe = pEngfuncs->GetLocalPlayer();
cl_entity_s *ent = pEngfuncs->GetEntityByIndex(i); pEngfuncs->pfnGetPlayerInfo(i, &pinfo);
if(ent != NULL && isValidEnt(ent)) { if( strstr( pinfo.model, "arctic" ) || strstr( pinfo.model, "guerilla" ) || strstr( pinfo.model, "leet" ) || strstr( pinfo.model, "terror" ) ) { return 1; } else if( strstr( pinfo.model, "gign" ) || strstr( pinfo.model, "gsg9" ) || strstr( pinfo.model, "sas" ) || strstr( pinfo.model, "urban" ) || strstr( pinfo.model, "vip" ) ) { return 2; } else { return 0; } } }
// ================================================================================ == void drawPlayerList() { int terror_y = 0; int counter_y = 0; int x = 50; hud_player_info_t pInfo; for (int ax=0;ax<33;ax++) { cl_entity_s *ent = pEngfuncs->GetEntityByIndex(ax); pEngfuncs->pfnGetPlayerInfo(ax, &pInfo);
if (ent != NULL && isValidEnt(ent)) { char buf[128]; sprintf(buf,"%s",pInfo.name);
if (Team(ax) == 1) { DrawHudString(x,terror_y,255,0,0,buf); terror_y += 15; } else if (Team(ax) == 2) { DrawHudString(x+100,counter_y,0,0,255,buf); counter_y += 15; } } } }
|
|