The playerinfomanager does not always seem to be working for me:
I have a line where it keeps updating my bot team index, in case the bot
switched teams. This seems to work:

    // When we already joined the game for one second, only then do this
    if ((pBot->fJoinTime > 0.0f) && (pBot->fJoinTime + 1 <
engine->Time()))
    {
        IPlayerInfo* pInfo =
playerinfomanager->GetPlayerInfo(pBot->edict);

        // Set team (in case the game dll changed it for us)
        pBot->iTeam = pInfo->GetTeamIndex();
    }


But, when i try to loop through the available players, i seem to get an
error at in this code:
        for ( int i = 1; i <= 32; i++ )  // EVIL: shouldn't just assume
maxplayers is 32!!!
        {
                edict_t *pPlayerEdict = INDEXENT( i );

        if (pPlayerEdict)   // valid edict
        {
            if (pPlayerEdict == pBot->edict)
                continue; // do not check self

            if ( !pPlayerEdict->IsFree() ) // valid client

                // ok, this COULD be our enemy, so check this team
status
                IPlayerInfo* pInfo =
playerinfomanager->GetPlayerInfo(pPlayerEdict);

                if (pInfo == NULL || !pInfo)
                    continue;

                // Set team (in case the game dll changed it for us)
                int iTeam = pInfo->GetTeamIndex(); //// *CRASH * * CRASH
*




I know i can probably even change teams when watching a proper "event" ,
on the FireEvent stuff. But thats not my question,

1) Why does the playerinfomanager work not all the time with the same
edict adress(es)?
2) Why does the playerinfomanager seem to return a proper pInfo (as it
bypasses the NULL and ! Condition) and then
   crashes on pInfo->GetTeamIndex() , while it DOES work that way
before?

Thx in advance for any info,

===============================================
Stefan Hendriks
FunDynamic & RealBot
http://www.fundynamic.nl
http://realbot.bots-united.com
http://www.bots-united.com

===============================================


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to