RE: [hlcoders] PlayerInfoManager Interface?

2005-01-11 Thread S. Hendriks
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



Re: [hlcoders] PlayerInfoManager Interface?

2005-01-11 Thread jeff broome
 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
 {

snip

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

Are you running a 32 player server?  If not, (say you're running an 8
player server), entities 9-32 will NOT be players, but you are
treating them as they are by trying to get the player info on them.
You should add a check to make sure entity X is actually a player (not
the EVIL part in the comment from my original code!!!)

Jeffrey botman Broome

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



RE: [hlcoders] PlayerInfoManager Interface?

2005-01-11 Thread S. Hendriks
DOH

*SLAPS WITH HAND AGAINST HEAD, VERY HARD*

I'll never try to code till late again :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 jeff broome
Verzonden: dinsdag 11 januari 2005 15:37
Aan: hlcoders@list.valvesoftware.com
Onderwerp: Re: [hlcoders] PlayerInfoManager Interface?


 You should add a check to make sure entity X is actually a player (not

 the EVIL part in the comment from my original code!!!)

not == note

Jeffrey botman Broome

___
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



RE: [hlcoders] PlayerInfoManager Interface?

2005-01-11 Thread S. Hendriks
I was running an 8 player server.

The following code fixed my problem:

pEnemyBaseEntity = CBaseEntity::Instance(pPlayerEdict);//
get the player entity

// Check if its a player. (thx botman for pointing me out on
this shame)
if (!pEnemyBaseEntity-IsPlayer())
continue;

Thx ;) Now on with the ray casting, because sometimes it seems to go
straight through a box or something...

===
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 jeff broome
Verzonden: dinsdag 11 januari 2005 15:36
Aan: hlcoders@list.valvesoftware.com
Onderwerp: Re: [hlcoders] PlayerInfoManager Interface?


 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
 {

snip

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

Are you running a 32 player server?  If not, (say you're running an 8
player server), entities 9-32 will NOT be players, but you are treating
them as they are by trying to get the player info on them. You should
add a check to make sure entity X is actually a player (not the EVIL
part in the comment from my original code!!!)

Jeffrey botman Broome

___
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