PDA

View Full Version : Iterating through players



pimpinjuice
11-17-2009, 02:17 PM
Hey all.

So, how are you iterating through clients? This is how I have been doing it, but it fails because when a player is no longer being rendered, their pointer is still valid but their GetAbsOrigin() returns the value of the last remembered origin.

for(int x=1;x<65;x++)
{
C_BaseEntity *pent=(C_BaseEntity*)m_pEntList->GetClientEntity(x);
if(pent && pent->IsPlayer() && res->IsConnected(x) && res->IsAlive(x) && res->GetTeam(x)!=our_team)
{
m_pMenu->drawText(200,10*x,255,0,0,"%d: %f %f %f",x,pent->GetAbsOrigin().x,pent->GetAbsOrigin().y,pent->GetAbsOrigin().z);
}
}

Thanks

Xeno123
11-17-2009, 02:18 PM
if( ! pEnt->IsDormant....
k

pimpinjuice
11-17-2009, 02:20 PM
haha thanks
great work as always :P