PS. Could it be that the PlayerInfoManager can only handle a specific
amount of calls per frame? I noticed, when i did this:

if (pInfo == NULL || !pInfo)
                    return; // get out, this wont work :S

(so it would stop trying immidiatly after one 'try')

With one bot worked fine. With 2 worked fine ( 2 battled each other ).
But once i added more, it would crash. Dead bots
Do not think btw... So they do not call this function. My guess is
though that because this bot is dead , or 'joining'
The playerinfomanager is 'too soon' with gathering (invalid) info and
makes a crash. But then again, it does not make sense
On games that have bots already in th egame and then crashes. :S

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

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

-----Oorspronkelijk bericht-----
Van: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Namens S. Hendriks
Verzonden: dinsdag 11 januari 2005 15:21
Aan: HL Coders List
Onderwerp: [hlcoders] PlayerInfoManager Interface?


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





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

Reply via email to