I do not claim to understand how compilers work and whether something
SHOULD work or whether it shouldn't or why, but I have a suggestion for you.
I've had a problem similar to this before, and it seems that you must
seperate any 'if' statements where you are checking to see if a pointer is
valid from ANY use of that pointer. So you should *try* this:
if( pPlayer )
{
if( pPlayer->IsAlive( ) )
{
etc...
This is just an idea. If it works, good. If not, well, whatever.
- Varlock
----- Original Message -----
From: "Yacketta, Ronald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 02, 2002 7:15 PM
Subject: RE: [hlcoders] Items.cpp (MyTouch)
> What is wrong with this?
>
> while ( (pPlayer = (CBasePlayer*)UTIL_FindEntityByClassname(
> pPlayer, "player" )) != NULL) {
> if ( pPlayer && pPlayer->IsAlive() ) {
> vecSpot = pPlayer->Center();
> if ( vecSpot )
> UTIL_LogPrintf( "x[%d] y[%d]
> z[%d]\n", vecSpot.x, vecSpot.y, vecSpot.z );
> }
> }
>
> Same basic concept/code as in client.cpp... But this crashes *boggle*
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of botman
> Sent: Wednesday, January 02, 2002 5:21 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [hlcoders] Items.cpp (MyTouch)
>
>
> > I would not do that in the MyTouch correct?
> >
> > I drummed up this from the RadiousDamage
> >
> > BOOL MyTouch( CBasePlayer *pPlayer ) // was My Touch
> > {
> > CBaseEntity * pEntity = NULL;
> > TraceResult tr;
> > Vector vecSpot;
> >
> > while ((pEntity = UTIL_FindEntityInSphere( pEntity,
> > pev->origin, 600 )) != NULL)
> > {
> > vecSpot = pEntity->BodyTarget( pev->origin );
> > UTIL_TraceLine ( pev->origin, vecSpot,
> > dont_ignore_monsters, ENT(pev), &tr );
> > if ( tr.flFraction == 1.0 || tr.pHit ==
> > pEntity->edict() ) {
> > UTIL_ScreenFade( pPlayer,
> > Vector(255,255,255), 10.0, 2.0, 255, FFADE_IN);
> > }
> > }
> > pev->nextthink = gpGlobals->time + 0.1;
> > return TRUE;
> > }
> >
> > As you know by looking... CRASH is the word for the day..
> >
> > Not to sure where to put the trace code or even if it is correct
> >
> > -Ron
>
> I don't think Touch() functions are supposed to return anything. The
> SDK examples are all "void" type functions.
>
> 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
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders