inline CBasePlayer *AI_GetSinglePlayer() { if ( gpGlobals->maxClients > 1 ) // SteveUK: Gotta add some kind of selection, random player? NEED BETTER CODE. { int iRandomPlayerID = random->RandomInt( 1, gpGlobals->maxClients ); // this maybe unreliable so we gotta check it! for( int i = iRandomPlayerID; i != 0; i-- ) // this is to check if our player works, then it loops and finds a valid player ID below it. { CBasePlayer *pPlayer = UTIL_PlayerByIndex( i ); // try go for this player if( pPlayer ) // valid player { return pPlayer; } } return NULL; } return UTIL_GetLocalPlayer(); }