Difference between revisions of "UTIL PlayerByIndex"

From Valve Developer Community
Jump to: navigation, search
(Created page with 'CBasePlayer *UTIL_PlayerByIndex( int entindex ) { return ToBasePlayer( ClientEntityList().GetEnt( entindex ) ); Players entities range from 1 - MAXPLAYERS, and non-players enti…')
 
Line 4: Line 4:
  
 
(much thanks to DaFox for providing this information).
 
(much thanks to DaFox for providing this information).
 +
 +
gpGlobals->maxClients will return the number of connected clients.

Revision as of 00:30, 11 April 2011

CBasePlayer *UTIL_PlayerByIndex( int entindex ) { return ToBasePlayer( ClientEntityList().GetEnt( entindex ) );

Players entities range from 1 - MAXPLAYERS, and non-players entities start at MAXPLAYERS + 1. I.E if A joins (1), then B joins (2) then A leaves 1 will free up, Player C joins (1)

(much thanks to DaFox for providing this information).

gpGlobals->maxClients will return the number of connected clients.